GeezerVison is showing github.com — Fix the string representations of the Sass AST (#1682) · sass/dart-sass@6eed6eb
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: CHANGELOG.md +4Lines changed: 4 additions & 0 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +## 1.50.2 | | 2 | + | | 3 | +* Improve the string output of some AST nodes in error messages. | | 4 | + | 1 | 5 | ## 1.50.1 | 2 | 6 |
| 3 | 7 | ### Embedded Sass | |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/argument_declaration.dart +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -161,7 +161,7 @@ class ArgumentDeclaration implements SassNode { | 161 | 161 | } | 162 | 162 |
| 163 | 163 | String toString() => [ | 164 | | - for (var arg in arguments) arg.toString(), | 165 | | - if (restArgument != null) '$restArgument...' | | 164 | + for (var arg in arguments) '\$$arg', | | 165 | + if (restArgument != null) '\$$restArgument...' | 166 | 166 | ].join(', '); | 167 | 167 | } |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/argument_invocation.dart +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -48,7 +48,7 @@ class ArgumentInvocation implements SassNode { | 48 | 48 | String toString() { | 49 | 49 | var components = [ | 50 | 50 | ...positional, | 51 | | - for (var name in named.keys) "$name: ${named[name]}", | | 51 | + for (var name in named.keys) "\$$name: ${named[name]}", | 52 | 52 | if (rest != null) "$rest...", | 53 | 53 | if (keywordRest != null) "$keywordRest..." | 54 | 54 | ]; | |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/expression/list.dart +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -53,8 +53,8 @@ class ListExpression implements Expression { | 53 | 53 | if (expression.contents.length < 2) return false; | 54 | 54 | if (expression.hasBrackets) return false; | 55 | 55 | return separator == ListSeparator.comma | 56 | | - ? separator == ListSeparator.comma | 57 | | - : separator != ListSeparator.undecided; | | 56 | + ? expression.separator == ListSeparator.comma | | 57 | + : expression.separator != ListSeparator.undecided; | 58 | 58 | } | 59 | 59 |
| 60 | 60 | if (separator != ListSeparator.space) return false; | |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/import/static.dart -2Lines changed: 0 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 | // https://opensource.org/licenses/MIT. | 4 | 4 |
| 5 | 5 | import 'package:meta/meta.dart'; | 6 | | -import 'package:charcode/charcode.dart'; | 7 | 6 | import 'package:source_span/source_span.dart'; | 8 | 7 |
| 9 | 8 | import '../import.dart'; | @@ -36,7 +35,6 @@ class StaticImport implements Import { | 36 | 35 | var buffer = StringBuffer(url); | 37 | 36 | if (supports != null) buffer.write(" supports($supports)"); | 38 | 37 | if (media != null) buffer.write(" $media"); | 39 | | - buffer.writeCharCode($semicolon); | 40 | 38 | return buffer.toString(); | 41 | 39 | } | 42 | 40 | } |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/statement/declaration.dart +17Lines changed: 17 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 2 | 2 | // MIT-style license that can be found in the LICENSE file or at | 3 | 3 | // https://opensource.org/licenses/MIT. | 4 | 4 |
| | 5 | +import 'package:charcode/charcode.dart'; | 5 | 6 | import 'package:meta/meta.dart'; | 6 | 7 | import 'package:source_span/source_span.dart'; | 7 | 8 |
| @@ -62,4 +63,20 @@ class Declaration extends ParentStatement { | 62 | 63 | } | 63 | 64 |
| 64 | 65 | T accept<T>(StatementVisitor<T> visitor) => visitor.visitDeclaration(this); | | 66 | + | | 67 | + String toString() { | | 68 | + var buffer = StringBuffer(); | | 69 | + buffer.write(name); | | 70 | + buffer.writeCharCode($colon); | | 71 | + | | 72 | + if (value != null) { | | 73 | + if (!isCustomProperty) { | | 74 | + buffer.writeCharCode($space); | | 75 | + } | | 76 | + buffer.write("$value"); | | 77 | + } | | 78 | + | | 79 | + var children = this.children; | | 80 | + return children == null ? "$buffer;" : "$buffer {${children.join(" ")}}"; | | 81 | + } | 65 | 82 | } |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/statement/extend_rule.dart +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -32,5 +32,5 @@ class ExtendRule implements Statement { | 32 | 32 |
| 33 | 33 | T accept<T>(StatementVisitor<T> visitor) => visitor.visitExtendRule(this); | 34 | 34 |
| 35 | | - String toString() => "@extend $selector"; | | 35 | + String toString() => "@extend $selector${isOptional ? ' !optional' : ''};"; | 36 | 36 | } |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/statement/if_rule.dart +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -44,7 +44,7 @@ class IfRule implements Statement { | 44 | 44 | String toString() { | 45 | 45 | var result = clauses | 46 | 46 | .mapIndexed((index, clause) => | 47 | | - "@${index == 0 ? 'if' : 'else if'} {${clause.children.join(' ')}}") | | 47 | + "@${index == 0 ? 'if' : 'else if'} ${clause.expression} {${clause.children.join(' ')}}") | 48 | 48 | .join(' '); | 49 | 49 |
| 50 | 50 | var lastClause = this.lastClause; | |
Collapse file Copy file name to clipboardExpand all lines: lib/src/ast/sass/statement/variable_declaration.dart +2-2Lines changed: 2 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -90,9 +90,9 @@ class VariableDeclaration implements Statement, SassDeclaration { | 90 | 90 | visitor.visitVariableDeclaration(this); | 91 | 91 |
| 92 | 92 | String toString() { | 93 | | - var buffer = StringBuffer("\$"); | | 93 | + var buffer = StringBuffer(); | 94 | 94 | if (namespace != null) buffer.write("$namespace."); | 95 | | - buffer.write("$name: $expression;"); | | 95 | + buffer.write("\$$name: $expression;"); | 96 | 96 | return buffer.toString(); | 97 | 97 | } | 98 | 98 | } |
Collapse file Copy file name to clipboardExpand all lines: pubspec.yaml +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | name: sass | 2 | | -version: 1.50.1 | | 2 | +version: 1.50.2-dev | 3 | 3 | description: A Sass implementation in Dart. | 4 | 4 | homepage: https://github.com/sass/dart-sass | 5 | 5 |
| |
|