-
Notifications
You must be signed in to change notification settings - Fork 370
Closed
Labels
Description
See the following code as an illustration of the issue. On sass this "worked correctly", because callables from other function registries with in the same dart/js VM memory space can be directly accessed and called as functions/mixins are never serialized. However, on sass-embedded this is broken, as only the function id is being passed, which is not a real serialization of the function/mixin content, thus it will refer to a function in the current register even if we passed the function from a different registry.
const sass = require('sass-embedded');
// or
// const sass = require('sass');
const outer = `
@use 'sass:meta';
@function foo($n) {@return $n + 1}
a {b: meta.call(bar(meta.get-function('foo')), 0); }
`
const inner = `
@use 'sass:meta';
@function foo($n) {@return $n + 2}
a {b: meta.call(bar(meta.get-function('foo')), 0); }
`
sass.compileString(outer, {
functions: {
'bar($arg)': (args) => {
const outerFn = args[0]
console.log(sass.compileString(inner, {
functions: {
'bar($arg)': (args) => {
const innerFn = args[0]
console.log(outerFn.equals(innerFn))
return outerFn
}
},
}).css)
return outerFn
}
}
})