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 // Test constant folding. | 4 // Test constant folding. |
5 | 5 |
6 library compiler_helper; | 6 library compiler_helper; |
7 | 7 |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import "package:expect/expect.dart"; | 9 import "package:expect/expect.dart"; |
10 | 10 |
11 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t' | 11 import 'package:compiler/implementation/elements/elements.dart' |
12 as lego; | 12 as lego; |
13 export '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t'; | 13 export 'package:compiler/implementation/elements/elements.dart'; |
14 | 14 |
15 import '../../../sdk/lib/_internal/compiler/implementation/js_backend/js_backend
.dart' | 15 import 'package:compiler/implementation/js_backend/js_backend.dart' |
16 as js; | 16 as js; |
17 | 17 |
18 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 18 import 'package:compiler/implementation/dart2jslib.dart' |
19 as leg; | 19 as leg; |
20 export '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 20 export 'package:compiler/implementation/dart2jslib.dart' |
21 show Constant, | 21 show Constant, |
22 Message, | 22 Message, |
23 MessageKind, | 23 MessageKind, |
24 Selector, | 24 Selector, |
25 TypedSelector, | 25 TypedSelector, |
26 SourceSpan; | 26 SourceSpan; |
27 | 27 |
28 import '../../../sdk/lib/_internal/compiler/implementation/ssa/ssa.dart' as ssa; | 28 import 'package:compiler/implementation/ssa/ssa.dart' as ssa; |
29 | 29 |
30 import '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' | 30 import 'package:compiler/implementation/types/types.dart' |
31 as types; | 31 as types; |
32 export '../../../sdk/lib/_internal/compiler/implementation/types/types.dart' | 32 export 'package:compiler/implementation/types/types.dart' |
33 show TypeMask; | 33 show TypeMask; |
34 | 34 |
35 import '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; | 35 import 'package:compiler/implementation/util/util.dart'; |
36 export '../../../sdk/lib/_internal/compiler/implementation/util/util.dart'; | 36 export 'package:compiler/implementation/util/util.dart'; |
37 | 37 |
38 import '../../../sdk/lib/_internal/compiler/implementation/source_file.dart'; | 38 import 'package:compiler/implementation/source_file.dart'; |
39 | 39 |
40 import '../../../sdk/lib/_internal/compiler/implementation/dart2jslib.dart' | 40 import 'package:compiler/implementation/dart2jslib.dart' |
41 show Compiler; | 41 show Compiler; |
42 | 42 |
43 export '../../../sdk/lib/_internal/compiler/implementation/tree/tree.dart'; | 43 export 'package:compiler/implementation/tree/tree.dart'; |
44 | 44 |
45 import 'mock_compiler.dart'; | 45 import 'mock_compiler.dart'; |
46 export 'mock_compiler.dart'; | 46 export 'mock_compiler.dart'; |
47 | 47 |
48 Future<String> compile(String code, | 48 Future<String> compile(String code, |
49 {String entry: 'main', | 49 {String entry: 'main', |
50 String coreSource: DEFAULT_CORELIB, | 50 String coreSource: DEFAULT_CORELIB, |
51 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, | 51 String interceptorsSource: DEFAULT_INTERCEPTORSLIB, |
52 bool enableTypeAssertions: false, | 52 bool enableTypeAssertions: false, |
53 bool minify: false, | 53 bool minify: false, |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 240 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
241 final spaceRe = new RegExp('\\s+'); | 241 final spaceRe = new RegExp('\\s+'); |
242 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 242 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
243 if (shouldMatch) { | 243 if (shouldMatch) { |
244 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 244 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
245 } else { | 245 } else { |
246 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 246 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
247 } | 247 } |
248 }); | 248 }); |
249 } | 249 } |
OLD | NEW |