| OLD | NEW |
| (Empty) |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
| 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. | |
| 4 // Generated by scripts/tree_gen.py. | |
| 5 | |
| 6 class DirectiveDefinition extends Definition { | |
| 7 Identifier name; | |
| 8 List<ArgumentNode> arguments; | |
| 9 | |
| 10 DirectiveDefinition(this.name, this.arguments, SourceSpan span): super(span) {
} | |
| 11 | |
| 12 visit(TreeVisitor visitor) => visitor.visitDirectiveDefinition(this); | |
| 13 } | |
| 14 | |
| 15 class TypeDefinition extends Definition { | |
| 16 bool isClass; | |
| 17 Identifier name; | |
| 18 List<ParameterType> typeParameters; | |
| 19 List<TypeReference> extendsTypes; | |
| 20 List<TypeReference> implementsTypes; | |
| 21 NativeType nativeType; | |
| 22 DefaultTypeReference defaultType; | |
| 23 List<Statement> body; | |
| 24 | |
| 25 TypeDefinition(this.isClass, this.name, this.typeParameters, this.extendsTypes
, this.implementsTypes, this.nativeType, this.defaultType, this.body, SourceSpan
span): super(span) {} | |
| 26 | |
| 27 visit(TreeVisitor visitor) => visitor.visitTypeDefinition(this); | |
| 28 } | |
| 29 | |
| 30 class FunctionTypeDefinition extends Definition { | |
| 31 FunctionDefinition func; | |
| 32 List<ParameterType> typeParameters; | |
| 33 | |
| 34 FunctionTypeDefinition(this.func, this.typeParameters, SourceSpan span): super
(span) {} | |
| 35 | |
| 36 visit(TreeVisitor visitor) => visitor.visitFunctionTypeDefinition(this); | |
| 37 } | |
| 38 | |
| 39 class VariableDefinition extends Definition { | |
| 40 List<Token> modifiers; | |
| 41 TypeReference type; | |
| 42 List<Identifier> names; | |
| 43 List<Expression> values; | |
| 44 | |
| 45 VariableDefinition(this.modifiers, this.type, this.names, this.values, SourceS
pan span): super(span) {} | |
| 46 | |
| 47 visit(TreeVisitor visitor) => visitor.visitVariableDefinition(this); | |
| 48 } | |
| 49 | |
| 50 class FunctionDefinition extends Definition { | |
| 51 List<Token> modifiers; | |
| 52 TypeReference returnType; | |
| 53 Identifier name; | |
| 54 List<FormalNode> formals; | |
| 55 List<Expression> initializers; | |
| 56 String nativeBody; | |
| 57 Statement body; | |
| 58 | |
| 59 FunctionDefinition(this.modifiers, this.returnType, this.name, this.formals, t
his.initializers, this.nativeBody, this.body, SourceSpan span): super(span) {} | |
| 60 | |
| 61 visit(TreeVisitor visitor) => visitor.visitFunctionDefinition(this); | |
| 62 } | |
| 63 | |
| 64 class ReturnStatement extends Statement { | |
| 65 Expression value; | |
| 66 | |
| 67 ReturnStatement(this.value, SourceSpan span): super(span) {} | |
| 68 | |
| 69 visit(TreeVisitor visitor) => visitor.visitReturnStatement(this); | |
| 70 } | |
| 71 | |
| 72 class ThrowStatement extends Statement { | |
| 73 Expression value; | |
| 74 | |
| 75 ThrowStatement(this.value, SourceSpan span): super(span) {} | |
| 76 | |
| 77 visit(TreeVisitor visitor) => visitor.visitThrowStatement(this); | |
| 78 } | |
| 79 | |
| 80 class AssertStatement extends Statement { | |
| 81 Expression test; | |
| 82 | |
| 83 AssertStatement(this.test, SourceSpan span): super(span) {} | |
| 84 | |
| 85 visit(TreeVisitor visitor) => visitor.visitAssertStatement(this); | |
| 86 } | |
| 87 | |
| 88 class BreakStatement extends Statement { | |
| 89 Identifier label; | |
| 90 | |
| 91 BreakStatement(this.label, SourceSpan span): super(span) {} | |
| 92 | |
| 93 visit(TreeVisitor visitor) => visitor.visitBreakStatement(this); | |
| 94 } | |
| 95 | |
| 96 class ContinueStatement extends Statement { | |
| 97 Identifier label; | |
| 98 | |
| 99 ContinueStatement(this.label, SourceSpan span): super(span) {} | |
| 100 | |
| 101 visit(TreeVisitor visitor) => visitor.visitContinueStatement(this); | |
| 102 } | |
| 103 | |
| 104 class IfStatement extends Statement { | |
| 105 Expression test; | |
| 106 Statement trueBranch; | |
| 107 Statement falseBranch; | |
| 108 | |
| 109 IfStatement(this.test, this.trueBranch, this.falseBranch, SourceSpan span): su
per(span) {} | |
| 110 | |
| 111 visit(TreeVisitor visitor) => visitor.visitIfStatement(this); | |
| 112 } | |
| 113 | |
| 114 class WhileStatement extends Statement { | |
| 115 Expression test; | |
| 116 Statement body; | |
| 117 | |
| 118 WhileStatement(this.test, this.body, SourceSpan span): super(span) {} | |
| 119 | |
| 120 visit(TreeVisitor visitor) => visitor.visitWhileStatement(this); | |
| 121 } | |
| 122 | |
| 123 class DoStatement extends Statement { | |
| 124 Statement body; | |
| 125 Expression test; | |
| 126 | |
| 127 DoStatement(this.body, this.test, SourceSpan span): super(span) {} | |
| 128 | |
| 129 visit(TreeVisitor visitor) => visitor.visitDoStatement(this); | |
| 130 } | |
| 131 | |
| 132 class ForStatement extends Statement { | |
| 133 Statement init; | |
| 134 Expression test; | |
| 135 List<Expression> step; | |
| 136 Statement body; | |
| 137 | |
| 138 ForStatement(this.init, this.test, this.step, this.body, SourceSpan span): sup
er(span) {} | |
| 139 | |
| 140 visit(TreeVisitor visitor) => visitor.visitForStatement(this); | |
| 141 } | |
| 142 | |
| 143 class ForInStatement extends Statement { | |
| 144 DeclaredIdentifier item; | |
| 145 Expression list; | |
| 146 Statement body; | |
| 147 | |
| 148 ForInStatement(this.item, this.list, this.body, SourceSpan span): super(span)
{} | |
| 149 | |
| 150 visit(TreeVisitor visitor) => visitor.visitForInStatement(this); | |
| 151 } | |
| 152 | |
| 153 class TryStatement extends Statement { | |
| 154 Statement body; | |
| 155 List<CatchNode> catches; | |
| 156 Statement finallyBlock; | |
| 157 | |
| 158 TryStatement(this.body, this.catches, this.finallyBlock, SourceSpan span): sup
er(span) {} | |
| 159 | |
| 160 visit(TreeVisitor visitor) => visitor.visitTryStatement(this); | |
| 161 } | |
| 162 | |
| 163 class SwitchStatement extends Statement { | |
| 164 Expression test; | |
| 165 List<CaseNode> cases; | |
| 166 | |
| 167 SwitchStatement(this.test, this.cases, SourceSpan span): super(span) {} | |
| 168 | |
| 169 visit(TreeVisitor visitor) => visitor.visitSwitchStatement(this); | |
| 170 } | |
| 171 | |
| 172 class BlockStatement extends Statement { | |
| 173 List<Statement> body; | |
| 174 | |
| 175 BlockStatement(this.body, SourceSpan span): super(span) {} | |
| 176 | |
| 177 visit(TreeVisitor visitor) => visitor.visitBlockStatement(this); | |
| 178 } | |
| 179 | |
| 180 class LabeledStatement extends Statement { | |
| 181 Identifier name; | |
| 182 Statement body; | |
| 183 | |
| 184 LabeledStatement(this.name, this.body, SourceSpan span): super(span) {} | |
| 185 | |
| 186 visit(TreeVisitor visitor) => visitor.visitLabeledStatement(this); | |
| 187 } | |
| 188 | |
| 189 class ExpressionStatement extends Statement { | |
| 190 Expression body; | |
| 191 | |
| 192 ExpressionStatement(this.body, SourceSpan span): super(span) {} | |
| 193 | |
| 194 visit(TreeVisitor visitor) => visitor.visitExpressionStatement(this); | |
| 195 } | |
| 196 | |
| 197 class EmptyStatement extends Statement { | |
| 198 | |
| 199 EmptyStatement(SourceSpan span): super(span) {} | |
| 200 | |
| 201 visit(TreeVisitor visitor) => visitor.visitEmptyStatement(this); | |
| 202 } | |
| 203 | |
| 204 class DietStatement extends Statement { | |
| 205 | |
| 206 DietStatement(SourceSpan span): super(span) {} | |
| 207 | |
| 208 visit(TreeVisitor visitor) => visitor.visitDietStatement(this); | |
| 209 } | |
| 210 | |
| 211 class LambdaExpression extends Expression { | |
| 212 FunctionDefinition func; | |
| 213 | |
| 214 LambdaExpression(this.func, SourceSpan span): super(span) {} | |
| 215 | |
| 216 visit(TreeVisitor visitor) => visitor.visitLambdaExpression(this); | |
| 217 } | |
| 218 | |
| 219 class CallExpression extends Expression { | |
| 220 Expression target; | |
| 221 List<ArgumentNode> arguments; | |
| 222 | |
| 223 CallExpression(this.target, this.arguments, SourceSpan span): super(span) {} | |
| 224 | |
| 225 visit(TreeVisitor visitor) => visitor.visitCallExpression(this); | |
| 226 } | |
| 227 | |
| 228 class IndexExpression extends Expression { | |
| 229 Expression target; | |
| 230 Expression index; | |
| 231 | |
| 232 IndexExpression(this.target, this.index, SourceSpan span): super(span) {} | |
| 233 | |
| 234 visit(TreeVisitor visitor) => visitor.visitIndexExpression(this); | |
| 235 } | |
| 236 | |
| 237 class BinaryExpression extends Expression { | |
| 238 Token op; | |
| 239 Expression x; | |
| 240 Expression y; | |
| 241 | |
| 242 BinaryExpression(this.op, this.x, this.y, SourceSpan span): super(span) {} | |
| 243 | |
| 244 visit(TreeVisitor visitor) => visitor.visitBinaryExpression(this); | |
| 245 } | |
| 246 | |
| 247 class UnaryExpression extends Expression { | |
| 248 Token op; | |
| 249 Expression self; | |
| 250 | |
| 251 UnaryExpression(this.op, this.self, SourceSpan span): super(span) {} | |
| 252 | |
| 253 visit(TreeVisitor visitor) => visitor.visitUnaryExpression(this); | |
| 254 } | |
| 255 | |
| 256 class PostfixExpression extends Expression { | |
| 257 Expression body; | |
| 258 Token op; | |
| 259 | |
| 260 PostfixExpression(this.body, this.op, SourceSpan span): super(span) {} | |
| 261 | |
| 262 visit(TreeVisitor visitor) => visitor.visitPostfixExpression(this); | |
| 263 } | |
| 264 | |
| 265 class NewExpression extends Expression { | |
| 266 bool isConst; | |
| 267 TypeReference type; | |
| 268 Identifier name; | |
| 269 List<ArgumentNode> arguments; | |
| 270 | |
| 271 NewExpression(this.isConst, this.type, this.name, this.arguments, SourceSpan s
pan): super(span) {} | |
| 272 | |
| 273 visit(TreeVisitor visitor) => visitor.visitNewExpression(this); | |
| 274 } | |
| 275 | |
| 276 class ListExpression extends Expression { | |
| 277 bool isConst; | |
| 278 TypeReference itemType; | |
| 279 List<Expression> values; | |
| 280 | |
| 281 ListExpression(this.isConst, this.itemType, this.values, SourceSpan span): sup
er(span) {} | |
| 282 | |
| 283 visit(TreeVisitor visitor) => visitor.visitListExpression(this); | |
| 284 } | |
| 285 | |
| 286 class MapExpression extends Expression { | |
| 287 bool isConst; | |
| 288 TypeReference keyType; | |
| 289 TypeReference valueType; | |
| 290 List<Expression> items; | |
| 291 | |
| 292 MapExpression(this.isConst, this.keyType, this.valueType, this.items, SourceSp
an span): super(span) {} | |
| 293 | |
| 294 visit(TreeVisitor visitor) => visitor.visitMapExpression(this); | |
| 295 } | |
| 296 | |
| 297 class ConditionalExpression extends Expression { | |
| 298 Expression test; | |
| 299 Expression trueBranch; | |
| 300 Expression falseBranch; | |
| 301 | |
| 302 ConditionalExpression(this.test, this.trueBranch, this.falseBranch, SourceSpan
span): super(span) {} | |
| 303 | |
| 304 visit(TreeVisitor visitor) => visitor.visitConditionalExpression(this); | |
| 305 } | |
| 306 | |
| 307 class IsExpression extends Expression { | |
| 308 bool isTrue; | |
| 309 Expression x; | |
| 310 TypeReference type; | |
| 311 | |
| 312 IsExpression(this.isTrue, this.x, this.type, SourceSpan span): super(span) {} | |
| 313 | |
| 314 visit(TreeVisitor visitor) => visitor.visitIsExpression(this); | |
| 315 } | |
| 316 | |
| 317 class ParenExpression extends Expression { | |
| 318 Expression body; | |
| 319 | |
| 320 ParenExpression(this.body, SourceSpan span): super(span) {} | |
| 321 | |
| 322 visit(TreeVisitor visitor) => visitor.visitParenExpression(this); | |
| 323 } | |
| 324 | |
| 325 class AwaitExpression extends Expression { | |
| 326 Expression body; | |
| 327 | |
| 328 AwaitExpression(this.body, SourceSpan span): super(span) {} | |
| 329 | |
| 330 visit(TreeVisitor visitor) => visitor.visitAwaitExpression(this); | |
| 331 } | |
| 332 | |
| 333 class DotExpression extends Expression { | |
| 334 Expression self; | |
| 335 Identifier name; | |
| 336 | |
| 337 DotExpression(this.self, this.name, SourceSpan span): super(span) {} | |
| 338 | |
| 339 visit(TreeVisitor visitor) => visitor.visitDotExpression(this); | |
| 340 } | |
| 341 | |
| 342 class VarExpression extends Expression { | |
| 343 Identifier name; | |
| 344 | |
| 345 VarExpression(this.name, SourceSpan span): super(span) {} | |
| 346 | |
| 347 visit(TreeVisitor visitor) => visitor.visitVarExpression(this); | |
| 348 } | |
| 349 | |
| 350 class ThisExpression extends Expression { | |
| 351 | |
| 352 ThisExpression(SourceSpan span): super(span) {} | |
| 353 | |
| 354 visit(TreeVisitor visitor) => visitor.visitThisExpression(this); | |
| 355 } | |
| 356 | |
| 357 class SuperExpression extends Expression { | |
| 358 | |
| 359 SuperExpression(SourceSpan span): super(span) {} | |
| 360 | |
| 361 visit(TreeVisitor visitor) => visitor.visitSuperExpression(this); | |
| 362 } | |
| 363 | |
| 364 class LiteralExpression extends Expression { | |
| 365 Value value; | |
| 366 | |
| 367 LiteralExpression(this.value, SourceSpan span): super(span) {} | |
| 368 | |
| 369 visit(TreeVisitor visitor) => visitor.visitLiteralExpression(this); | |
| 370 } | |
| 371 | |
| 372 class StringConcatExpression extends Expression { | |
| 373 List<Expression> strings; | |
| 374 | |
| 375 StringConcatExpression(this.strings, SourceSpan span): super(span) {} | |
| 376 | |
| 377 visit(TreeVisitor visitor) => visitor.visitStringConcatExpression(this); | |
| 378 } | |
| 379 | |
| 380 class StringInterpExpression extends Expression { | |
| 381 List<Expression> pieces; | |
| 382 | |
| 383 StringInterpExpression(this.pieces, SourceSpan span): super(span) {} | |
| 384 | |
| 385 visit(TreeVisitor visitor) => visitor.visitStringInterpExpression(this); | |
| 386 } | |
| 387 | |
| 388 class SimpleTypeReference extends TypeReference { | |
| 389 Type type; | |
| 390 | |
| 391 SimpleTypeReference(this.type, SourceSpan span): super(span) {} | |
| 392 | |
| 393 visit(TreeVisitor visitor) => visitor.visitSimpleTypeReference(this); | |
| 394 } | |
| 395 | |
| 396 class NameTypeReference extends TypeReference { | |
| 397 bool isFinal; | |
| 398 Identifier name; | |
| 399 List<Identifier> names; | |
| 400 | |
| 401 NameTypeReference(this.isFinal, this.name, this.names, SourceSpan span): super
(span) {} | |
| 402 | |
| 403 visit(TreeVisitor visitor) => visitor.visitNameTypeReference(this); | |
| 404 } | |
| 405 | |
| 406 class GenericTypeReference extends TypeReference { | |
| 407 TypeReference baseType; | |
| 408 List<TypeReference> typeArguments; | |
| 409 int depth; | |
| 410 | |
| 411 GenericTypeReference(this.baseType, this.typeArguments, this.depth, SourceSpan
span): super(span) {} | |
| 412 | |
| 413 visit(TreeVisitor visitor) => visitor.visitGenericTypeReference(this); | |
| 414 } | |
| 415 | |
| 416 class FunctionTypeReference extends TypeReference { | |
| 417 bool isFinal; | |
| 418 FunctionDefinition func; | |
| 419 | |
| 420 FunctionTypeReference(this.isFinal, this.func, SourceSpan span): super(span) {
} | |
| 421 | |
| 422 visit(TreeVisitor visitor) => visitor.visitFunctionTypeReference(this); | |
| 423 } | |
| 424 | |
| 425 class DefaultTypeReference extends TypeReference { | |
| 426 bool oldFactory; | |
| 427 NameTypeReference baseType; | |
| 428 List<ParameterType> typeParameters; | |
| 429 | |
| 430 DefaultTypeReference(this.oldFactory, this.baseType, this.typeParameters, Sour
ceSpan span): super(span) {} | |
| 431 | |
| 432 visit(TreeVisitor visitor) => visitor.visitDefaultTypeReference(this); | |
| 433 } | |
| 434 | |
| 435 class ArgumentNode extends Node { | |
| 436 Identifier label; | |
| 437 Expression value; | |
| 438 | |
| 439 ArgumentNode(this.label, this.value, SourceSpan span): super(span) {} | |
| 440 | |
| 441 visit(TreeVisitor visitor) => visitor.visitArgumentNode(this); | |
| 442 } | |
| 443 | |
| 444 class FormalNode extends Node { | |
| 445 bool isThis; | |
| 446 bool isRest; | |
| 447 TypeReference type; | |
| 448 Identifier name; | |
| 449 Expression value; | |
| 450 | |
| 451 FormalNode(this.isThis, this.isRest, this.type, this.name, this.value, SourceS
pan span): super(span) {} | |
| 452 | |
| 453 visit(TreeVisitor visitor) => visitor.visitFormalNode(this); | |
| 454 } | |
| 455 | |
| 456 class CatchNode extends Node { | |
| 457 DeclaredIdentifier exception; | |
| 458 DeclaredIdentifier trace; | |
| 459 Statement body; | |
| 460 | |
| 461 CatchNode(this.exception, this.trace, this.body, SourceSpan span): super(span)
{} | |
| 462 | |
| 463 visit(TreeVisitor visitor) => visitor.visitCatchNode(this); | |
| 464 } | |
| 465 | |
| 466 class CaseNode extends Node { | |
| 467 Identifier label; | |
| 468 List<Expression> cases; | |
| 469 List<Statement> statements; | |
| 470 | |
| 471 CaseNode(this.label, this.cases, this.statements, SourceSpan span): super(span
) {} | |
| 472 | |
| 473 visit(TreeVisitor visitor) => visitor.visitCaseNode(this); | |
| 474 } | |
| 475 | |
| 476 class TypeParameter extends Node { | |
| 477 Identifier name; | |
| 478 TypeReference extendsType; | |
| 479 | |
| 480 TypeParameter(this.name, this.extendsType, SourceSpan span): super(span) {} | |
| 481 | |
| 482 visit(TreeVisitor visitor) => visitor.visitTypeParameter(this); | |
| 483 } | |
| 484 | |
| 485 class Identifier extends Node { | |
| 486 String name; | |
| 487 | |
| 488 Identifier(this.name, SourceSpan span): super(span) {} | |
| 489 | |
| 490 visit(TreeVisitor visitor) => visitor.visitIdentifier(this); | |
| 491 } | |
| 492 | |
| 493 class DeclaredIdentifier extends Expression { | |
| 494 TypeReference type; | |
| 495 Identifier name; | |
| 496 bool isFinal; | |
| 497 | |
| 498 DeclaredIdentifier(this.type, this.name, this.isFinal, SourceSpan span): super
(span) {} | |
| 499 | |
| 500 visit(TreeVisitor visitor) => visitor.visitDeclaredIdentifier(this); | |
| 501 } | |
| 502 | |
| 503 | |
| 504 interface TreeVisitor { | |
| 505 visitDirectiveDefinition(DirectiveDefinition node); | |
| 506 | |
| 507 visitTypeDefinition(TypeDefinition node); | |
| 508 | |
| 509 visitFunctionTypeDefinition(FunctionTypeDefinition node); | |
| 510 | |
| 511 visitVariableDefinition(VariableDefinition node); | |
| 512 | |
| 513 visitFunctionDefinition(FunctionDefinition node); | |
| 514 | |
| 515 visitReturnStatement(ReturnStatement node); | |
| 516 | |
| 517 visitThrowStatement(ThrowStatement node); | |
| 518 | |
| 519 visitAssertStatement(AssertStatement node); | |
| 520 | |
| 521 visitBreakStatement(BreakStatement node); | |
| 522 | |
| 523 visitContinueStatement(ContinueStatement node); | |
| 524 | |
| 525 visitIfStatement(IfStatement node); | |
| 526 | |
| 527 visitWhileStatement(WhileStatement node); | |
| 528 | |
| 529 visitDoStatement(DoStatement node); | |
| 530 | |
| 531 visitForStatement(ForStatement node); | |
| 532 | |
| 533 visitForInStatement(ForInStatement node); | |
| 534 | |
| 535 visitTryStatement(TryStatement node); | |
| 536 | |
| 537 visitSwitchStatement(SwitchStatement node); | |
| 538 | |
| 539 visitBlockStatement(BlockStatement node); | |
| 540 | |
| 541 visitLabeledStatement(LabeledStatement node); | |
| 542 | |
| 543 visitExpressionStatement(ExpressionStatement node); | |
| 544 | |
| 545 visitEmptyStatement(EmptyStatement node); | |
| 546 | |
| 547 visitDietStatement(DietStatement node); | |
| 548 | |
| 549 visitLambdaExpression(LambdaExpression node); | |
| 550 | |
| 551 visitCallExpression(CallExpression node); | |
| 552 | |
| 553 visitIndexExpression(IndexExpression node); | |
| 554 | |
| 555 visitBinaryExpression(BinaryExpression node); | |
| 556 | |
| 557 visitUnaryExpression(UnaryExpression node); | |
| 558 | |
| 559 visitPostfixExpression(PostfixExpression node); | |
| 560 | |
| 561 visitNewExpression(NewExpression node); | |
| 562 | |
| 563 visitListExpression(ListExpression node); | |
| 564 | |
| 565 visitMapExpression(MapExpression node); | |
| 566 | |
| 567 visitConditionalExpression(ConditionalExpression node); | |
| 568 | |
| 569 visitIsExpression(IsExpression node); | |
| 570 | |
| 571 visitParenExpression(ParenExpression node); | |
| 572 | |
| 573 visitAwaitExpression(AwaitExpression node); | |
| 574 | |
| 575 visitDotExpression(DotExpression node); | |
| 576 | |
| 577 visitVarExpression(VarExpression node); | |
| 578 | |
| 579 visitThisExpression(ThisExpression node); | |
| 580 | |
| 581 visitSuperExpression(SuperExpression node); | |
| 582 | |
| 583 visitLiteralExpression(LiteralExpression node); | |
| 584 | |
| 585 visitStringConcatExpression(StringConcatExpression node); | |
| 586 | |
| 587 visitStringInterpExpression(StringInterpExpression node); | |
| 588 | |
| 589 visitSimpleTypeReference(SimpleTypeReference node); | |
| 590 | |
| 591 visitNameTypeReference(NameTypeReference node); | |
| 592 | |
| 593 visitGenericTypeReference(GenericTypeReference node); | |
| 594 | |
| 595 visitFunctionTypeReference(FunctionTypeReference node); | |
| 596 | |
| 597 visitDefaultTypeReference(DefaultTypeReference node); | |
| 598 | |
| 599 visitArgumentNode(ArgumentNode node); | |
| 600 | |
| 601 visitFormalNode(FormalNode node); | |
| 602 | |
| 603 visitCatchNode(CatchNode node); | |
| 604 | |
| 605 visitCaseNode(CaseNode node); | |
| 606 | |
| 607 visitTypeParameter(TypeParameter node); | |
| 608 | |
| 609 visitIdentifier(Identifier node); | |
| 610 | |
| 611 visitDeclaredIdentifier(DeclaredIdentifier node); | |
| 612 | |
| 613 } | |
| 614 | |
| 615 class TreePrinter implements TreeVisitor { | |
| 616 var output; | |
| 617 TreePrinter(this.output) { output.printer = this; } | |
| 618 void visitDirectiveDefinition(DirectiveDefinition node) { | |
| 619 output.heading('DirectiveDefinition', node.span); | |
| 620 output.writeNode('name', node.name); | |
| 621 output.writeNodeList('arguments', node.arguments); | |
| 622 } | |
| 623 | |
| 624 void visitTypeDefinition(TypeDefinition node) { | |
| 625 output.heading('TypeDefinition', node.span); | |
| 626 output.writeValue('isClass', node.isClass); | |
| 627 output.writeNode('name', node.name); | |
| 628 output.writeList('typeParameters', node.typeParameters); | |
| 629 output.writeNodeList('extendsTypes', node.extendsTypes); | |
| 630 output.writeNodeList('implementsTypes', node.implementsTypes); | |
| 631 output.writeValue('nativeType', node.nativeType); | |
| 632 output.writeNode('defaultType', node.defaultType); | |
| 633 output.writeNodeList('body', node.body); | |
| 634 } | |
| 635 | |
| 636 void visitFunctionTypeDefinition(FunctionTypeDefinition node) { | |
| 637 output.heading('FunctionTypeDefinition', node.span); | |
| 638 output.writeNode('func', node.func); | |
| 639 output.writeList('typeParameters', node.typeParameters); | |
| 640 } | |
| 641 | |
| 642 void visitVariableDefinition(VariableDefinition node) { | |
| 643 output.heading('VariableDefinition', node.span); | |
| 644 output.writeList('modifiers', node.modifiers); | |
| 645 output.writeNode('type', node.type); | |
| 646 output.writeNodeList('names', node.names); | |
| 647 output.writeNodeList('values', node.values); | |
| 648 } | |
| 649 | |
| 650 void visitFunctionDefinition(FunctionDefinition node) { | |
| 651 output.heading('FunctionDefinition', node.span); | |
| 652 output.writeList('modifiers', node.modifiers); | |
| 653 output.writeNode('returnType', node.returnType); | |
| 654 output.writeNode('name', node.name); | |
| 655 output.writeNodeList('formals', node.formals); | |
| 656 output.writeNodeList('initializers', node.initializers); | |
| 657 output.writeValue('nativeBody', node.nativeBody); | |
| 658 output.writeNode('body', node.body); | |
| 659 } | |
| 660 | |
| 661 void visitReturnStatement(ReturnStatement node) { | |
| 662 output.heading('ReturnStatement', node.span); | |
| 663 output.writeNode('value', node.value); | |
| 664 } | |
| 665 | |
| 666 void visitThrowStatement(ThrowStatement node) { | |
| 667 output.heading('ThrowStatement', node.span); | |
| 668 output.writeNode('value', node.value); | |
| 669 } | |
| 670 | |
| 671 void visitAssertStatement(AssertStatement node) { | |
| 672 output.heading('AssertStatement', node.span); | |
| 673 output.writeNode('test', node.test); | |
| 674 } | |
| 675 | |
| 676 void visitBreakStatement(BreakStatement node) { | |
| 677 output.heading('BreakStatement(' + output.toValue(node.label) + ")", node.sp
an); | |
| 678 } | |
| 679 | |
| 680 void visitContinueStatement(ContinueStatement node) { | |
| 681 output.heading('ContinueStatement(' + output.toValue(node.label) + ")", node
.span); | |
| 682 } | |
| 683 | |
| 684 void visitIfStatement(IfStatement node) { | |
| 685 output.heading('IfStatement', node.span); | |
| 686 output.writeNode('test', node.test); | |
| 687 output.writeNode('trueBranch', node.trueBranch); | |
| 688 output.writeNode('falseBranch', node.falseBranch); | |
| 689 } | |
| 690 | |
| 691 void visitWhileStatement(WhileStatement node) { | |
| 692 output.heading('WhileStatement', node.span); | |
| 693 output.writeNode('test', node.test); | |
| 694 output.writeNode('body', node.body); | |
| 695 } | |
| 696 | |
| 697 void visitDoStatement(DoStatement node) { | |
| 698 output.heading('DoStatement', node.span); | |
| 699 output.writeNode('body', node.body); | |
| 700 output.writeNode('test', node.test); | |
| 701 } | |
| 702 | |
| 703 void visitForStatement(ForStatement node) { | |
| 704 output.heading('ForStatement', node.span); | |
| 705 output.writeNode('init', node.init); | |
| 706 output.writeNode('test', node.test); | |
| 707 output.writeNodeList('step', node.step); | |
| 708 output.writeNode('body', node.body); | |
| 709 } | |
| 710 | |
| 711 void visitForInStatement(ForInStatement node) { | |
| 712 output.heading('ForInStatement', node.span); | |
| 713 output.writeNode('item', node.item); | |
| 714 output.writeNode('list', node.list); | |
| 715 output.writeNode('body', node.body); | |
| 716 } | |
| 717 | |
| 718 void visitTryStatement(TryStatement node) { | |
| 719 output.heading('TryStatement', node.span); | |
| 720 output.writeNode('body', node.body); | |
| 721 output.writeNodeList('catches', node.catches); | |
| 722 output.writeNode('finallyBlock', node.finallyBlock); | |
| 723 } | |
| 724 | |
| 725 void visitSwitchStatement(SwitchStatement node) { | |
| 726 output.heading('SwitchStatement', node.span); | |
| 727 output.writeNode('test', node.test); | |
| 728 output.writeNodeList('cases', node.cases); | |
| 729 } | |
| 730 | |
| 731 void visitBlockStatement(BlockStatement node) { | |
| 732 output.heading('BlockStatement', node.span); | |
| 733 output.writeNodeList('body', node.body); | |
| 734 } | |
| 735 | |
| 736 void visitLabeledStatement(LabeledStatement node) { | |
| 737 output.heading('LabeledStatement', node.span); | |
| 738 output.writeNode('name', node.name); | |
| 739 output.writeNode('body', node.body); | |
| 740 } | |
| 741 | |
| 742 void visitExpressionStatement(ExpressionStatement node) { | |
| 743 output.heading('ExpressionStatement', node.span); | |
| 744 output.writeNode('body', node.body); | |
| 745 } | |
| 746 | |
| 747 void visitEmptyStatement(EmptyStatement node) { | |
| 748 output.heading('EmptyStatement', node.span); | |
| 749 } | |
| 750 | |
| 751 void visitDietStatement(DietStatement node) { | |
| 752 output.heading('DietStatement', node.span); | |
| 753 } | |
| 754 | |
| 755 void visitLambdaExpression(LambdaExpression node) { | |
| 756 output.heading('LambdaExpression', node.span); | |
| 757 output.writeNode('func', node.func); | |
| 758 } | |
| 759 | |
| 760 void visitCallExpression(CallExpression node) { | |
| 761 output.heading('CallExpression', node.span); | |
| 762 output.writeNode('target', node.target); | |
| 763 output.writeNodeList('arguments', node.arguments); | |
| 764 } | |
| 765 | |
| 766 void visitIndexExpression(IndexExpression node) { | |
| 767 output.heading('IndexExpression', node.span); | |
| 768 output.writeNode('target', node.target); | |
| 769 output.writeNode('index', node.index); | |
| 770 } | |
| 771 | |
| 772 void visitBinaryExpression(BinaryExpression node) { | |
| 773 output.heading('BinaryExpression', node.span); | |
| 774 output.writeValue('op', node.op); | |
| 775 output.writeNode('x', node.x); | |
| 776 output.writeNode('y', node.y); | |
| 777 } | |
| 778 | |
| 779 void visitUnaryExpression(UnaryExpression node) { | |
| 780 output.heading('UnaryExpression', node.span); | |
| 781 output.writeValue('op', node.op); | |
| 782 output.writeNode('self', node.self); | |
| 783 } | |
| 784 | |
| 785 void visitPostfixExpression(PostfixExpression node) { | |
| 786 output.heading('PostfixExpression', node.span); | |
| 787 output.writeNode('body', node.body); | |
| 788 output.writeValue('op', node.op); | |
| 789 } | |
| 790 | |
| 791 void visitNewExpression(NewExpression node) { | |
| 792 output.heading('NewExpression', node.span); | |
| 793 output.writeValue('isConst', node.isConst); | |
| 794 output.writeNode('type', node.type); | |
| 795 output.writeNode('name', node.name); | |
| 796 output.writeNodeList('arguments', node.arguments); | |
| 797 } | |
| 798 | |
| 799 void visitListExpression(ListExpression node) { | |
| 800 output.heading('ListExpression', node.span); | |
| 801 output.writeValue('isConst', node.isConst); | |
| 802 output.writeNode('itemType', node.itemType); | |
| 803 output.writeNodeList('values', node.values); | |
| 804 } | |
| 805 | |
| 806 void visitMapExpression(MapExpression node) { | |
| 807 output.heading('MapExpression', node.span); | |
| 808 output.writeValue('isConst', node.isConst); | |
| 809 output.writeNode('keyType', node.keyType); | |
| 810 output.writeNode('valueType', node.valueType); | |
| 811 output.writeNodeList('items', node.items); | |
| 812 } | |
| 813 | |
| 814 void visitConditionalExpression(ConditionalExpression node) { | |
| 815 output.heading('ConditionalExpression', node.span); | |
| 816 output.writeNode('test', node.test); | |
| 817 output.writeNode('trueBranch', node.trueBranch); | |
| 818 output.writeNode('falseBranch', node.falseBranch); | |
| 819 } | |
| 820 | |
| 821 void visitIsExpression(IsExpression node) { | |
| 822 output.heading('IsExpression', node.span); | |
| 823 output.writeValue('isTrue', node.isTrue); | |
| 824 output.writeNode('x', node.x); | |
| 825 output.writeNode('type', node.type); | |
| 826 } | |
| 827 | |
| 828 void visitParenExpression(ParenExpression node) { | |
| 829 output.heading('ParenExpression', node.span); | |
| 830 output.writeNode('body', node.body); | |
| 831 } | |
| 832 | |
| 833 void visitAwaitExpression(AwaitExpression node) { | |
| 834 output.heading('AwaitExpression', node.span); | |
| 835 output.writeNode('body', node.body); | |
| 836 } | |
| 837 | |
| 838 void visitDotExpression(DotExpression node) { | |
| 839 output.heading('DotExpression', node.span); | |
| 840 output.writeNode('self', node.self); | |
| 841 output.writeNode('name', node.name); | |
| 842 } | |
| 843 | |
| 844 void visitVarExpression(VarExpression node) { | |
| 845 output.heading('VarExpression(' + output.toValue(node.name) + ")", node.span
); | |
| 846 } | |
| 847 | |
| 848 void visitThisExpression(ThisExpression node) { | |
| 849 output.heading('ThisExpression', node.span); | |
| 850 } | |
| 851 | |
| 852 void visitSuperExpression(SuperExpression node) { | |
| 853 output.heading('SuperExpression', node.span); | |
| 854 } | |
| 855 | |
| 856 void visitLiteralExpression(LiteralExpression node) { | |
| 857 output.heading('LiteralExpression(' + output.toValue(node.value) + ")", node
.span); | |
| 858 } | |
| 859 | |
| 860 void visitStringConcatExpression(StringConcatExpression node) { | |
| 861 output.heading('StringConcatExpression', node.span); | |
| 862 output.writeNodeList('strings', node.strings); | |
| 863 } | |
| 864 | |
| 865 void visitStringInterpExpression(StringInterpExpression node) { | |
| 866 output.heading('StringInterpExpression', node.span); | |
| 867 output.writeNodeList('pieces', node.pieces); | |
| 868 } | |
| 869 | |
| 870 void visitSimpleTypeReference(SimpleTypeReference node) { | |
| 871 output.heading('SimpleTypeReference(' + output.toValue(node.type) + ")", nod
e.span); | |
| 872 } | |
| 873 | |
| 874 void visitNameTypeReference(NameTypeReference node) { | |
| 875 output.heading('NameTypeReference', node.span); | |
| 876 output.writeValue('isFinal', node.isFinal); | |
| 877 output.writeNode('name', node.name); | |
| 878 output.writeNodeList('names', node.names); | |
| 879 } | |
| 880 | |
| 881 void visitGenericTypeReference(GenericTypeReference node) { | |
| 882 output.heading('GenericTypeReference', node.span); | |
| 883 output.writeNode('baseType', node.baseType); | |
| 884 output.writeNodeList('typeArguments', node.typeArguments); | |
| 885 output.writeValue('depth', node.depth); | |
| 886 } | |
| 887 | |
| 888 void visitFunctionTypeReference(FunctionTypeReference node) { | |
| 889 output.heading('FunctionTypeReference', node.span); | |
| 890 output.writeValue('isFinal', node.isFinal); | |
| 891 output.writeNode('func', node.func); | |
| 892 } | |
| 893 | |
| 894 void visitDefaultTypeReference(DefaultTypeReference node) { | |
| 895 output.heading('DefaultTypeReference', node.span); | |
| 896 output.writeValue('oldFactory', node.oldFactory); | |
| 897 output.writeNode('baseType', node.baseType); | |
| 898 output.writeList('typeParameters', node.typeParameters); | |
| 899 } | |
| 900 | |
| 901 void visitArgumentNode(ArgumentNode node) { | |
| 902 output.heading('ArgumentNode', node.span); | |
| 903 output.writeNode('label', node.label); | |
| 904 output.writeNode('value', node.value); | |
| 905 } | |
| 906 | |
| 907 void visitFormalNode(FormalNode node) { | |
| 908 output.heading('FormalNode', node.span); | |
| 909 output.writeValue('isThis', node.isThis); | |
| 910 output.writeValue('isRest', node.isRest); | |
| 911 output.writeNode('type', node.type); | |
| 912 output.writeNode('name', node.name); | |
| 913 output.writeNode('value', node.value); | |
| 914 } | |
| 915 | |
| 916 void visitCatchNode(CatchNode node) { | |
| 917 output.heading('CatchNode', node.span); | |
| 918 output.writeNode('exception', node.exception); | |
| 919 output.writeNode('trace', node.trace); | |
| 920 output.writeNode('body', node.body); | |
| 921 } | |
| 922 | |
| 923 void visitCaseNode(CaseNode node) { | |
| 924 output.heading('CaseNode', node.span); | |
| 925 output.writeNode('label', node.label); | |
| 926 output.writeNodeList('cases', node.cases); | |
| 927 output.writeNodeList('statements', node.statements); | |
| 928 } | |
| 929 | |
| 930 void visitTypeParameter(TypeParameter node) { | |
| 931 output.heading('TypeParameter', node.span); | |
| 932 output.writeNode('name', node.name); | |
| 933 output.writeNode('extendsType', node.extendsType); | |
| 934 } | |
| 935 | |
| 936 void visitIdentifier(Identifier node) { | |
| 937 output.heading('Identifier(' + output.toValue(node.name) + ")", node.span); | |
| 938 } | |
| 939 | |
| 940 void visitDeclaredIdentifier(DeclaredIdentifier node) { | |
| 941 output.heading('DeclaredIdentifier', node.span); | |
| 942 output.writeNode('type', node.type); | |
| 943 output.writeNode('name', node.name); | |
| 944 output.writeValue('isFinal', node.isFinal); | |
| 945 } | |
| 946 | |
| 947 } | |
| OLD | NEW |