| 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:uri'); | 5 #import('dart:uri'); |
| 6 #import('parser_helper.dart'); | 6 #import('parser_helper.dart'); |
| 7 #import("../../../lib/compiler/compiler.dart"); | 7 #import("../../../lib/compiler/compiler.dart"); |
| 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); | 8 #import("../../../lib/compiler/implementation/tree/tree.dart"); |
| 9 | 9 |
| 10 testUnparse(String statement) { | 10 testUnparse(String statement) { |
| 11 Node node = parseStatement(statement); | 11 Node node = parseStatement(statement); |
| 12 Expect.equals(statement, node.unparse()); | 12 Expect.equals(statement, node.unparse()); |
| 13 } | 13 } |
| 14 | 14 |
| 15 testUnparseMember(String member) { | 15 testUnparseMember(String member) { |
| 16 Node node = parseMember(member); | 16 Node node = parseMember(member); |
| 17 Expect.equals(member, node.unparse()); | 17 Expect.equals(member, node.unparse()); |
| 18 } | 18 } |
| 19 | 19 |
| 20 final coreLib = @''' | 20 final coreLib = @''' |
| 21 #library('corelib'); | 21 #library('corelib'); |
| 22 interface Object {} | 22 class Object {} |
| 23 interface bool {} | 23 interface bool {} |
| 24 interface num {} | 24 interface num {} |
| 25 interface int extends num {} | 25 interface int extends num {} |
| 26 interface double extends num {} | 26 interface double extends num {} |
| 27 interface String {} | 27 interface String {} |
| 28 interface Function {} | 28 interface Function {} |
| 29 interface List {} | 29 interface List {} |
| 30 interface Closure {} | 30 interface Closure {} |
| 31 interface Dynamic {} | 31 interface Dynamic {} |
| 32 interface Null {} | 32 interface Null {} |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 | 120 |
| 121 testTopLevelField() { | 121 testTopLevelField() { |
| 122 final src = 'final String x="asd";main(){x;}'; | 122 final src = 'final String x="asd";main(){x;}'; |
| 123 testDart2Dart(src, (String s) => Expect.equals(src, s)); | 123 testDart2Dart(src, (String s) => Expect.equals(src, s)); |
| 124 } | 124 } |
| 125 | 125 |
| 126 testSimpleObjectInstantiation() { | 126 testSimpleObjectInstantiation() { |
| 127 testUnparse('main(){new Object();}'); | 127 testUnparse('main(){new Object();}'); |
| 128 } | 128 } |
| 129 | 129 |
| 130 testSimpleTopLevelClass() { |
| 131 final src = 'main(){new A();}class A{A(){}}'; |
| 132 testDart2Dart(src, (String s) => Expect.equals(src, s)); |
| 133 } |
| 134 |
| 130 main() { | 135 main() { |
| 131 testGenericTypes(); | 136 testGenericTypes(); |
| 132 testForLoop(); | 137 testForLoop(); |
| 133 testEmptyList(); | 138 testEmptyList(); |
| 134 testClosure(); | 139 testClosure(); |
| 135 testIndexedOperatorDecl(); | 140 testIndexedOperatorDecl(); |
| 136 testNativeMethods(); | 141 testNativeMethods(); |
| 137 testPrefixIncrements(); | 142 testPrefixIncrements(); |
| 138 testConstModifier(); | 143 testConstModifier(); |
| 139 testSimpleFileUnparse(); | 144 testSimpleFileUnparse(); |
| 140 testSimpleObjectInstantiation(); | 145 testSimpleObjectInstantiation(); |
| 146 testSimpleTopLevelClass(); |
| 141 testTopLevelField(); | 147 testTopLevelField(); |
| 142 } | 148 } |
| OLD | NEW |