| 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 library compiler_helper; | 5 library compiler_helper; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
| 9 | 9 |
| 10 import 'package:compiler/compiler.dart' as api; | 10 import 'package:compiler/compiler.dart' as api; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 disableInlining: disableInlining); | 62 disableInlining: disableInlining); |
| 63 return compiler.init().then((_) { | 63 return compiler.init().then((_) { |
| 64 compiler.parseScript(code); | 64 compiler.parseScript(code); |
| 65 lego.Element element = compiler.mainApp.find(entry); | 65 lego.Element element = compiler.mainApp.find(entry); |
| 66 if (element == null) return null; | 66 if (element == null) return null; |
| 67 compiler.phase = Compiler.PHASE_RESOLVING; | 67 compiler.phase = Compiler.PHASE_RESOLVING; |
| 68 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, | 68 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, |
| 69 compiler.globalDependencies); | 69 compiler.globalDependencies); |
| 70 compiler.processQueue(compiler.enqueuer.resolution, element); | 70 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 71 compiler.world.populate(); | 71 compiler.world.populate(); |
| 72 compiler.backend.onResolutionComplete(); |
| 72 var context = new js.JavaScriptItemCompilationContext(); | 73 var context = new js.JavaScriptItemCompilationContext(); |
| 73 leg.ResolutionWorkItem resolutionWork = | 74 leg.ResolutionWorkItem resolutionWork = |
| 74 new leg.ResolutionWorkItem(element, context); | 75 new leg.ResolutionWorkItem(element, context); |
| 75 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 76 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
| 76 leg.CodegenWorkItem work = | 77 leg.CodegenWorkItem work = |
| 77 new leg.CodegenWorkItem(element, context); | 78 new leg.CodegenWorkItem(element, context); |
| 78 compiler.phase = Compiler.PHASE_COMPILING; | 79 compiler.phase = Compiler.PHASE_COMPILING; |
| 79 work.run(compiler, compiler.enqueuer.codegen); | 80 work.run(compiler, compiler.enqueuer.codegen); |
| 80 js.JavaScriptBackend backend = compiler.backend; | 81 js.JavaScriptBackend backend = compiler.backend; |
| 81 String generated = backend.assembleCode(element); | 82 String generated = backend.assembleCode(element); |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 258 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 258 final spaceRe = new RegExp('\\s+'); | 259 final spaceRe = new RegExp('\\s+'); |
| 259 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 260 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 260 if (shouldMatch) { | 261 if (shouldMatch) { |
| 261 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 262 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 262 } else { | 263 } else { |
| 263 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 264 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 264 } | 265 } |
| 265 }); | 266 }); |
| 266 } | 267 } |
| OLD | NEW |