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:async'; | 5 import 'dart:async'; |
6 import 'dart:collection'; | 6 import 'dart:collection'; |
7 | 7 |
8 import 'package:async_helper/async_helper.dart'; | 8 import 'package:async_helper/async_helper.dart'; |
9 import 'package:expect/expect.dart'; | 9 import 'package:expect/expect.dart'; |
10 import 'package:compiler/src/constants/expressions.dart'; | 10 import 'package:compiler/src/constants/expressions.dart'; |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1062 return Future.forEach(testedConstants.keys, (String constant) { | 1062 return Future.forEach(testedConstants.keys, (String constant) { |
1063 return MockCompiler.create((MockCompiler compiler) { | 1063 return MockCompiler.create((MockCompiler compiler) { |
1064 CollectingTreeElements elements = | 1064 CollectingTreeElements elements = |
1065 compiler.resolveStatement("main() => $constant;"); | 1065 compiler.resolveStatement("main() => $constant;"); |
1066 List<String> expectedConstants = testedConstants[constant]; | 1066 List<String> expectedConstants = testedConstants[constant]; |
1067 DiagnosticCollector collector = compiler.diagnosticCollector; | 1067 DiagnosticCollector collector = compiler.diagnosticCollector; |
1068 Expect.equals(0, collector.warnings.length); | 1068 Expect.equals(0, collector.warnings.length); |
1069 Expect.equals(0, collector.errors.length); | 1069 Expect.equals(0, collector.errors.length); |
1070 List<ConstantExpression> constants = elements.constants; | 1070 List<ConstantExpression> constants = elements.constants; |
1071 String constantsText = | 1071 String constantsText = |
1072 '[${constants.map((c) => c.getText()).join(', ')}]'; | 1072 '[${constants.map((c) => c.toDartText()).join(', ')}]'; |
1073 Expect.equals(expectedConstants.length, constants.length, | 1073 Expect.equals(expectedConstants.length, constants.length, |
1074 "Expected ${expectedConstants.length} constants for `${constant}` " | 1074 "Expected ${expectedConstants.length} constants for `${constant}` " |
1075 "found $constantsText."); | 1075 "found $constantsText."); |
1076 for (int index = 0; index < expectedConstants.length; index++) { | 1076 for (int index = 0; index < expectedConstants.length; index++) { |
1077 Expect.equals(expectedConstants[index], constants[index].getText(), | 1077 Expect.equals(expectedConstants[index], constants[index].toDartText(), |
1078 "Expected ${expectedConstants} for `$constant`, " | 1078 "Expected ${expectedConstants} for `$constant`, " |
1079 "found $constantsText."); | 1079 "found $constantsText."); |
1080 } | 1080 } |
1081 }); | 1081 }); |
1082 }); | 1082 }); |
1083 } | 1083 } |
1084 | 1084 |
1085 map(ResolverVisitor visitor) { | 1085 map(ResolverVisitor visitor) { |
1086 CollectingTreeElements elements = visitor.registry.mapping; | 1086 CollectingTreeElements elements = visitor.registry.mapping; |
1087 return elements.map; | 1087 return elements.map; |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1441 } | 1441 } |
1442 main() => A.m(); | 1442 main() => A.m(); |
1443 ''', functionName: 'm'); | 1443 ''', functionName: 'm'); |
1444 check(''' | 1444 check(''' |
1445 class A { | 1445 class A { |
1446 m() => () => await - 3; | 1446 m() => () => await - 3; |
1447 } | 1447 } |
1448 main() => new A().m(); | 1448 main() => new A().m(); |
1449 ''', className: 'A'); | 1449 ''', className: 'A'); |
1450 } | 1450 } |
OLD | NEW |