OLD | NEW |
1 library dart_printer_test; | 1 library dart_printer_test; |
2 | 2 |
3 import "package:expect/expect.dart"; | 3 import "package:expect/expect.dart"; |
4 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_pri
nter.dart'; | 4 import '../../../sdk/lib/_internal/compiler/implementation/dart_backend/dart_pri
nter.dart'; |
5 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; | 5 import '../../../sdk/lib/_internal/compiler/implementation/scanner/scannerlib.da
rt'; |
6 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 6 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; |
7 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'; | 7 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart'; |
8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' show
DartString; | 8 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' show
DartString; |
9 import 'dart:mirrors'; | 9 import 'dart:mirrors'; |
10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' as tr
ee; | 10 import '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart' as tr
ee; |
(...skipping 568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 endLabeledStatement(int labelCount) { | 580 endLabeledStatement(int labelCount) { |
581 Statement statement = pop(); | 581 Statement statement = pop(); |
582 for (int i=0; i<labelCount; i++) { | 582 for (int i=0; i<labelCount; i++) { |
583 String label = pop(asName); | 583 String label = pop(asName); |
584 statement = new LabeledStatement(label, statement); | 584 statement = new LabeledStatement(label, statement); |
585 } | 585 } |
586 push(statement); | 586 push(statement); |
587 } | 587 } |
588 | 588 |
| 589 // TODO(kmillikin,asgerf): this code is currently untested. |
589 endFunctionDeclaration(Token end) { | 590 endFunctionDeclaration(Token end) { |
590 Statement body = pop(); | 591 Statement body = pop(); |
591 Parameters parameters = pop(); | 592 Parameters parameters = pop(); |
592 String name = pop(asName); | 593 String name = pop(asName); |
593 TypeAnnotation returnType = popTypeAnnotation(); | 594 TypeAnnotation returnType = popTypeAnnotation(); |
594 push(new FunctionStatement(name, parameters, body, returnType)); | 595 push(new FunctionDeclaration(name, parameters, body)); |
595 } | 596 } |
596 | 597 |
597 endFunctionBody(int count, Token begin, Token end) { | 598 endFunctionBody(int count, Token begin, Token end) { |
598 push(new Block(popList(count, <Statement>[]))); | 599 push(new Block(popList(count, <Statement>[]))); |
599 } | 600 } |
600 } | 601 } |
601 | 602 |
602 class DefaultValue { | 603 class DefaultValue { |
603 final Expression expression; | 604 final Expression expression; |
604 DefaultValue(this.expression); | 605 DefaultValue(this.expression); |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
927 | 928 |
928 checkStatement("[1].bar();"); | 929 checkStatement("[1].bar();"); |
929 checkStatement("1.bar();"); | 930 checkStatement("1.bar();"); |
930 checkStatement("'foo'.bar();"); | 931 checkStatement("'foo'.bar();"); |
931 | 932 |
932 checkStatement("do while(x); while (y);"); | 933 checkStatement("do while(x); while (y);"); |
933 checkStatement("{do; while(x); while (y);}"); | 934 checkStatement("{do; while(x); while (y);}"); |
934 | 935 |
935 } | 936 } |
936 | 937 |
OLD | NEW |