-
Notifications
You must be signed in to change notification settings - Fork 366
Closed
Labels
JavaScriptIssues particular to the Node.js distributionIssues particular to the Node.js distributionbug
Description
The lazy span builder introduced in https://github.com/sass/dart-sass/pull/1916/files causes a bug that sometimes it's implementation is leaked when there is an exception when using the JS API.
Input
const { compileString } = require('sass');
const scss = `
@mixin dark {
.red & {
@content;
}
}
@include dark {
body {
color: red;
}
}
`;
try {
compileString(scss);
} catch (e) {
console.error(e.span);
}
Output
LazyFileSpan0 { '_lazy_file_span0$_builder':
Parser_spanFrom_closure0 { '$this':
SelectorParser0 { '_selector$_allowParent': true,
'_selector$_allowPlaceholder': true,
scanner:
SpanScanner { _sourceFile:
SourceFile { url: null,
_lineStarts: [ 0, [Symbol($ti)]: [Object] ],
_decodedChars: Uint32Array { [Iterator] 0: 46, 1: 114, 2: 101, 3: 100, 4: 32, 5: 38, 6: 32 },
_cachedLine: null },
sourceUrl: null,
string: '.red & ',
'_string_scanner$_position': 7,
_lastMatch: null,
_lastMatchPosition: null },
logger:
DeprecationHandlingLogger0 { '_deprecation_handling$_warningCounts':
....
Expected
Accessing .span
returns an object matching the SourceSpan
interface.
Version
npx sass --version
1.62.1 compiled with dart2js 2.19.6
RomanYazvinsky and jase88
Metadata
Metadata
Assignees
Labels
JavaScriptIssues particular to the Node.js distributionIssues particular to the Node.js distributionbug