rename register to declare

This commit is contained in:
ConnorSkees 2020-05-16 18:01:06 -04:00
parent a3604491e9
commit 1fb6822259
11 changed files with 20 additions and 20 deletions

View File

@ -502,7 +502,7 @@ fn invert(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> SassR
} }
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("hsl", Builtin::new(hsl)); f.insert("hsl", Builtin::new(hsl));
f.insert("hsla", Builtin::new(hsla)); f.insert("hsla", Builtin::new(hsla));
f.insert("hue", Builtin::new(hue)); f.insert("hue", Builtin::new(hue));

View File

@ -7,9 +7,9 @@ mod opacity;
mod other; mod other;
mod rgb; mod rgb;
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
hsl::register(f); hsl::declare(f);
opacity::register(f); opacity::declare(f);
other::register(f); other::declare(f);
rgb::register(f); rgb::declare(f);
} }

View File

@ -154,7 +154,7 @@ fn fade_out(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> Sas
Ok(Value::Color(Box::new(color.fade_out(amount)))) Ok(Value::Color(Box::new(color.fade_out(amount))))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("alpha", Builtin::new(alpha)); f.insert("alpha", Builtin::new(alpha));
f.insert("opacity", Builtin::new(opacity)); f.insert("opacity", Builtin::new(opacity));
f.insert("opacify", Builtin::new(opacify)); f.insert("opacify", Builtin::new(opacify));

View File

@ -349,7 +349,7 @@ fn ie_hex_str(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> S
Ok(Value::Ident(color.to_ie_hex_str(), QuoteKind::None)) Ok(Value::Ident(color.to_ie_hex_str(), QuoteKind::None))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("change-color", Builtin::new(change_color)); f.insert("change-color", Builtin::new(change_color));
f.insert("adjust-color", Builtin::new(adjust_color)); f.insert("adjust-color", Builtin::new(adjust_color));
f.insert("scale-color", Builtin::new(scale_color)); f.insert("scale-color", Builtin::new(scale_color));

View File

@ -434,7 +434,7 @@ fn mix(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> SassResu
Ok(Value::Color(Box::new(color1.mix(&color2, weight)))) Ok(Value::Color(Box::new(color1.mix(&color2, weight))))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("rgb", Builtin::new(rgb)); f.insert("rgb", Builtin::new(rgb));
f.insert("rgba", Builtin::new(rgba)); f.insert("rgba", Builtin::new(rgba));
f.insert("red", Builtin::new(red)); f.insert("red", Builtin::new(red));

View File

@ -316,7 +316,7 @@ fn zip(args: CallArgs, scope: &Scope, super_selector: &Selector) -> SassResult<V
Ok(Value::List(result, ListSeparator::Comma, Brackets::None)) Ok(Value::List(result, ListSeparator::Comma, Brackets::None))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("length", Builtin::new(length)); f.insert("length", Builtin::new(length));
f.insert("nth", Builtin::new(nth)); f.insert("nth", Builtin::new(nth));
f.insert("list-separator", Builtin::new(list_separator)); f.insert("list-separator", Builtin::new(list_separator));

View File

@ -129,7 +129,7 @@ fn map_remove(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> S
Ok(Value::Map(map)) Ok(Value::Map(map))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("map-get", Builtin::new(map_get)); f.insert("map-get", Builtin::new(map_get));
f.insert("map-has-key", Builtin::new(map_has_key)); f.insert("map-has-key", Builtin::new(map_has_key));
f.insert("map-keys", Builtin::new(map_keys)); f.insert("map-keys", Builtin::new(map_keys));

View File

@ -189,7 +189,7 @@ fn random(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> SassR
)) ))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("percentage", Builtin::new(percentage)); f.insert("percentage", Builtin::new(percentage));
f.insert("round", Builtin::new(round)); f.insert("round", Builtin::new(round));
f.insert("ceil", Builtin::new(ceil)); f.insert("ceil", Builtin::new(ceil));

View File

@ -232,7 +232,7 @@ fn call(mut args: CallArgs, scope: &Scope, super_selector: &Selector) -> SassRes
func.call(args.decrement(), scope, super_selector) func.call(args.decrement(), scope, super_selector)
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("if", Builtin::new(if_)); f.insert("if", Builtin::new(if_));
f.insert("feature-exists", Builtin::new(feature_exists)); f.insert("feature-exists", Builtin::new(feature_exists));
f.insert("unit", Builtin::new(unit)); f.insert("unit", Builtin::new(unit));

View File

@ -45,11 +45,11 @@ impl PartialEq for Builtin {
pub(crate) static GLOBAL_FUNCTIONS: Lazy<GlobalFunctionMap> = Lazy::new(|| { pub(crate) static GLOBAL_FUNCTIONS: Lazy<GlobalFunctionMap> = Lazy::new(|| {
let mut m = HashMap::new(); let mut m = HashMap::new();
color::register(&mut m); color::declare(&mut m);
list::register(&mut m); list::declare(&mut m);
map::register(&mut m); map::declare(&mut m);
math::register(&mut m); math::declare(&mut m);
meta::register(&mut m); meta::declare(&mut m);
string::register(&mut m); string::declare(&mut m);
m m
}); });

View File

@ -357,7 +357,7 @@ fn unique_id(args: CallArgs, _: &Scope, _: &Selector) -> SassResult<Value> {
Ok(Value::Ident(string, QuoteKind::None)) Ok(Value::Ident(string, QuoteKind::None))
} }
pub(crate) fn register(f: &mut GlobalFunctionMap) { pub(crate) fn declare(f: &mut GlobalFunctionMap) {
f.insert("to-upper-case", Builtin::new(to_upper_case)); f.insert("to-upper-case", Builtin::new(to_upper_case));
f.insert("to-lower-case", Builtin::new(to_lower_case)); f.insert("to-lower-case", Builtin::new(to_lower_case));
f.insert("str-length", Builtin::new(str_length)); f.insert("str-length", Builtin::new(str_length));