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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 disableInlining: disableInlining, | 67 disableInlining: disableInlining, |
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.backend.enqueueHelpers(compiler.enqueuer.resolution); | 75 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution); |
76 compiler.processQueue(compiler.enqueuer.resolution, element); | 76 compiler.processQueue(compiler.enqueuer.resolution, element); |
77 compiler.openWorld.closeWorld(); | 77 compiler.openWorld.closeWorld(compiler.reporter); |
78 compiler.backend.onResolutionComplete(); | 78 compiler.backend.onResolutionComplete(); |
79 ResolutionWorkItem resolutionWork = new ResolutionWorkItem(element); | 79 ResolutionWorkItem resolutionWork = new ResolutionWorkItem(element); |
80 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 80 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
81 CodegenWorkItem work = new CodegenWorkItem(compiler, element); | 81 CodegenWorkItem work = new CodegenWorkItem(compiler, element); |
82 compiler.phase = Compiler.PHASE_COMPILING; | 82 compiler.phase = Compiler.PHASE_COMPILING; |
83 work.run(compiler, compiler.enqueuer.codegen); | 83 work.run(compiler, compiler.enqueuer.codegen); |
84 js.JavaScriptBackend backend = compiler.backend; | 84 js.JavaScriptBackend backend = compiler.backend; |
85 String generated = backend.getGeneratedCode(element); | 85 String generated = backend.getGeneratedCode(element); |
86 if (check != null) { | 86 if (check != null) { |
87 check(generated); | 87 check(generated); |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 280 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
281 final spaceRe = new RegExp('\\s+'); | 281 final spaceRe = new RegExp('\\s+'); |
282 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 282 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
283 if (shouldMatch) { | 283 if (shouldMatch) { |
284 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 284 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
285 } else { | 285 } else { |
286 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 286 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
287 } | 287 } |
288 }); | 288 }); |
289 } | 289 } |
OLD | NEW |