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 import 'package:expect/expect.dart'; | 5 import 'package:expect/expect.dart'; |
6 import "package:async_helper/async_helper.dart"; | 6 import "package:async_helper/async_helper.dart"; |
7 import 'package:compiler/src/types/types.dart' | 7 import 'package:compiler/src/types/types.dart' |
8 show ContainerTypeMask, TypeMask; | 8 show ContainerTypeMask, TypeMask; |
9 | 9 |
10 import 'compiler_helper.dart'; | 10 import 'compiler_helper.dart'; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 doTest(initial: true); | 47 doTest(initial: true); |
48 doTest(key: "aList", bail: true, initial: true); | 48 doTest(key: "aList", bail: true, initial: true); |
49 doTest(value: "aList", initial: true); | 49 doTest(value: "aList", initial: true); |
50 } | 50 } |
51 | 51 |
52 void doTest({String key: "'d'", String value: "5.5", bool bail: false, | 52 void doTest({String key: "'d'", String value: "5.5", bool bail: false, |
53 bool initial: false}) { | 53 bool initial: false}) { |
54 Uri uri = new Uri(scheme: 'source'); | 54 Uri uri = new Uri(scheme: 'source'); |
55 var compiler = compilerFor(generateTest(key, value, initial), uri, | 55 var compiler = compilerFor(generateTest(key, value, initial), uri, |
56 expectedErrors: 0, expectedWarnings: 0); | 56 expectedErrors: 0, expectedWarnings: 0); |
57 asyncTest(() => compiler.runCompiler(uri).then((_) { | 57 asyncTest(() => compiler.run(uri).then((_) { |
58 var typesTask = compiler.typesTask; | 58 var typesTask = compiler.typesTask; |
59 var typesInferrer = typesTask.typesInferrer; | 59 var typesInferrer = typesTask.typesInferrer; |
60 var aDoubleType = | 60 var aDoubleType = |
61 typesInferrer.getTypeOfElement(findElement(compiler, 'aDouble')); | 61 typesInferrer.getTypeOfElement(findElement(compiler, 'aDouble')); |
62 var aListType = | 62 var aListType = |
63 typesInferrer.getTypeOfElement(findElement(compiler, 'aList')); | 63 typesInferrer.getTypeOfElement(findElement(compiler, 'aList')); |
64 | 64 |
65 Expect.equals(aDoubleType, typesTask.doubleType); | 65 Expect.equals(aDoubleType, typesTask.doubleType); |
66 Expect.isTrue(aListType is ContainerTypeMask); | 66 Expect.isTrue(aListType is ContainerTypeMask); |
67 ContainerTypeMask container = aListType; | 67 ContainerTypeMask container = aListType; |
68 TypeMask elementType = container.elementType; | 68 TypeMask elementType = container.elementType; |
69 if (bail) { | 69 if (bail) { |
70 Expect.equals(elementType, typesTask.dynamicType); | 70 Expect.equals(elementType, typesTask.dynamicType); |
71 } else { | 71 } else { |
72 Expect.equals(elementType, typesTask.uint31Type); | 72 Expect.equals(elementType, typesTask.uint31Type); |
73 } | 73 } |
74 })); | 74 })); |
75 } | 75 } |
OLD | NEW |