| 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' as lego; | 10 import 'package:compiler/src/elements/elements.dart' as lego; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, | 68 trustJSInteropTypeAnnotations: trustJSInteropTypeAnnotations, |
| 69 outputProvider: outputCollector); | 69 outputProvider: outputCollector); |
| 70 await compiler.init(); | 70 await compiler.init(); |
| 71 compiler.parseScript(code); | 71 compiler.parseScript(code); |
| 72 lego.Element element = compiler.mainApp.find(entry); | 72 lego.Element element = compiler.mainApp.find(entry); |
| 73 if (element == null) return null; | 73 if (element == null) return null; |
| 74 compiler.phase = Compiler.PHASE_RESOLVING; | 74 compiler.phase = Compiler.PHASE_RESOLVING; |
| 75 compiler.enqueuer.resolution | 75 compiler.enqueuer.resolution |
| 76 .applyImpact(compiler.backend.computeHelpersImpact()); | 76 .applyImpact(compiler.backend.computeHelpersImpact()); |
| 77 compiler.processQueue(compiler.enqueuer.resolution, element); | 77 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 78 compiler.openWorld.closeWorld(compiler.reporter); | |
| 79 compiler.backend.onResolutionComplete(); | |
| 80 ResolutionWorkItem resolutionWork = | 78 ResolutionWorkItem resolutionWork = |
| 81 new ResolutionWorkItem(compiler.resolution, element); | 79 new ResolutionWorkItem(compiler.resolution, element); |
| 82 resolutionWork.run(); | 80 resolutionWork.run(); |
| 81 compiler.closeResolution(); |
| 83 CodegenWorkItem work = new CodegenWorkItem(compiler.backend, element); | 82 CodegenWorkItem work = new CodegenWorkItem(compiler.backend, element); |
| 84 compiler.phase = Compiler.PHASE_COMPILING; | 83 compiler.phase = Compiler.PHASE_COMPILING; |
| 85 work.run(); | 84 work.run(); |
| 86 js.JavaScriptBackend backend = compiler.backend; | 85 js.JavaScriptBackend backend = compiler.backend; |
| 87 String generated = backend.getGeneratedCode(element); | 86 String generated = backend.getGeneratedCode(element); |
| 88 if (check != null) { | 87 if (check != null) { |
| 89 check(generated); | 88 check(generated); |
| 90 } | 89 } |
| 91 return returnAll ? outputCollector.getOutput('', 'js') : generated; | 90 return returnAll ? outputCollector.getOutput('', 'js') : generated; |
| 92 } else { | 91 } else { |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 281 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 283 final spaceRe = new RegExp('\\s+'); | 282 final spaceRe = new RegExp('\\s+'); |
| 284 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 283 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 285 if (shouldMatch) { | 284 if (shouldMatch) { |
| 286 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 285 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 287 } else { | 286 } else { |
| 288 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 287 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 289 } | 288 } |
| 290 }); | 289 }); |
| 291 } | 290 } |
| OLD | NEW |