| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 part of tree; | 5 part of tree; |
| 6 | 6 |
| 7 abstract class Visitor<R> { | 7 abstract class Visitor<R> { |
| 8 const Visitor(); | 8 const Visitor(); |
| 9 | 9 |
| 10 R visitNode(Node node); | 10 R visitNode(Node node); |
| (...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 NewExpression([this.newToken, this.send]); | 488 NewExpression([this.newToken, this.send]); |
| 489 | 489 |
| 490 NewExpression asNewExpression() => this; | 490 NewExpression asNewExpression() => this; |
| 491 | 491 |
| 492 accept(Visitor visitor) => visitor.visitNewExpression(this); | 492 accept(Visitor visitor) => visitor.visitNewExpression(this); |
| 493 | 493 |
| 494 visitChildren(Visitor visitor) { | 494 visitChildren(Visitor visitor) { |
| 495 if (send != null) send.accept(visitor); | 495 if (send != null) send.accept(visitor); |
| 496 } | 496 } |
| 497 | 497 |
| 498 bool isConst() { | 498 bool get isConst { |
| 499 return newToken == null || identical(newToken.stringValue, 'const'); | 499 return newToken == null || identical(newToken.stringValue, 'const'); |
| 500 } | 500 } |
| 501 | 501 |
| 502 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken(); | 502 Token getBeginToken() => newToken != null ? newToken : send.getBeginToken(); |
| 503 | 503 |
| 504 Token getEndToken() => send.getEndToken(); | 504 Token getEndToken() => send.getEndToken(); |
| 505 } | 505 } |
| 506 | 506 |
| 507 class NodeList extends Node { | 507 class NodeList extends Node { |
| 508 final Link<Node> nodes; | 508 final Link<Node> nodes; |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 } | 934 } |
| 935 | 935 |
| 936 class LiteralList extends Expression { | 936 class LiteralList extends Expression { |
| 937 final NodeList typeArguments; | 937 final NodeList typeArguments; |
| 938 final NodeList elements; | 938 final NodeList elements; |
| 939 | 939 |
| 940 final Token constKeyword; | 940 final Token constKeyword; |
| 941 | 941 |
| 942 LiteralList(this.typeArguments, this.elements, this.constKeyword); | 942 LiteralList(this.typeArguments, this.elements, this.constKeyword); |
| 943 | 943 |
| 944 bool isConst() => constKeyword != null; | 944 bool get isConst => constKeyword != null; |
| 945 | 945 |
| 946 LiteralList asLiteralList() => this; | 946 LiteralList asLiteralList() => this; |
| 947 accept(Visitor visitor) => visitor.visitLiteralList(this); | 947 accept(Visitor visitor) => visitor.visitLiteralList(this); |
| 948 | 948 |
| 949 visitChildren(Visitor visitor) { | 949 visitChildren(Visitor visitor) { |
| 950 if (typeArguments != null) typeArguments.accept(visitor); | 950 if (typeArguments != null) typeArguments.accept(visitor); |
| 951 elements.accept(visitor); | 951 elements.accept(visitor); |
| 952 } | 952 } |
| 953 | 953 |
| 954 Token getBeginToken() { | 954 Token getBeginToken() { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1307 } | 1307 } |
| 1308 return null; | 1308 return null; |
| 1309 } | 1309 } |
| 1310 | 1310 |
| 1311 Modifiers asModifiers() => this; | 1311 Modifiers asModifiers() => this; |
| 1312 Token getBeginToken() => nodes.getBeginToken(); | 1312 Token getBeginToken() => nodes.getBeginToken(); |
| 1313 Token getEndToken() => nodes.getEndToken(); | 1313 Token getEndToken() => nodes.getEndToken(); |
| 1314 accept(Visitor visitor) => visitor.visitModifiers(this); | 1314 accept(Visitor visitor) => visitor.visitModifiers(this); |
| 1315 visitChildren(Visitor visitor) => nodes.accept(visitor); | 1315 visitChildren(Visitor visitor) => nodes.accept(visitor); |
| 1316 | 1316 |
| 1317 bool isStatic() => (flags & FLAG_STATIC) != 0; | 1317 bool get isStatic => (flags & FLAG_STATIC) != 0; |
| 1318 bool isAbstract() => (flags & FLAG_ABSTRACT) != 0; | 1318 bool get isAbstract => (flags & FLAG_ABSTRACT) != 0; |
| 1319 bool isFinal() => (flags & FLAG_FINAL) != 0; | 1319 bool get isFinal => (flags & FLAG_FINAL) != 0; |
| 1320 bool isVar() => (flags & FLAG_VAR) != 0; | 1320 bool get isVar => (flags & FLAG_VAR) != 0; |
| 1321 bool isConst() => (flags & FLAG_CONST) != 0; | 1321 bool get isConst => (flags & FLAG_CONST) != 0; |
| 1322 bool isFactory() => (flags & FLAG_FACTORY) != 0; | 1322 bool get isFactory => (flags & FLAG_FACTORY) != 0; |
| 1323 bool isExternal() => (flags & FLAG_EXTERNAL) != 0; | 1323 bool get isExternal => (flags & FLAG_EXTERNAL) != 0; |
| 1324 | 1324 |
| 1325 Node getStatic() => findModifier('static'); | 1325 Node getStatic() => findModifier('static'); |
| 1326 | 1326 |
| 1327 /** | 1327 /** |
| 1328 * Use this to check if the declaration is either explicitly or implicitly | 1328 * Use this to check if the declaration is either explicitly or implicitly |
| 1329 * final. | 1329 * final. |
| 1330 */ | 1330 */ |
| 1331 bool isFinalOrConst() => isFinal() || isConst(); | 1331 bool get isFinalOrConst => isFinal || isConst; |
| 1332 | 1332 |
| 1333 String toString() { | 1333 String toString() { |
| 1334 LinkBuilder<String> builder = new LinkBuilder<String>(); | 1334 LinkBuilder<String> builder = new LinkBuilder<String>(); |
| 1335 if (isStatic()) builder.addLast('static'); | 1335 if (isStatic) builder.addLast('static'); |
| 1336 if (isAbstract()) builder.addLast('abstract'); | 1336 if (isAbstract) builder.addLast('abstract'); |
| 1337 if (isFinal()) builder.addLast('final'); | 1337 if (isFinal) builder.addLast('final'); |
| 1338 if (isVar()) builder.addLast('var'); | 1338 if (isVar) builder.addLast('var'); |
| 1339 if (isConst()) builder.addLast('const'); | 1339 if (isConst) builder.addLast('const'); |
| 1340 if (isFactory()) builder.addLast('factory'); | 1340 if (isFactory) builder.addLast('factory'); |
| 1341 if (isExternal()) builder.addLast('external'); | 1341 if (isExternal) builder.addLast('external'); |
| 1342 StringBuffer buffer = new StringBuffer(); | 1342 StringBuffer buffer = new StringBuffer(); |
| 1343 builder.toLink().printOn(buffer, ', '); | 1343 builder.toLink().printOn(buffer, ', '); |
| 1344 return buffer.toString(); | 1344 return buffer.toString(); |
| 1345 } | 1345 } |
| 1346 } | 1346 } |
| 1347 | 1347 |
| 1348 class StringInterpolation extends StringNode { | 1348 class StringInterpolation extends StringNode { |
| 1349 final LiteralString string; | 1349 final LiteralString string; |
| 1350 final NodeList parts; | 1350 final NodeList parts; |
| 1351 | 1351 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1470 } | 1470 } |
| 1471 | 1471 |
| 1472 class LiteralMap extends Expression { | 1472 class LiteralMap extends Expression { |
| 1473 final NodeList typeArguments; | 1473 final NodeList typeArguments; |
| 1474 final NodeList entries; | 1474 final NodeList entries; |
| 1475 | 1475 |
| 1476 final Token constKeyword; | 1476 final Token constKeyword; |
| 1477 | 1477 |
| 1478 LiteralMap(this.typeArguments, this.entries, this.constKeyword); | 1478 LiteralMap(this.typeArguments, this.entries, this.constKeyword); |
| 1479 | 1479 |
| 1480 bool isConst() => constKeyword != null; | 1480 bool get isConst => constKeyword != null; |
| 1481 | 1481 |
| 1482 LiteralMap asLiteralMap() => this; | 1482 LiteralMap asLiteralMap() => this; |
| 1483 | 1483 |
| 1484 accept(Visitor visitor) => visitor.visitLiteralMap(this); | 1484 accept(Visitor visitor) => visitor.visitLiteralMap(this); |
| 1485 | 1485 |
| 1486 visitChildren(Visitor visitor) { | 1486 visitChildren(Visitor visitor) { |
| 1487 if (typeArguments != null) typeArguments.accept(visitor); | 1487 if (typeArguments != null) typeArguments.accept(visitor); |
| 1488 entries.accept(visitor); | 1488 entries.accept(visitor); |
| 1489 } | 1489 } |
| 1490 | 1490 |
| (...skipping 614 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2105 } | 2105 } |
| 2106 | 2106 |
| 2107 class IsInterpolationVisitor extends Visitor<bool> { | 2107 class IsInterpolationVisitor extends Visitor<bool> { |
| 2108 const IsInterpolationVisitor(); | 2108 const IsInterpolationVisitor(); |
| 2109 bool visitNode(Node node) => false; | 2109 bool visitNode(Node node) => false; |
| 2110 bool visitStringInterpolation(StringInterpolation node) => true; | 2110 bool visitStringInterpolation(StringInterpolation node) => true; |
| 2111 bool visitStringJuxtaposition(StringJuxtaposition node) | 2111 bool visitStringJuxtaposition(StringJuxtaposition node) |
| 2112 => node.isInterpolation; | 2112 => node.isInterpolation; |
| 2113 } | 2113 } |
| 2114 | 2114 |
| OLD | NEW |