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
/// underscores into hypens.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[derive(Debug, Clone, Eq, PartialEq, Hash, PartialOrd, Ord)]
pub(crate) struct Identifier(String);
impl From<String> for Identifier {

View File

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