| 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:uri"); | 8 import "dart:uri"; |
| 9 | 9 |
| 10 #import("../../../lib/compiler/implementation/elements/elements.dart", prefix: "
lego"); | 10 import "../../../lib/compiler/implementation/elements/elements.dart" as lego; |
| 11 #import("../../../lib/compiler/implementation/js_backend/js_backend.dart", prefi
x: "js"); | 11 import "../../../lib/compiler/implementation/js_backend/js_backend.dart" as js; |
| 12 #import("../../../lib/compiler/implementation/leg.dart", prefix: "leg"); | 12 import "../../../lib/compiler/implementation/dart2jslib.dart" as leg; |
| 13 #import("../../../lib/compiler/implementation/ssa/ssa.dart", prefix: "ssa"); | 13 import "../../../lib/compiler/implementation/ssa/ssa.dart" as ssa; |
| 14 #import("../../../lib/compiler/implementation/util/util.dart"); | 14 import "../../../lib/compiler/implementation/util/util.dart"; |
| 15 #import('../../../lib/compiler/implementation/source_file.dart'); | 15 import '../../../lib/compiler/implementation/source_file.dart'; |
| 16 | 16 |
| 17 #import("mock_compiler.dart"); | 17 import "mock_compiler.dart"; |
| 18 #import("parser_helper.dart"); | 18 import "parser_helper.dart"; |
| 19 | 19 |
| 20 String compile(String code, {String entry: 'main', | 20 String compile(String code, {String entry: 'main', |
| 21 bool enableTypeAssertions: false, | 21 bool enableTypeAssertions: false, |
| 22 bool minify: false}) { | 22 bool minify: false}) { |
| 23 MockCompiler compiler = | 23 MockCompiler compiler = |
| 24 new MockCompiler(enableTypeAssertions: enableTypeAssertions, | 24 new MockCompiler(enableTypeAssertions: enableTypeAssertions, |
| 25 enableMinification: minify); | 25 enableMinification: minify); |
| 26 compiler.parseScript(code); | 26 compiler.parseScript(code); |
| 27 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); | 27 lego.Element element = compiler.mainApp.find(buildSourceString(entry)); |
| 28 if (element === null) return null; | 28 if (element === null) return null; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 114 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 115 final spaceRe = new RegExp('\\s+'); | 115 final spaceRe = new RegExp('\\s+'); |
| 116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 116 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 117 if (shouldMatch) { | 117 if (shouldMatch) { |
| 118 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 118 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 119 } else { | 119 } else { |
| 120 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 120 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 121 } | 121 } |
| 122 } | 122 } |
| 123 | 123 |
| OLD | NEW |