use btreemap to back scope

This commit is contained in:
Connor Skees 2020-07-08 20:50:18 -04:00
parent ca370eb9b0
commit 5b2cc1df77
2 changed files with 8 additions and 8 deletions

View File

@ -110,7 +110,7 @@ impl ListSeparator {
/// ///
/// This struct protects that invariant by normalizing all /// This struct protects that invariant by normalizing all
/// underscores into hypens. /// underscores into hypens.
#[derive(Debug, Clone, Eq, PartialEq, Hash)] #[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
pub(crate) struct Identifier(String); pub(crate) struct Identifier(String);
impl From<String> for Identifier { impl From<String> for Identifier {

View File

@ -1,4 +1,4 @@
use std::collections::HashMap; use std::collections::BTreeMap;
use codemap::Spanned; use codemap::Spanned;
@ -12,18 +12,18 @@ use crate::{
#[derive(Debug, Default)] #[derive(Debug, Default)]
pub(crate) struct Scope { pub(crate) struct Scope {
vars: HashMap<Identifier, Spanned<Value>>, vars: BTreeMap<Identifier, Spanned<Value>>,
mixins: HashMap<Identifier, Mixin>, mixins: BTreeMap<Identifier, Mixin>,
functions: HashMap<Identifier, Function>, functions: BTreeMap<Identifier, Function>,
} }
impl Scope { impl Scope {
#[must_use] #[must_use]
pub fn new() -> Self { pub fn new() -> Self {
Self { Self {
vars: HashMap::new(), vars: BTreeMap::new(),
mixins: HashMap::new(), mixins: BTreeMap::new(),
functions: HashMap::new(), functions: BTreeMap::new(),
} }
} }