mirror of
https://github.com/danog/dart-sass.git
synced 2024-11-26 20:24:42 +01:00
Enable @extend.
Still tons of runtime errors.
This commit is contained in:
parent
69a431c7bf
commit
69221190e7
@ -89,7 +89,7 @@ class Extender {
|
||||
return new SelectorList(newList.where((complex) => complex != null));
|
||||
}
|
||||
|
||||
List<ComplexSelector> _extendComplex(ComplexSelector complex,
|
||||
Iterable<ComplexSelector> _extendComplex(ComplexSelector complex,
|
||||
Map<SimpleSelector, Set<SelectorList>> extensions) {
|
||||
// This could be written more simply using [List.map], but we want to avoid
|
||||
// any allocations in the common case where no extends apply.
|
||||
@ -104,8 +104,10 @@ class Extender {
|
||||
if (changed) extendedNotExpanded.add([[component]]);
|
||||
} else {
|
||||
if (!changed) {
|
||||
extendedNotExpanded =
|
||||
complex.components.take(i).map((component) => [[component]]);
|
||||
extendedNotExpanded = complex.components
|
||||
.take(i)
|
||||
.map((component) => [[component]])
|
||||
.toList();
|
||||
}
|
||||
changed = true;
|
||||
extendedNotExpanded.add(extended);
|
||||
|
@ -69,6 +69,12 @@ class Parser {
|
||||
return selector;
|
||||
}
|
||||
|
||||
SimpleSelector parseSimpleSelector() {
|
||||
var simple = _simpleSelector();
|
||||
_scanner.expectDone();
|
||||
return simple;
|
||||
}
|
||||
|
||||
VariableDeclaration _variableDeclaration() {
|
||||
if (!_scanner.scanChar($dollar)) return null;
|
||||
|
||||
|
@ -66,6 +66,14 @@ class PerformVisitor extends StatementVisitor {
|
||||
_parent.addChild(new CssDeclaration(name, cssValue, span: node.span));
|
||||
}
|
||||
|
||||
void visitExtendRule(ExtendRule node) {
|
||||
var targetText = _performInterpolation(node.selector);
|
||||
|
||||
// TODO: recontextualize parse errors.
|
||||
var simple = new Parser(targetText.value).parseSimpleSelector();
|
||||
_extender.addExtension(_selector.value, simple);
|
||||
}
|
||||
|
||||
void visitAtRule(AtRule node) {
|
||||
var value = node.value == null
|
||||
? null
|
||||
|
Loading…
Reference in New Issue
Block a user