Skip to content

Commit 6234489

Browse files
authored
Explicitly set the JS class names for SassNull and SassBoolean (#941)
For whatever reason the default name seems to have changed.
1 parent 5450c1c commit 6234489

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-0
lines changed

lib/src/node/utils.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,12 @@ class _PropertyDescriptor {
9494
@JS("Object.create")
9595
external Object _create(Object prototype);
9696

97+
/// Sets the name of `object`'s class to `name`.
98+
void setClassName(Object object, String name) {
99+
_defineProperty(getProperty(object, "constructor"), "name",
100+
_PropertyDescriptor(value: name));
101+
}
102+
97103
/// Injects [constructor] into the inheritance chain for [object]'s class.
98104
void injectSuperclass(Object object, Function constructor) {
99105
var prototype = _getPrototypeOf(object);

lib/src/node/value/boolean.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ final Function booleanConstructor = () {
2121
"Use sass.types.Boolean.TRUE or sass.types.Boolean.FALSE instead.";
2222
});
2323
injectSuperclass(sassTrue, constructor);
24+
setClassName(sassTrue, "SassBoolean");
2425
forwardToString(constructor);
2526
setProperty(
2627
getProperty(constructor, "prototype"),

lib/src/node/value/null.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ final Function nullConstructor = () {
2121
"instead.";
2222
});
2323
injectSuperclass(sassNull, constructor);
24+
setClassName(sassNull, "SassNull");
2425
forwardToString(constructor);
2526
setProperty(constructor, "NULL", sassNull);
2627
setToString(sassNull, () => "null");

0 commit comments

Comments
 (0)