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 import 'dart:collection' show IterableMixin; | 5 import 'dart:collection' show IterableMixin; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../elements/elements.dart' show MetadataAnnotation; | 8 import '../elements/elements.dart' show MetadataAnnotation; |
| 9 import '../resolution/secret_tree_element.dart' | 9 import '../resolution/secret_tree_element.dart' |
| 10 show NullTreeElementMixin, StoredTreeElementMixin; | 10 show NullTreeElementMixin, StoredTreeElementMixin; |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 41 R visitDoWhile(DoWhile node) => visitLoop(node); | 41 R visitDoWhile(DoWhile node) => visitLoop(node); |
| 42 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); | 42 R visitEmptyStatement(EmptyStatement node) => visitStatement(node); |
| 43 R visitEnum(Enum node) => visitNode(node); | 43 R visitEnum(Enum node) => visitNode(node); |
| 44 R visitExport(Export node) => visitLibraryDependency(node); | 44 R visitExport(Export node) => visitLibraryDependency(node); |
| 45 R visitExpression(Expression node) => visitNode(node); | 45 R visitExpression(Expression node) => visitNode(node); |
| 46 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); | 46 R visitExpressionStatement(ExpressionStatement node) => visitStatement(node); |
| 47 R visitFor(For node) => visitLoop(node); | 47 R visitFor(For node) => visitLoop(node); |
| 48 R visitForIn(ForIn node) => visitLoop(node); | 48 R visitForIn(ForIn node) => visitLoop(node); |
| 49 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); | 49 R visitFunctionDeclaration(FunctionDeclaration node) => visitStatement(node); |
| 50 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); | 50 R visitFunctionExpression(FunctionExpression node) => visitExpression(node); |
| 51 R visitFunctionTypeAnnotation(FunctionTypeAnnotation node) { | |
| 52 return visitTypeAnnotation(node); | |
| 53 } | |
| 54 | |
| 51 R visitGotoStatement(GotoStatement node) => visitStatement(node); | 55 R visitGotoStatement(GotoStatement node) => visitStatement(node); |
| 52 R visitIdentifier(Identifier node) => visitExpression(node); | 56 R visitIdentifier(Identifier node) => visitExpression(node); |
| 53 R visitImport(Import node) => visitLibraryDependency(node); | 57 R visitImport(Import node) => visitLibraryDependency(node); |
| 54 R visitIf(If node) => visitStatement(node); | 58 R visitIf(If node) => visitStatement(node); |
| 55 R visitLabel(Label node) => visitNode(node); | 59 R visitLabel(Label node) => visitNode(node); |
| 56 R visitLabeledStatement(LabeledStatement node) => visitStatement(node); | 60 R visitLabeledStatement(LabeledStatement node) => visitStatement(node); |
| 57 R visitLibraryDependency(LibraryDependency node) => visitLibraryTag(node); | 61 R visitLibraryDependency(LibraryDependency node) => visitLibraryTag(node); |
| 58 R visitLibraryName(LibraryName node) => visitLibraryTag(node); | 62 R visitLibraryName(LibraryName node) => visitLibraryTag(node); |
| 59 R visitLibraryTag(LibraryTag node) => visitNode(node); | 63 R visitLibraryTag(LibraryTag node) => visitNode(node); |
| 60 R visitLiteral(Literal node) => visitExpression(node); | 64 R visitLiteral(Literal node) => visitExpression(node); |
| (...skipping 11 matching lines...) Expand all Loading... | |
| 72 R visitMetadata(Metadata node) => visitNode(node); | 76 R visitMetadata(Metadata node) => visitNode(node); |
| 73 R visitMixinApplication(MixinApplication node) => visitNode(node); | 77 R visitMixinApplication(MixinApplication node) => visitNode(node); |
| 74 R visitModifiers(Modifiers node) => visitNode(node); | 78 R visitModifiers(Modifiers node) => visitNode(node); |
| 75 R visitNamedArgument(NamedArgument node) => visitExpression(node); | 79 R visitNamedArgument(NamedArgument node) => visitExpression(node); |
| 76 R visitNamedMixinApplication(NamedMixinApplication node) { | 80 R visitNamedMixinApplication(NamedMixinApplication node) { |
| 77 return visitMixinApplication(node); | 81 return visitMixinApplication(node); |
| 78 } | 82 } |
| 79 | 83 |
| 80 R visitNewExpression(NewExpression node) => visitExpression(node); | 84 R visitNewExpression(NewExpression node) => visitExpression(node); |
| 81 R visitNodeList(NodeList node) => visitNode(node); | 85 R visitNodeList(NodeList node) => visitNode(node); |
| 86 R visitNominalTypeAnnotation(NominalTypeAnnotation node) { | |
| 87 return visitTypeAnnotation(node); | |
| 88 } | |
| 89 | |
| 82 R visitOperator(Operator node) => visitIdentifier(node); | 90 R visitOperator(Operator node) => visitIdentifier(node); |
| 83 R visitParenthesizedExpression(ParenthesizedExpression node) { | 91 R visitParenthesizedExpression(ParenthesizedExpression node) { |
| 84 return visitExpression(node); | 92 return visitExpression(node); |
| 85 } | 93 } |
| 86 | 94 |
| 87 R visitPart(Part node) => visitLibraryTag(node); | 95 R visitPart(Part node) => visitLibraryTag(node); |
| 88 R visitPartOf(PartOf node) => visitNode(node); | 96 R visitPartOf(PartOf node) => visitNode(node); |
| 89 R visitPostfix(Postfix node) => visitNodeList(node); | 97 R visitPostfix(Postfix node) => visitNodeList(node); |
| 90 R visitPrefix(Prefix node) => visitNodeList(node); | 98 R visitPrefix(Prefix node) => visitNodeList(node); |
| 91 R visitRedirectingFactoryBody(RedirectingFactoryBody node) { | 99 R visitRedirectingFactoryBody(RedirectingFactoryBody node) { |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 R visitFor(For node, A arg) => visitLoop(node, arg); | 177 R visitFor(For node, A arg) => visitLoop(node, arg); |
| 170 R visitForIn(ForIn node, A arg) => visitLoop(node, arg); | 178 R visitForIn(ForIn node, A arg) => visitLoop(node, arg); |
| 171 R visitFunctionDeclaration(FunctionDeclaration node, A arg) { | 179 R visitFunctionDeclaration(FunctionDeclaration node, A arg) { |
| 172 return visitStatement(node, arg); | 180 return visitStatement(node, arg); |
| 173 } | 181 } |
| 174 | 182 |
| 175 R visitFunctionExpression(FunctionExpression node, A arg) { | 183 R visitFunctionExpression(FunctionExpression node, A arg) { |
| 176 return visitExpression(node, arg); | 184 return visitExpression(node, arg); |
| 177 } | 185 } |
| 178 | 186 |
| 187 R visitFunctionTypeAnnotation(FunctionTypeAnnotation node, A arg) { | |
| 188 return visitTypeAnnotation(node, arg); | |
| 189 } | |
| 190 | |
| 179 R visitGotoStatement(GotoStatement node, A arg) { | 191 R visitGotoStatement(GotoStatement node, A arg) { |
| 180 return visitStatement(node, arg); | 192 return visitStatement(node, arg); |
| 181 } | 193 } |
| 182 | 194 |
| 183 R visitIdentifier(Identifier node, A arg) { | 195 R visitIdentifier(Identifier node, A arg) { |
| 184 return visitExpression(node, arg); | 196 return visitExpression(node, arg); |
| 185 } | 197 } |
| 186 | 198 |
| 187 R visitImport(Import node, A arg) { | 199 R visitImport(Import node, A arg) { |
| 188 return visitLibraryDependency(node, arg); | 200 return visitLibraryDependency(node, arg); |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 218 R visitMetadata(Metadata node, A arg) => visitNode(node, arg); | 230 R visitMetadata(Metadata node, A arg) => visitNode(node, arg); |
| 219 R visitMixinApplication(MixinApplication node, A arg) => visitNode(node, arg); | 231 R visitMixinApplication(MixinApplication node, A arg) => visitNode(node, arg); |
| 220 R visitModifiers(Modifiers node, A arg) => visitNode(node, arg); | 232 R visitModifiers(Modifiers node, A arg) => visitNode(node, arg); |
| 221 R visitNamedArgument(NamedArgument node, A arg) => visitExpression(node, arg); | 233 R visitNamedArgument(NamedArgument node, A arg) => visitExpression(node, arg); |
| 222 R visitNamedMixinApplication(NamedMixinApplication node, A arg) { | 234 R visitNamedMixinApplication(NamedMixinApplication node, A arg) { |
| 223 return visitMixinApplication(node, arg); | 235 return visitMixinApplication(node, arg); |
| 224 } | 236 } |
| 225 | 237 |
| 226 R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg); | 238 R visitNewExpression(NewExpression node, A arg) => visitExpression(node, arg); |
| 227 R visitNodeList(NodeList node, A arg) => visitNode(node, arg); | 239 R visitNodeList(NodeList node, A arg) => visitNode(node, arg); |
| 240 R visitNominalTypeAnnotation(NominalTypeAnnotation node, A arg) { | |
| 241 visitTypeAnnotation(node, arg); | |
| 242 } | |
| 243 | |
| 228 R visitOperator(Operator node, A arg) => visitIdentifier(node, arg); | 244 R visitOperator(Operator node, A arg) => visitIdentifier(node, arg); |
| 229 R visitParenthesizedExpression(ParenthesizedExpression node, A arg) { | 245 R visitParenthesizedExpression(ParenthesizedExpression node, A arg) { |
| 230 return visitExpression(node, arg); | 246 return visitExpression(node, arg); |
| 231 } | 247 } |
| 232 | 248 |
| 233 R visitPart(Part node, A arg) => visitLibraryTag(node, arg); | 249 R visitPart(Part node, A arg) => visitLibraryTag(node, arg); |
| 234 R visitPartOf(PartOf node, A arg) => visitNode(node, arg); | 250 R visitPartOf(PartOf node, A arg) => visitNode(node, arg); |
| 235 R visitPostfix(Postfix node, A arg) => visitNodeList(node, arg); | 251 R visitPostfix(Postfix node, A arg) => visitNodeList(node, arg); |
| 236 R visitPrefix(Prefix node, A arg) => visitNodeList(node, arg); | 252 R visitPrefix(Prefix node, A arg) => visitNodeList(node, arg); |
| 237 R visitRedirectingFactoryBody(RedirectingFactoryBody node, A arg) { | 253 R visitRedirectingFactoryBody(RedirectingFactoryBody node, A arg) { |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 253 } | 269 } |
| 254 | 270 |
| 255 R visitSwitchCase(SwitchCase node, A arg) => visitNode(node, arg); | 271 R visitSwitchCase(SwitchCase node, A arg) => visitNode(node, arg); |
| 256 R visitSwitchStatement(SwitchStatement node, A arg) { | 272 R visitSwitchStatement(SwitchStatement node, A arg) { |
| 257 return visitStatement(node, arg); | 273 return visitStatement(node, arg); |
| 258 } | 274 } |
| 259 | 275 |
| 260 R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg); | 276 R visitLiteralSymbol(LiteralSymbol node, A arg) => visitExpression(node, arg); |
| 261 R visitThrow(Throw node, A arg) => visitExpression(node, arg); | 277 R visitThrow(Throw node, A arg) => visitExpression(node, arg); |
| 262 R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg); | 278 R visitTryStatement(TryStatement node, A arg) => visitStatement(node, arg); |
| 263 R visitTypeAnnotation(TypeAnnotation node, A arg) => visitNode(node, arg); | |
| 264 R visitTypedef(Typedef node, A arg) => visitNode(node, arg); | 279 R visitTypedef(Typedef node, A arg) => visitNode(node, arg); |
| 280 R visitTypeAnnotation(TypeAnnotation node, A arg) => visistNode(node, arg); | |
| 265 R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg); | 281 R visitTypeVariable(TypeVariable node, A arg) => visitNode(node, arg); |
| 266 R visitVariableDefinitions(VariableDefinitions node, A arg) { | 282 R visitVariableDefinitions(VariableDefinitions node, A arg) { |
| 267 return visitStatement(node, arg); | 283 return visitStatement(node, arg); |
| 268 } | 284 } |
| 269 | 285 |
| 270 R visitWhile(While node, A arg) => visitLoop(node, arg); | 286 R visitWhile(While node, A arg) => visitLoop(node, arg); |
| 271 R visitYield(Yield node, A arg) => visitStatement(node, arg); | 287 R visitYield(Yield node, A arg) => visitStatement(node, arg); |
| 272 } | 288 } |
| 273 | 289 |
| 274 Token firstBeginToken(Node first, Node second) { | 290 Token firstBeginToken(Node first, Node second) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 353 ErrorExpression asErrorExpression() => null; | 369 ErrorExpression asErrorExpression() => null; |
| 354 Export asExport() => null; | 370 Export asExport() => null; |
| 355 Expression asExpression() => null; | 371 Expression asExpression() => null; |
| 356 ExpressionStatement asExpressionStatement() => null; | 372 ExpressionStatement asExpressionStatement() => null; |
| 357 For asFor() => null; | 373 For asFor() => null; |
| 358 SyncForIn asSyncForIn() => null; | 374 SyncForIn asSyncForIn() => null; |
| 359 AsyncForIn asAsyncForIn() => null; | 375 AsyncForIn asAsyncForIn() => null; |
| 360 ForIn asForIn() => null; | 376 ForIn asForIn() => null; |
| 361 FunctionDeclaration asFunctionDeclaration() => null; | 377 FunctionDeclaration asFunctionDeclaration() => null; |
| 362 FunctionExpression asFunctionExpression() => null; | 378 FunctionExpression asFunctionExpression() => null; |
| 379 FunctionTypeAnnotation asFunctionTypeAnnotation() => null; | |
| 363 Identifier asIdentifier() => null; | 380 Identifier asIdentifier() => null; |
| 364 If asIf() => null; | 381 If asIf() => null; |
| 365 Import asImport() => null; | 382 Import asImport() => null; |
| 366 Label asLabel() => null; | 383 Label asLabel() => null; |
| 367 LabeledStatement asLabeledStatement() => null; | 384 LabeledStatement asLabeledStatement() => null; |
| 368 LibraryName asLibraryName() => null; | 385 LibraryName asLibraryName() => null; |
| 369 LibraryDependency asLibraryDependency() => null; | 386 LibraryDependency asLibraryDependency() => null; |
| 370 LiteralBool asLiteralBool() => null; | 387 LiteralBool asLiteralBool() => null; |
| 371 LiteralDouble asLiteralDouble() => null; | 388 LiteralDouble asLiteralDouble() => null; |
| 372 LiteralInt asLiteralInt() => null; | 389 LiteralInt asLiteralInt() => null; |
| 373 LiteralList asLiteralList() => null; | 390 LiteralList asLiteralList() => null; |
| 374 LiteralMap asLiteralMap() => null; | 391 LiteralMap asLiteralMap() => null; |
| 375 LiteralMapEntry asLiteralMapEntry() => null; | 392 LiteralMapEntry asLiteralMapEntry() => null; |
| 376 LiteralNull asLiteralNull() => null; | 393 LiteralNull asLiteralNull() => null; |
| 377 LiteralString asLiteralString() => null; | 394 LiteralString asLiteralString() => null; |
| 378 LiteralSymbol asLiteralSymbol() => null; | 395 LiteralSymbol asLiteralSymbol() => null; |
| 379 Metadata asMetadata() => null; | 396 Metadata asMetadata() => null; |
| 380 MixinApplication asMixinApplication() => null; | 397 MixinApplication asMixinApplication() => null; |
| 381 Modifiers asModifiers() => null; | 398 Modifiers asModifiers() => null; |
| 382 NamedArgument asNamedArgument() => null; | 399 NamedArgument asNamedArgument() => null; |
| 383 NamedMixinApplication asNamedMixinApplication() => null; | 400 NamedMixinApplication asNamedMixinApplication() => null; |
| 384 NewExpression asNewExpression() => null; | 401 NewExpression asNewExpression() => null; |
| 385 NodeList asNodeList() => null; | 402 NodeList asNodeList() => null; |
| 403 NominalTypeAnnotation asNominalTypeAnnotation() => null; | |
| 386 Operator asOperator() => null; | 404 Operator asOperator() => null; |
| 387 ParenthesizedExpression asParenthesizedExpression() => null; | 405 ParenthesizedExpression asParenthesizedExpression() => null; |
| 388 Part asPart() => null; | 406 Part asPart() => null; |
| 389 PartOf asPartOf() => null; | 407 PartOf asPartOf() => null; |
| 390 RedirectingFactoryBody asRedirectingFactoryBody() => null; | 408 RedirectingFactoryBody asRedirectingFactoryBody() => null; |
| 391 Rethrow asRethrow() => null; | 409 Rethrow asRethrow() => null; |
| 392 Return asReturn() => null; | 410 Return asReturn() => null; |
| 393 Send asSend() => null; | 411 Send asSend() => null; |
| 394 SendSet asSendSet() => null; | 412 SendSet asSendSet() => null; |
| 395 Statement asStatement() => null; | 413 Statement asStatement() => null; |
| 396 StringInterpolation asStringInterpolation() => null; | 414 StringInterpolation asStringInterpolation() => null; |
| 397 StringInterpolationPart asStringInterpolationPart() => null; | 415 StringInterpolationPart asStringInterpolationPart() => null; |
| 398 StringJuxtaposition asStringJuxtaposition() => null; | 416 StringJuxtaposition asStringJuxtaposition() => null; |
| 399 StringNode asStringNode() => null; | 417 StringNode asStringNode() => null; |
| 400 SwitchCase asSwitchCase() => null; | 418 SwitchCase asSwitchCase() => null; |
| 401 SwitchStatement asSwitchStatement() => null; | 419 SwitchStatement asSwitchStatement() => null; |
| 402 Throw asThrow() => null; | 420 Throw asThrow() => null; |
| 403 TryStatement asTryStatement() => null; | 421 TryStatement asTryStatement() => null; |
| 404 TypeAnnotation asTypeAnnotation() => null; | |
| 405 TypeVariable asTypeVariable() => null; | 422 TypeVariable asTypeVariable() => null; |
| 406 Typedef asTypedef() => null; | 423 Typedef asTypedef() => null; |
| 407 VariableDefinitions asVariableDefinitions() => null; | 424 VariableDefinitions asVariableDefinitions() => null; |
| 408 While asWhile() => null; | 425 While asWhile() => null; |
| 409 Yield asYield() => null; | 426 Yield asYield() => null; |
| 410 | 427 |
| 411 bool isValidBreakTarget() => false; | 428 bool isValidBreakTarget() => false; |
| 412 bool isValidContinueTarget() => false; | 429 bool isValidContinueTarget() => false; |
| 413 bool isThis() => false; | 430 bool isThis() => false; |
| 414 bool isSuper() => false; | 431 bool isSuper() => false; |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 479 token = name.getEndToken(); | 496 token = name.getEndToken(); |
| 480 } | 497 } |
| 481 assert(invariant(beginToken, token != null)); | 498 assert(invariant(beginToken, token != null)); |
| 482 return token; | 499 return token; |
| 483 } | 500 } |
| 484 | 501 |
| 485 Token getEndToken() => endToken; | 502 Token getEndToken() => endToken; |
| 486 } | 503 } |
| 487 | 504 |
| 488 class MixinApplication extends Node { | 505 class MixinApplication extends Node { |
| 489 final TypeAnnotation superclass; | 506 final NominalTypeAnnotation superclass; |
| 490 final NodeList mixins; | 507 final NodeList mixins; |
| 491 | 508 |
| 492 MixinApplication(this.superclass, this.mixins); | 509 MixinApplication(this.superclass, this.mixins); |
| 493 | 510 |
| 494 MixinApplication asMixinApplication() => this; | 511 MixinApplication asMixinApplication() => this; |
| 495 | 512 |
| 496 accept(Visitor visitor) => visitor.visitMixinApplication(this); | 513 accept(Visitor visitor) => visitor.visitMixinApplication(this); |
| 497 | 514 |
| 498 accept1(Visitor1 visitor, arg) => visitor.visitMixinApplication(this, arg); | 515 accept1(Visitor1 visitor, arg) => visitor.visitMixinApplication(this, arg); |
| 499 | 516 |
| 500 visitChildren(Visitor visitor) { | 517 visitChildren(Visitor visitor) { |
| 501 if (superclass != null) superclass.accept(visitor); | 518 if (superclass != null) superclass.accept(visitor); |
| 502 if (mixins != null) mixins.accept(visitor); | 519 if (mixins != null) mixins.accept(visitor); |
| 503 } | 520 } |
| 504 | 521 |
| 505 visitChildren1(Visitor1 visitor, arg) { | 522 visitChildren1(Visitor1 visitor, arg) { |
| 506 if (superclass != null) superclass.accept1(visitor, arg); | 523 if (superclass != null) superclass.accept1(visitor, arg); |
| 507 if (mixins != null) mixins.accept1(visitor, arg); | 524 if (mixins != null) mixins.accept1(visitor, arg); |
| 508 } | 525 } |
| 509 | 526 |
| 510 Token getBeginToken() => superclass.getBeginToken(); | 527 Token getBeginToken() => superclass.getBeginToken(); |
| 511 Token getEndToken() => mixins.getEndToken(); | 528 Token getEndToken() => mixins.getEndToken(); |
| 512 } | 529 } |
| 513 | 530 |
| 514 // TODO(kasperl): Let this share some structure with the typedef for function | |
| 515 // type aliases? | |
| 516 class NamedMixinApplication extends Node implements MixinApplication { | 531 class NamedMixinApplication extends Node implements MixinApplication { |
| 517 final Identifier name; | 532 final Identifier name; |
| 518 final NodeList typeParameters; | 533 final NodeList typeParameters; |
| 519 | 534 |
| 520 final Modifiers modifiers; | 535 final Modifiers modifiers; |
| 521 final MixinApplication mixinApplication; | 536 final MixinApplication mixinApplication; |
| 522 final NodeList interfaces; | 537 final NodeList interfaces; |
| 523 | 538 |
| 524 final Token classKeyword; | 539 final Token classKeyword; |
| 525 final Token endToken; | 540 final Token endToken; |
| 526 | 541 |
| 527 NamedMixinApplication(this.name, this.typeParameters, this.modifiers, | 542 NamedMixinApplication(this.name, this.typeParameters, this.modifiers, |
| 528 this.mixinApplication, this.interfaces, this.classKeyword, this.endToken); | 543 this.mixinApplication, this.interfaces, this.classKeyword, this.endToken); |
| 529 | 544 |
| 530 TypeAnnotation get superclass => mixinApplication.superclass; | 545 NominalTypeAnnotation get superclass => mixinApplication.superclass; |
| 531 NodeList get mixins => mixinApplication.mixins; | 546 NodeList get mixins => mixinApplication.mixins; |
| 532 | 547 |
| 533 MixinApplication asMixinApplication() => this; | 548 MixinApplication asMixinApplication() => this; |
| 534 NamedMixinApplication asNamedMixinApplication() => this; | 549 NamedMixinApplication asNamedMixinApplication() => this; |
| 535 | 550 |
| 536 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); | 551 accept(Visitor visitor) => visitor.visitNamedMixinApplication(this); |
| 537 | 552 |
| 538 accept1(Visitor1 visitor, arg) { | 553 accept1(Visitor1 visitor, arg) { |
| 539 return visitor.visitNamedMixinApplication(this, arg); | 554 return visitor.visitNamedMixinApplication(this, arg); |
| 540 } | 555 } |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1405 | 1420 |
| 1406 Token getEndToken() => identifiers.getEndToken(); | 1421 Token getEndToken() => identifiers.getEndToken(); |
| 1407 | 1422 |
| 1408 String get slowNameString { | 1423 String get slowNameString { |
| 1409 Unparser unparser = new Unparser(); | 1424 Unparser unparser = new Unparser(); |
| 1410 unparser.unparseNodeListOfIdentifiers(identifiers); | 1425 unparser.unparseNodeListOfIdentifiers(identifiers); |
| 1411 return unparser.result; | 1426 return unparser.result; |
| 1412 } | 1427 } |
| 1413 } | 1428 } |
| 1414 | 1429 |
| 1430 /// A class that represents a non-existing identifier. | |
| 1431 /// | |
| 1432 /// The singleton instance of this class should be used in places, where | |
| 1433 /// no identifier was given. | |
| 1434 class NoIdentifier extends Identifier { | |
| 1435 static NoIdentifier _singleton = new NoIdentifier._(); | |
| 1436 | |
| 1437 factory NoIdentifier() => _singleton; | |
| 1438 NoIdentifier._() : super(null); | |
| 1439 | |
| 1440 String get source => throw new UnsupportedError("source"); | |
| 1441 | |
| 1442 bool isThis() => false; | |
| 1443 | |
| 1444 bool isSuper() => false; | |
| 1445 | |
| 1446 Identifier asIdentifier() => null; | |
| 1447 | |
| 1448 accept(Visitor visitor) => throw new UnsupportedError("accept"); | |
| 1449 | |
| 1450 accept1(Visitor1 visitor, arg) => throw new UnsupportedError("accept1"); | |
| 1451 | |
| 1452 visitChildren(Visitor visitor) => throw new UnsupportedError("visitChildren"); | |
| 1453 | |
| 1454 visitChildren1(Visitor1 visitor, arg) | |
| 1455 => throw new UnsupportedError("visitChildren1"); | |
| 1456 | |
| 1457 Token getBeginToken() => throw new UnsupportedError("getBeginToken"); | |
| 1458 | |
| 1459 Token getEndToken() => throw new UnsupportedError("getEndToken"); | |
| 1460 } | |
| 1461 | |
| 1415 class Identifier extends Expression with StoredTreeElementMixin { | 1462 class Identifier extends Expression with StoredTreeElementMixin { |
| 1416 final Token token; | 1463 final Token token; |
| 1417 | 1464 |
| 1418 String get source => token.value; | 1465 String get source => token.value; |
| 1419 | 1466 |
| 1420 Identifier(Token this.token); | 1467 Identifier(Token this.token); |
| 1421 | 1468 |
| 1422 bool isThis() => identical(source, 'this'); | 1469 bool isThis() => identical(source, 'this'); |
| 1423 | 1470 |
| 1424 bool isSuper() => identical(source, 'super'); | 1471 bool isSuper() => identical(source, 'super'); |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1713 accept1(Visitor1 visitor, arg) => visitor.visitRethrow(this, arg); | 1760 accept1(Visitor1 visitor, arg) => visitor.visitRethrow(this, arg); |
| 1714 | 1761 |
| 1715 visitChildren(Visitor visitor) {} | 1762 visitChildren(Visitor visitor) {} |
| 1716 | 1763 |
| 1717 visitChildren1(Visitor1 visitor, arg) {} | 1764 visitChildren1(Visitor1 visitor, arg) {} |
| 1718 | 1765 |
| 1719 Token getBeginToken() => throwToken; | 1766 Token getBeginToken() => throwToken; |
| 1720 Token getEndToken() => endToken; | 1767 Token getEndToken() => endToken; |
| 1721 } | 1768 } |
| 1722 | 1769 |
| 1723 class TypeAnnotation extends Node { | 1770 abstract class TypeAnnotation extends Node { |
| 1724 final Expression typeName; | 1771 } |
| 1772 | |
| 1773 class NominalTypeAnnotation extends TypeAnnotation { | |
| 1774 final Node typeName; | |
|
Siggi Cherem (dart-lang)
2016/12/29 22:46:58
Any reason this changed to Node?
floitsch
2016/12/30 14:55:48
Old change, when I hadn't subclassed `TypeAnnotati
| |
| 1725 final NodeList typeArguments; | 1775 final NodeList typeArguments; |
| 1726 | 1776 |
| 1727 TypeAnnotation(Expression this.typeName, NodeList this.typeArguments); | 1777 NominalTypeAnnotation(this.typeName, this.typeArguments); |
| 1728 | 1778 |
| 1729 TypeAnnotation asTypeAnnotation() => this; | 1779 NominalTypeAnnotation asNominalTypeAnnotation() => this; |
| 1730 | 1780 |
| 1731 accept(Visitor visitor) => visitor.visitTypeAnnotation(this); | 1781 accept(Visitor visitor) => visitor.visitNominalTypeAnnotation(this); |
| 1732 | 1782 |
| 1733 accept1(Visitor1 visitor, arg) => visitor.visitTypeAnnotation(this, arg); | 1783 accept1(Visitor1 visitor, arg) { |
| 1784 return visitor.visitNominalTypeAnnotation(this, arg); | |
| 1785 } | |
| 1734 | 1786 |
| 1735 visitChildren(Visitor visitor) { | 1787 visitChildren(Visitor visitor) { |
| 1736 typeName.accept(visitor); | 1788 typeName.accept(visitor); |
| 1737 if (typeArguments != null) typeArguments.accept(visitor); | 1789 if (typeArguments != null) typeArguments.accept(visitor); |
| 1738 } | 1790 } |
| 1739 | 1791 |
| 1740 visitChildren1(Visitor1 visitor, arg) { | 1792 visitChildren1(Visitor1 visitor, arg) { |
| 1741 typeName.accept1(visitor, arg); | 1793 typeName.accept1(visitor, arg); |
| 1742 if (typeArguments != null) typeArguments.accept1(visitor, arg); | 1794 if (typeArguments != null) typeArguments.accept1(visitor, arg); |
| 1743 } | 1795 } |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1819 } | 1871 } |
| 1820 | 1872 |
| 1821 Token getBeginToken() { | 1873 Token getBeginToken() { |
| 1822 var token = firstBeginToken(modifiers, type); | 1874 var token = firstBeginToken(modifiers, type); |
| 1823 if (token == null) { | 1875 if (token == null) { |
| 1824 token = definitions.getBeginToken(); | 1876 token = definitions.getBeginToken(); |
| 1825 } | 1877 } |
| 1826 return token; | 1878 return token; |
| 1827 } | 1879 } |
| 1828 | 1880 |
| 1829 Token getEndToken() => definitions.getEndToken(); | 1881 Token getEndToken() { |
| 1882 var result = definitions.getEndToken(); | |
| 1883 if (result != null) return result; | |
| 1884 assert(definitions.nodes.length == 1); | |
| 1885 assert(definitions.nodes.last == new NoIdentifier()); | |
| 1886 return type.getEndToken(); | |
| 1887 } | |
| 1830 } | 1888 } |
| 1831 | 1889 |
| 1832 abstract class Loop extends Statement { | 1890 abstract class Loop extends Statement { |
| 1833 Expression get condition; | 1891 Expression get condition; |
| 1834 final Statement body; | 1892 final Statement body; |
| 1835 | 1893 |
| 1836 Loop(this.body); | 1894 Loop(this.body); |
| 1837 | 1895 |
| 1838 bool isValidContinueTarget() => true; | 1896 bool isValidContinueTarget() => true; |
| 1839 } | 1897 } |
| (...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2847 visitChildren(Visitor visitor) => identifiers.accept(visitor); | 2905 visitChildren(Visitor visitor) => identifiers.accept(visitor); |
| 2848 | 2906 |
| 2849 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); | 2907 visitChildren1(Visitor1 visitor, arg) => identifiers.accept1(visitor, arg); |
| 2850 | 2908 |
| 2851 Token getBeginToken() => keywordToken; | 2909 Token getBeginToken() => keywordToken; |
| 2852 | 2910 |
| 2853 Token getEndToken() => identifiers.getEndToken(); | 2911 Token getEndToken() => identifiers.getEndToken(); |
| 2854 } | 2912 } |
| 2855 | 2913 |
| 2856 class Typedef extends Node { | 2914 class Typedef extends Node { |
| 2915 final bool isGeneralizedTypeAlias; | |
| 2916 | |
| 2917 final NodeList templateParameters; | |
|
Siggi Cherem (dart-lang)
2016/12/29 22:46:58
nit: +dartdoc, I'm not sure what is the distinctio
floitsch
2016/12/30 14:55:48
Done.
| |
| 2918 | |
| 2857 final TypeAnnotation returnType; | 2919 final TypeAnnotation returnType; |
| 2858 final Identifier name; | 2920 final Identifier name; |
| 2859 final NodeList typeParameters; | 2921 final NodeList typeParameters; |
| 2860 final NodeList formals; | 2922 final NodeList formals; |
| 2861 | 2923 |
| 2862 final Token typedefKeyword; | 2924 final Token typedefKeyword; |
| 2863 final Token endToken; | 2925 final Token endToken; |
| 2864 | 2926 |
| 2865 Typedef(this.returnType, this.name, this.typeParameters, this.formals, | 2927 Typedef(this.isGeneralizedTypeAlias, this.templateParameters, this.returnType, |
| 2866 this.typedefKeyword, this.endToken); | 2928 this.name, this.typeParameters, this.formals, this.typedefKeyword, |
| 2929 this.endToken); | |
| 2867 | 2930 |
| 2868 Typedef asTypedef() => this; | 2931 Typedef asTypedef() => this; |
| 2869 | 2932 |
| 2870 accept(Visitor visitor) => visitor.visitTypedef(this); | 2933 accept(Visitor visitor) => visitor.visitTypedef(this); |
| 2871 | 2934 |
| 2872 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); | 2935 accept1(Visitor1 visitor, arg) => visitor.visitTypedef(this, arg); |
| 2873 | 2936 |
| 2874 visitChildren(Visitor visitor) { | 2937 visitChildren(Visitor visitor) { |
| 2938 if (templateParameters != null) templateParameters.accept(visitor); | |
| 2875 if (returnType != null) returnType.accept(visitor); | 2939 if (returnType != null) returnType.accept(visitor); |
| 2876 name.accept(visitor); | 2940 name.accept(visitor); |
| 2877 if (typeParameters != null) typeParameters.accept(visitor); | 2941 if (typeParameters != null) typeParameters.accept(visitor); |
| 2878 formals.accept(visitor); | 2942 formals.accept(visitor); |
| 2879 } | 2943 } |
| 2880 | 2944 |
| 2881 visitChildren1(Visitor1 visitor, arg) { | 2945 visitChildren1(Visitor1 visitor, arg) { |
| 2946 if (templateParameters != null) templateParameters.accept1(visitor, arg); | |
| 2882 if (returnType != null) returnType.accept1(visitor, arg); | 2947 if (returnType != null) returnType.accept1(visitor, arg); |
| 2883 name.accept1(visitor, arg); | 2948 name.accept1(visitor, arg); |
| 2884 if (typeParameters != null) typeParameters.accept1(visitor, arg); | 2949 if (typeParameters != null) typeParameters.accept1(visitor, arg); |
| 2885 formals.accept1(visitor, arg); | 2950 formals.accept1(visitor, arg); |
| 2886 } | 2951 } |
| 2887 | 2952 |
| 2888 Token getBeginToken() => typedefKeyword; | 2953 Token getBeginToken() => typedefKeyword; |
| 2889 | 2954 |
| 2890 Token getEndToken() => endToken; | 2955 Token getEndToken() => endToken; |
| 2891 } | 2956 } |
| 2892 | 2957 |
| 2958 class FunctionTypeAnnotation extends TypeAnnotation { | |
| 2959 final TypeAnnotation returnType; | |
| 2960 final Token functionToken; | |
| 2961 final NodeList typeParameters; | |
| 2962 final NodeList formals; | |
| 2963 | |
| 2964 FunctionTypeAnnotation( | |
| 2965 this.returnType, this.functionToken, this.typeParameters, this.formals); | |
| 2966 | |
| 2967 FunctionTypeAnnotation asFunctionTypeAnnotation() => this; | |
| 2968 | |
| 2969 accept(Visitor visitor) => visitor.visitFunctionTypeAnnotation(this); | |
| 2970 | |
| 2971 accept1(Visitor1 visitor, arg) { | |
| 2972 return visitor.visitFunctionTypeAnnotation(this, arg); | |
| 2973 } | |
| 2974 | |
| 2975 visitChildren(Visitor visitor) { | |
| 2976 if (returnType != null) returnType.accept(visitor); | |
| 2977 if (typeParameters != null) typeParameters.accept(visitor); | |
| 2978 formals.accept(visitor); | |
| 2979 } | |
| 2980 | |
| 2981 visitChildren1(Visitor1 visitor, arg) { | |
| 2982 if (returnType != null) returnType.accept1(visitor, arg); | |
| 2983 if (typeParameters != null) typeParameters.accept1(visitor, arg); | |
| 2984 formals.accept1(visitor, arg); | |
| 2985 } | |
| 2986 | |
| 2987 Token getBeginToken() { | |
| 2988 if (returnType != null) return returnType.getBeginToken(); | |
| 2989 return functionToken; | |
| 2990 } | |
| 2991 | |
| 2992 Token getEndToken() => formals.getEndToken(); | |
| 2993 } | |
| 2994 | |
| 2893 class TryStatement extends Statement { | 2995 class TryStatement extends Statement { |
| 2894 final Block tryBlock; | 2996 final Block tryBlock; |
| 2895 final NodeList catchBlocks; | 2997 final NodeList catchBlocks; |
| 2896 final Block finallyBlock; | 2998 final Block finallyBlock; |
| 2897 | 2999 |
| 2898 final Token tryKeyword; | 3000 final Token tryKeyword; |
| 2899 final Token finallyKeyword; | 3001 final Token finallyKeyword; |
| 2900 | 3002 |
| 2901 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, | 3003 TryStatement(this.tryBlock, this.catchBlocks, this.finallyBlock, |
| 2902 this.tryKeyword, this.finallyKeyword); | 3004 this.tryKeyword, this.finallyKeyword); |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3127 get getOrSet => null; | 3229 get getOrSet => null; |
| 3128 get isRedirectingFactory => false; | 3230 get isRedirectingFactory => false; |
| 3129 bool get hasBody => false; | 3231 bool get hasBody => false; |
| 3130 bool get hasEmptyBody => false; | 3232 bool get hasEmptyBody => false; |
| 3131 | 3233 |
| 3132 // VariableDefinitions. | 3234 // VariableDefinitions. |
| 3133 get metadata => null; | 3235 get metadata => null; |
| 3134 get type => null; | 3236 get type => null; |
| 3135 | 3237 |
| 3136 // Typedef. | 3238 // Typedef. |
| 3137 get typeParameters => null; | 3239 get isGeneralizedTypeAlias => null; |
| 3240 get templateParameters => null; | |
| 3138 get formals => null; | 3241 get formals => null; |
| 3139 get typedefKeyword => null; | 3242 get typedefKeyword => null; |
| 3140 } | 3243 } |
| OLD | NEW |