| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library js; | 5 library js; |
| 6 | 6 |
| 7 import 'package:js_ast/js_ast.dart'; | 7 import 'package:js_ast/js_ast.dart'; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../compiler.dart' show Compiler; | 10 import '../compiler.dart' show Compiler; |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 markSeen(TokenCounter visitor); | 122 markSeen(TokenCounter visitor); |
| 123 } | 123 } |
| 124 | 124 |
| 125 /// Represents the LiteralString resulting from unparsing [expression]. The | 125 /// Represents the LiteralString resulting from unparsing [expression]. The |
| 126 /// actual unparsing is done on demand when requesting the [value] of this | 126 /// actual unparsing is done on demand when requesting the [value] of this |
| 127 /// node. | 127 /// node. |
| 128 /// | 128 /// |
| 129 /// This is used when generated code needs to be represented as a string, | 129 /// This is used when generated code needs to be represented as a string, |
| 130 /// for example by the lazy emitter or when generating code generators. | 130 /// for example by the lazy emitter or when generating code generators. |
| 131 class UnparsedNode extends DeferredString implements AstContainer { | 131 class UnparsedNode extends DeferredString implements AstContainer { |
| 132 @override | |
| 133 final Node tree; | 132 final Node tree; |
| 134 final Compiler _compiler; | 133 final Compiler _compiler; |
| 135 final bool _protectForEval; | 134 final bool _protectForEval; |
| 136 LiteralString _cachedLiteral; | 135 LiteralString _cachedLiteral; |
| 137 | 136 |
| 138 Iterable<Node> get containedNodes => [tree]; | 137 Iterable<Node> get containedNodes => [tree]; |
| 139 | 138 |
| 140 /// A [js.Literal] that represents the string result of unparsing [ast]. | 139 /// A [js.Literal] that represents the string result of unparsing [ast]. |
| 141 /// | 140 /// |
| 142 /// When its string [value] is requested, the node pretty-prints the given | 141 /// When its string [value] is requested, the node pretty-prints the given |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 } | 186 } |
| 188 if (node is PropertyAccess) { | 187 if (node is PropertyAccess) { |
| 189 PropertyAccess access = node; | 188 PropertyAccess access = node; |
| 190 if (access.receiver is InterpolatedExpression) { | 189 if (access.receiver is InterpolatedExpression) { |
| 191 InterpolatedExpression hole = access.receiver; | 190 InterpolatedExpression hole = access.receiver; |
| 192 return hole.isPositional && hole.nameOrPosition == 0; | 191 return hole.isPositional && hole.nameOrPosition == 0; |
| 193 } | 192 } |
| 194 } | 193 } |
| 195 return false; | 194 return false; |
| 196 } | 195 } |
| OLD | NEW |