| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart_printer_test; | 5 library dart_printer_test; |
| 6 | 6 |
| 7 import "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
| 8 import 'package:compiler/implementation/dart_backend/dart_printer.dart'; | 8 import 'package:compiler/implementation/dart_backend/dart_printer.dart'; |
| 9 import 'package:compiler/implementation/scanner/scannerlib.dart'; | 9 import 'package:compiler/implementation/scanner/scannerlib.dart'; |
| 10 import 'package:compiler/implementation/source_file.dart'; | 10 import 'package:compiler/implementation/source_file.dart'; |
| (...skipping 573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 | 584 |
| 585 endLabeledStatement(int labelCount) { | 585 endLabeledStatement(int labelCount) { |
| 586 Statement statement = pop(); | 586 Statement statement = pop(); |
| 587 for (int i=0; i<labelCount; i++) { | 587 for (int i=0; i<labelCount; i++) { |
| 588 String label = pop(asName); | 588 String label = pop(asName); |
| 589 statement = new LabeledStatement(label, statement); | 589 statement = new LabeledStatement(label, statement); |
| 590 } | 590 } |
| 591 push(statement); | 591 push(statement); |
| 592 } | 592 } |
| 593 | 593 |
| 594 // TODO(kmillikin,asgerf): this code is currently untested. | |
| 595 endFunctionDeclaration(Token end) { | 594 endFunctionDeclaration(Token end) { |
| 596 Statement body = pop(); | 595 Statement body = pop(); |
| 597 Parameters parameters = pop(); | 596 Parameters parameters = pop(); |
| 598 String name = pop(asName); | 597 String name = pop(asName); |
| 599 TypeAnnotation returnType = popTypeAnnotation(); | 598 TypeAnnotation returnType = popTypeAnnotation(); |
| 600 push(new FunctionDeclaration(name, parameters, body, returnType)); | 599 push(new FunctionDeclaration(new FunctionExpression(parameters, body, |
| 600 name: name, |
| 601 returnType: returnType))); |
| 601 } | 602 } |
| 602 | 603 |
| 603 endFunctionBody(int count, Token begin, Token end) { | 604 endFunctionBody(int count, Token begin, Token end) { |
| 604 push(new Block(popList(count, <Statement>[]))); | 605 push(new Block(popList(count, <Statement>[]))); |
| 605 } | 606 } |
| 606 } | 607 } |
| 607 | 608 |
| 608 class DefaultValue { | 609 class DefaultValue { |
| 609 final Expression expression; | 610 final Expression expression; |
| 610 DefaultValue(this.expression); | 611 DefaultValue(this.expression); |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 checkStatement("do while(x); while (y);"); | 963 checkStatement("do while(x); while (y);"); |
| 963 checkStatement("{do; while(x); while (y);}"); | 964 checkStatement("{do; while(x); while (y);}"); |
| 964 | 965 |
| 965 checkStatement('switch(x) { case 1: case 2: return y; }'); | 966 checkStatement('switch(x) { case 1: case 2: return y; }'); |
| 966 checkStatement('switch(x) { default: return y; }'); | 967 checkStatement('switch(x) { default: return y; }'); |
| 967 checkStatement('switch(x) { case 1: x=y; default: return y; }'); | 968 checkStatement('switch(x) { case 1: x=y; default: return y; }'); |
| 968 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); | 969 checkStatement('switch(x) { case 1: x=y; y=z; break; default: return y; }'); |
| 969 | 970 |
| 970 } | 971 } |
| 971 | 972 |
| OLD | NEW |