diff --git a/CHANGELOG.md b/CHANGELOG.md index 7093b4778..a47dc2b31 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,8 +6,6 @@ * `hypot()`: given *n* numbers, outputs the length of the *n*-dimensional vector that has components equal to each of the inputs. -* Add the variables `$pi` and `$e` to the built-in "sass:math" module. - ## 1.24.0 * Add an optional `with` clause to the `@forward` rule. This works like the diff --git a/lib/src/functions/math.dart b/lib/src/functions/math.dart index 84d81ff9c..e0a106183 100644 --- a/lib/src/functions/math.dart +++ b/lib/src/functions/math.dart @@ -25,10 +25,7 @@ final global = UnmodifiableListView([ final module = BuiltInModule("math", functions: [ _abs, _ceil, _clamp, _compatible, _floor, _hypot, _isUnitless, _max, _min, // _percentage, _randomFunction, _round, _unit, -], variables: { - "e": SassNumber(math.e), - "pi": SassNumber(math.pi), -}); +]); /// Returns a [Callable] named [name] that transforms a number's value /// using [transform] and preserves its units. diff --git a/lib/src/module/built_in.dart b/lib/src/module/built_in.dart index 8e4abf413..63d098687 100644 --- a/lib/src/module/built_in.dart +++ b/lib/src/module/built_in.dart @@ -17,22 +17,19 @@ class BuiltInModule implements Module { final Uri url; final Map functions; final Map mixins; - final Map variables; List> get upstream => const []; + Map get variables => const {}; Map get variableNodes => const {}; Extender get extender => Extender.empty; CssStylesheet get css => CssStylesheet.empty(url: url); bool get transitivelyContainsCss => false; bool get transitivelyContainsExtensions => false; - BuiltInModule(String name, - {Iterable functions, Iterable mixins, Map variables}) + BuiltInModule(String name, {Iterable functions, Iterable mixins}) : url = Uri(scheme: "sass", path: name), functions = _callableMap(functions), - mixins = _callableMap(mixins), - variables = - variables == null ? const {} : UnmodifiableMapView(variables); + mixins = _callableMap(mixins); /// Returns a map from [callables]' names to their values. static Map _callableMap( @@ -43,10 +40,7 @@ class BuiltInModule implements Module { {for (var callable in callables) callable.name: callable})); void setVariable(String name, Value value, AstNode nodeWithSpan) { - if (!variables.containsKey(name)) { - throw SassScriptException("Undefined variable."); - } - throw SassScriptException("Cannot modify built-in variable."); + throw SassScriptException("Undefined variable."); } Module cloneCss() => this;