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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 compiler.backend.onResolutionComplete(); |
73 var context = new js.JavaScriptItemCompilationContext(); | 73 var context = new js.JavaScriptItemCompilationContext(); |
74 leg.ResolutionWorkItem resolutionWork = | 74 leg.ResolutionWorkItem resolutionWork = |
75 new leg.ResolutionWorkItem(element, context); | 75 new leg.ResolutionWorkItem(element, context); |
76 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 76 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
77 leg.CodegenWorkItem work = | 77 leg.CodegenWorkItem work = |
78 new leg.CodegenWorkItem(element, context); | 78 new leg.CodegenWorkItem(compiler, element, context); |
79 compiler.phase = Compiler.PHASE_COMPILING; | 79 compiler.phase = Compiler.PHASE_COMPILING; |
80 work.run(compiler, compiler.enqueuer.codegen); | 80 work.run(compiler, compiler.enqueuer.codegen); |
81 js.JavaScriptBackend backend = compiler.backend; | 81 js.JavaScriptBackend backend = compiler.backend; |
82 String generated = backend.assembleCode(element); | 82 String generated = backend.assembleCode(element); |
83 if (check != null) { | 83 if (check != null) { |
84 check(generated); | 84 check(generated); |
85 } | 85 } |
86 return generated; | 86 return generated; |
87 }); | 87 }); |
88 } | 88 } |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 259 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
260 final spaceRe = new RegExp('\\s+'); | 260 final spaceRe = new RegExp('\\s+'); |
261 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 261 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
262 if (shouldMatch) { | 262 if (shouldMatch) { |
263 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 263 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
264 } else { | 264 } else { |
265 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 265 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
266 } | 266 } |
267 }); | 267 }); |
268 } | 268 } |
OLD | NEW |