Skip to content

Commit 3c64add

Browse files
committed
Revert "Add built-in variables e and pi. (#907)"
This reverts commit 2cb69e7.
1 parent 2cb69e7 commit 3c64add

File tree

3 files changed

+5
-16
lines changed

3 files changed

+5
-16
lines changed

CHANGELOG.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
* `hypot()`: given *n* numbers, outputs the length of the *n*-dimensional
77
vector that has components equal to each of the inputs.
88

9-
* Add the variables `$pi` and `$e` to the built-in "sass:math" module.
10-
119
## 1.24.0
1210

1311
* Add an optional `with` clause to the `@forward` rule. This works like the

lib/src/functions/math.dart

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@ final global = UnmodifiableListView([
2525
final module = BuiltInModule("math", functions: [
2626
_abs, _ceil, _clamp, _compatible, _floor, _hypot, _isUnitless, _max, _min, //
2727
_percentage, _randomFunction, _round, _unit,
28-
], variables: {
29-
"e": SassNumber(math.e),
30-
"pi": SassNumber(math.pi),
31-
});
28+
]);
3229

3330
/// Returns a [Callable] named [name] that transforms a number's value
3431
/// using [transform] and preserves its units.

lib/src/module/built_in.dart

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,19 @@ class BuiltInModule<T extends AsyncCallable> implements Module<T> {
1717
final Uri url;
1818
final Map<String, T> functions;
1919
final Map<String, T> mixins;
20-
final Map<String, Value> variables;
2120

2221
List<Module<T>> get upstream => const [];
22+
Map<String, Value> get variables => const {};
2323
Map<String, AstNode> get variableNodes => const {};
2424
Extender get extender => Extender.empty;
2525
CssStylesheet get css => CssStylesheet.empty(url: url);
2626
bool get transitivelyContainsCss => false;
2727
bool get transitivelyContainsExtensions => false;
2828

29-
BuiltInModule(String name,
30-
{Iterable<T> functions, Iterable<T> mixins, Map<String, Value> variables})
29+
BuiltInModule(String name, {Iterable<T> functions, Iterable<T> mixins})
3130
: url = Uri(scheme: "sass", path: name),
3231
functions = _callableMap(functions),
33-
mixins = _callableMap(mixins),
34-
variables =
35-
variables == null ? const {} : UnmodifiableMapView(variables);
32+
mixins = _callableMap(mixins);
3633

3734
/// Returns a map from [callables]' names to their values.
3835
static Map<String, T> _callableMap<T extends AsyncCallable>(
@@ -43,10 +40,7 @@ class BuiltInModule<T extends AsyncCallable> implements Module<T> {
4340
{for (var callable in callables) callable.name: callable}));
4441

4542
void setVariable(String name, Value value, AstNode nodeWithSpan) {
46-
if (!variables.containsKey(name)) {
47-
throw SassScriptException("Undefined variable.");
48-
}
49-
throw SassScriptException("Cannot modify built-in variable.");
43+
throw SassScriptException("Undefined variable.");
5044
}
5145

5246
Module<T> cloneCss() => this;

0 commit comments

Comments
 (0)