Chromium Code Reviews| 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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 * Returns Xml-like tree representation of this node. | 140 * Returns Xml-like tree representation of this node. |
| 141 */ | 141 */ |
| 142 toDebugString() { | 142 toDebugString() { |
| 143 return PrettyPrinter.prettyPrint(this); | 143 return PrettyPrinter.prettyPrint(this); |
| 144 } | 144 } |
| 145 | 145 |
| 146 String getObjectDescription() => super.toString(); | 146 String getObjectDescription() => super.toString(); |
| 147 | 147 |
| 148 Token getBeginToken(); | 148 Token getBeginToken(); |
| 149 | 149 |
| 150 /// Returns the token that ends the 'prefix' of this node. | |
| 151 /// | |
| 152 /// For instance the end of the parameters in a [FunctionExpression] or the | |
| 153 /// start of a class body for a [ClassNode]. | |
|
ahe
2016/02/04 11:32:33
The last token *before* the start of a class body?
Johnni Winther
2016/02/05 09:14:20
Done.
| |
| 154 Token getPrefixEndToken() => getEndToken(); | |
| 155 | |
| 150 Token getEndToken(); | 156 Token getEndToken(); |
| 151 | 157 |
| 152 Assert asAssert() => null; | 158 Assert asAssert() => null; |
| 153 AsyncModifier asAsyncModifier() => null; | 159 AsyncModifier asAsyncModifier() => null; |
| 154 Await asAwait() => null; | 160 Await asAwait() => null; |
| 155 Block asBlock() => null; | 161 Block asBlock() => null; |
| 156 BreakStatement asBreakStatement() => null; | 162 BreakStatement asBreakStatement() => null; |
| 157 Cascade asCascade() => null; | 163 Cascade asCascade() => null; |
| 158 CascadeReceiver asCascadeReceiver() => null; | 164 CascadeReceiver asCascadeReceiver() => null; |
| 159 CaseMatch asCaseMatch() => null; | 165 CaseMatch asCaseMatch() => null; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 visitChildren(Visitor visitor) { | 262 visitChildren(Visitor visitor) { |
| 257 if (name != null) name.accept(visitor); | 263 if (name != null) name.accept(visitor); |
| 258 if (typeParameters != null) typeParameters.accept(visitor); | 264 if (typeParameters != null) typeParameters.accept(visitor); |
| 259 if (superclass != null) superclass.accept(visitor); | 265 if (superclass != null) superclass.accept(visitor); |
| 260 if (interfaces != null) interfaces.accept(visitor); | 266 if (interfaces != null) interfaces.accept(visitor); |
| 261 if (body != null) body.accept(visitor); | 267 if (body != null) body.accept(visitor); |
| 262 } | 268 } |
| 263 | 269 |
| 264 Token getBeginToken() => beginToken; | 270 Token getBeginToken() => beginToken; |
| 265 | 271 |
| 272 @override | |
| 273 Token getPrefixEndToken() { | |
| 274 return body != null ? body.getBeginToken() : getEndToken(); | |
|
ahe
2016/02/04 11:32:33
How about using the token before body.getBeginToke
Johnni Winther
2016/02/05 09:14:20
Done.
| |
| 275 } | |
| 276 | |
| 266 Token getEndToken() => endToken; | 277 Token getEndToken() => endToken; |
| 267 } | 278 } |
| 268 | 279 |
| 269 class MixinApplication extends Node { | 280 class MixinApplication extends Node { |
| 270 final TypeAnnotation superclass; | 281 final TypeAnnotation superclass; |
| 271 final NodeList mixins; | 282 final NodeList mixins; |
| 272 | 283 |
| 273 MixinApplication(this.superclass, this.mixins); | 284 MixinApplication(this.superclass, this.mixins); |
| 274 | 285 |
| 275 MixinApplication asMixinApplication() => this; | 286 MixinApplication asMixinApplication() => this; |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 731 | 742 |
| 732 FunctionDeclaration(this.function); | 743 FunctionDeclaration(this.function); |
| 733 | 744 |
| 734 FunctionDeclaration asFunctionDeclaration() => this; | 745 FunctionDeclaration asFunctionDeclaration() => this; |
| 735 | 746 |
| 736 accept(Visitor visitor) => visitor.visitFunctionDeclaration(this); | 747 accept(Visitor visitor) => visitor.visitFunctionDeclaration(this); |
| 737 | 748 |
| 738 visitChildren(Visitor visitor) => function.accept(visitor); | 749 visitChildren(Visitor visitor) => function.accept(visitor); |
| 739 | 750 |
| 740 Token getBeginToken() => function.getBeginToken(); | 751 Token getBeginToken() => function.getBeginToken(); |
| 752 | |
| 753 @override | |
| 754 Token getPrefixEndToken() => function.getPrefixEndToken(); | |
| 755 | |
| 741 Token getEndToken() => function.getEndToken(); | 756 Token getEndToken() => function.getEndToken(); |
| 742 } | 757 } |
| 743 | 758 |
| 744 /// Node representing the method implementation modifiers `sync*`, `async`, and | 759 /// Node representing the method implementation modifiers `sync*`, `async`, and |
| 745 /// `async*` or the invalid modifier `sync`. | 760 /// `async*` or the invalid modifier `sync`. |
| 746 class AsyncModifier extends Node { | 761 class AsyncModifier extends Node { |
| 747 /// The `async` or `sync` token. | 762 /// The `async` or `sync` token. |
| 748 final Token asyncToken; | 763 final Token asyncToken; |
| 749 | 764 |
| 750 /// The `*` token. | 765 /// The `*` token. |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 819 return block.statements.isEmpty; | 834 return block.statements.isEmpty; |
| 820 } | 835 } |
| 821 | 836 |
| 822 Token getBeginToken() { | 837 Token getBeginToken() { |
| 823 Token token = firstBeginToken(modifiers, returnType); | 838 Token token = firstBeginToken(modifiers, returnType); |
| 824 if (token != null) return token; | 839 if (token != null) return token; |
| 825 if (getOrSet != null) return getOrSet; | 840 if (getOrSet != null) return getOrSet; |
| 826 return firstBeginToken(name, parameters); | 841 return firstBeginToken(name, parameters); |
| 827 } | 842 } |
| 828 | 843 |
| 844 @override | |
| 845 Token getPrefixEndToken() { | |
| 846 return parameters != null ? parameters.getEndToken() : name.getEndToken(); | |
| 847 } | |
| 848 | |
| 829 Token getEndToken() { | 849 Token getEndToken() { |
| 830 Token token = (body == null) ? null : body.getEndToken(); | 850 Token token = (body == null) ? null : body.getEndToken(); |
| 831 token = (token == null) ? parameters.getEndToken() : token; | 851 token = (token == null) ? parameters.getEndToken() : token; |
| 832 return (token == null) ? name.getEndToken() : token; | 852 return (token == null) ? name.getEndToken() : token; |
| 833 } | 853 } |
| 834 } | 854 } |
| 835 | 855 |
| 836 typedef void DecodeErrorHandler(Token token, var error); | 856 typedef void DecodeErrorHandler(Token token, var error); |
| 837 | 857 |
| 838 abstract class Literal<T> extends Expression { | 858 abstract class Literal<T> extends Expression { |
| (...skipping 1605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2444 | 2464 |
| 2445 // VariableDefinitions. | 2465 // VariableDefinitions. |
| 2446 get metadata => null; | 2466 get metadata => null; |
| 2447 get type => null; | 2467 get type => null; |
| 2448 | 2468 |
| 2449 // Typedef. | 2469 // Typedef. |
| 2450 get typeParameters => null; | 2470 get typeParameters => null; |
| 2451 get formals => null; | 2471 get formals => null; |
| 2452 get typedefKeyword => null; | 2472 get typedefKeyword => null; |
| 2453 } | 2473 } |
| OLD | NEW |