| 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/src/elements/elements.dart' | 10 import 'package:compiler/src/elements/elements.dart' |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 73 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
| 74 outputProvider: outputCollector); | 74 outputProvider: outputCollector); |
| 75 await compiler.init(); | 75 await compiler.init(); |
| 76 compiler.parseScript(code); | 76 compiler.parseScript(code); |
| 77 lego.Element element = compiler.mainApp.find(entry); | 77 lego.Element element = compiler.mainApp.find(entry); |
| 78 if (element == null) return null; | 78 if (element == null) return null; |
| 79 compiler.phase = Compiler.PHASE_RESOLVING; | 79 compiler.phase = Compiler.PHASE_RESOLVING; |
| 80 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, | 80 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, |
| 81 compiler.globalDependencies); | 81 compiler.globalDependencies); |
| 82 compiler.processQueue(compiler.enqueuer.resolution, element); | 82 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 83 compiler.openWorld.populate(); | 83 compiler.openWorld.closeWorld(); |
| 84 compiler.backend.onResolutionComplete(); | 84 compiler.backend.onResolutionComplete(); |
| 85 ResolutionWorkItem resolutionWork = new ResolutionWorkItem(element); | 85 ResolutionWorkItem resolutionWork = new ResolutionWorkItem(element); |
| 86 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 86 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
| 87 CodegenWorkItem work = new CodegenWorkItem(compiler, element); | 87 CodegenWorkItem work = new CodegenWorkItem(compiler, element); |
| 88 compiler.phase = Compiler.PHASE_COMPILING; | 88 compiler.phase = Compiler.PHASE_COMPILING; |
| 89 work.run(compiler, compiler.enqueuer.codegen); | 89 work.run(compiler, compiler.enqueuer.codegen); |
| 90 js.JavaScriptBackend backend = compiler.backend; | 90 js.JavaScriptBackend backend = compiler.backend; |
| 91 String generated = backend.getGeneratedCode(element); | 91 String generated = backend.getGeneratedCode(element); |
| 92 if (check != null) { | 92 if (check != null) { |
| 93 check(generated); | 93 check(generated); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 287 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 288 final spaceRe = new RegExp('\\s+'); | 288 final spaceRe = new RegExp('\\s+'); |
| 289 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 289 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 290 if (shouldMatch) { | 290 if (shouldMatch) { |
| 291 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 291 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 292 } else { | 292 } else { |
| 293 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 293 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 294 } | 294 } |
| 295 }); | 295 }); |
| 296 } | 296 } |
| OLD | NEW |