Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(250)

Unified Diff: pkg/csslib/lib/src/tree.dart

Issue 23819036: Support for @mixin, @include and @extend (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: mixin w/o parameters Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/csslib/lib/src/tree.dart
diff --git a/pkg/csslib/lib/src/tree.dart b/pkg/csslib/lib/src/tree.dart
index e8411d31f8fabb185ab4bc46be89a65d032e4d27..370281e3b87f806b1336aa3955f7f7344ff86cb5 100644
--- a/pkg/csslib/lib/src/tree.dart
+++ b/pkg/csslib/lib/src/tree.dart
@@ -266,6 +266,12 @@ class NegationSelector extends SimpleSelector {
visit(VisitorBase visitor) => visitor.visitNegationSelector(this);
}
+class NoOp extends TreeNode {
+ NoOp() : super(null);
+
+ visit(VisitorBase visitor) => visitor.visitNoOp(this);
+}
+
class StyleSheet extends TreeNode {
/**
* Contains charset, ruleset, directives (media, page, etc.), and selectors.
@@ -494,6 +500,53 @@ class VarDefinitionDirective extends Directive {
visit(VisitorBase visitor) => visitor.visitVarDefinitionDirective(this);
}
+class MixinDefinition extends Directive {
+ final String name;
+ final List definedArgs;
+ final bool varArgs;
nweiz 2013/09/18 22:40:54 As with @content, don't include infrastructure for
terry 2013/10/09 03:40:33 args supported. On 2013/09/18 22:40:54, nweiz wrot
+
+ MixinDefinition(this.name, this.definedArgs, this.varArgs, Span span)
+ : super(span);
+
+ visit(VisitorBase visitor) => visitor.visitMixinDefinition(this);
+}
+
+/** To support defining a SASS @mixin. */
nweiz 2013/09/18 22:40:54 Only the first letter of "Sass" is capitalized. T
terry 2013/10/09 03:40:33 Ok, referenced web site no need to explain the Sas
+class MixinRulesetDirective extends MixinDefinition {
+ final List<RuleSet> rulesets;
+
+ MixinRulesetDirective(String name, List args, bool varArgs, this.rulesets,
+ Span span) : super(name, args, varArgs, span);
+
+ visit(VisitorBase visitor) => visitor.visitMixinRulesetDirective(this);
+}
+
+class MixinDeclarationDirective extends MixinDefinition {
+ final DeclarationGroup declarations;
+
+ MixinDeclarationDirective(String name, List args, bool varArgs,
+ this.declarations, Span span) : super(name, args, varArgs, span);
+
+ visit(VisitorBase visitor) => visitor.visitMixinDeclarationDirective(this);
+}
+
+/** To support consuming a SASS mixin @include. */
+class IncludeDirective extends Directive {
+ final String name;
+ final List args;
+
+ IncludeDirective(this.name, this.args, Span span) : super(span);
+
+ visit(VisitorBase visitor) => visitor.visitIncludeDirective(this);
+}
+
+/** To support SASS @content. */
+class ContentDirective extends Directive {
+ ContentDirective(Span span) : super(span);
+
+ visit(VisitorBase visitor) => visitor.visitContentDirective(this);
+}
+
class Declaration extends TreeNode {
final Identifier _property;
final Expression _expression;
@@ -544,6 +597,22 @@ class VarDefinition extends Declaration {
visit(VisitorBase visitor) => visitor.visitVarDefinition(this);
}
+/**
+ * Node for usage of @include mixin[(args,...)] found in a declaration group
+ * instead of at a ruleset (toplevel) e.g.,
+ * div {
+ * @include mixin1;
+ * }
+ */
+class IncludeMixinAtDeclaration extends Declaration {
+ final IncludeDirective include;
+
+ IncludeMixinAtDeclaration(this.include, Span span)
+ : super(null, null, null, span);
+
+ visit(VisitorBase visitor) => visitor.visitIncludeMixinAtDeclaration(this);
+}
+
class DeclarationGroup extends TreeNode {
/** Can be either Declaration or RuleSet (if nested selector). */
final List _declarations;

Powered by Google App Engine
This is Rietveld 408576698