| 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 "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t' | 10 import '../../../sdk/lib/_internal/compiler/implementation/elements/elements.dar
t' |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 compiler.phase = Compiler.PHASE_RESOLVING; | 64 compiler.phase = Compiler.PHASE_RESOLVING; |
| 65 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, | 65 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, |
| 66 compiler.globalDependencies); | 66 compiler.globalDependencies); |
| 67 compiler.processQueue(compiler.enqueuer.resolution, element); | 67 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 68 compiler.world.populate(); | 68 compiler.world.populate(); |
| 69 var context = new js.JavaScriptItemCompilationContext(); | 69 var context = new js.JavaScriptItemCompilationContext(); |
| 70 leg.ResolutionWorkItem resolutionWork = | 70 leg.ResolutionWorkItem resolutionWork = |
| 71 new leg.ResolutionWorkItem(element, context); | 71 new leg.ResolutionWorkItem(element, context); |
| 72 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 72 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
| 73 leg.CodegenWorkItem work = | 73 leg.CodegenWorkItem work = |
| 74 new leg.CodegenWorkItem(element, resolutionWork.resolutionTree, context); | 74 new leg.CodegenWorkItem(element, context); |
| 75 compiler.phase = Compiler.PHASE_COMPILING; | 75 compiler.phase = Compiler.PHASE_COMPILING; |
| 76 work.run(compiler, compiler.enqueuer.codegen); | 76 work.run(compiler, compiler.enqueuer.codegen); |
| 77 js.JavaScriptBackend backend = compiler.backend; | 77 js.JavaScriptBackend backend = compiler.backend; |
| 78 return backend.assembleCode(element); | 78 return backend.assembleCode(element); |
| 79 } | 79 } |
| 80 | 80 |
| 81 MockCompiler compilerFor(String code, Uri uri, | 81 MockCompiler compilerFor(String code, Uri uri, |
| 82 {bool analyzeAll: false, | 82 {bool analyzeAll: false, |
| 83 bool analyzeOnly: false, | 83 bool analyzeOnly: false, |
| 84 String coreSource: DEFAULT_CORELIB}) { | 84 String coreSource: DEFAULT_CORELIB}) { |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 final xRe = new RegExp('\\bx\\b'); | 209 final xRe = new RegExp('\\bx\\b'); |
| 210 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 210 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 211 final spaceRe = new RegExp('\\s+'); | 211 final spaceRe = new RegExp('\\s+'); |
| 212 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 212 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 213 if (shouldMatch) { | 213 if (shouldMatch) { |
| 214 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 214 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 215 } else { | 215 } else { |
| 216 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 216 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 217 } | 217 } |
| 218 } | 218 } |
| OLD | NEW |