| 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; |
| 11 | 11 |
| 12 import 'package:compiler/src/elements/elements.dart' | 12 import 'package:compiler/src/elements/elements.dart' |
| 13 as lego; | 13 as lego; |
| 14 export 'package:compiler/src/elements/elements.dart'; | 14 export 'package:compiler/src/elements/elements.dart'; |
| 15 | 15 |
| 16 import 'package:compiler/src/js_backend/js_backend.dart' | 16 import 'package:compiler/src/js_backend/js_backend.dart' |
| 17 as js; | 17 as js; |
| 18 | 18 |
| 19 import 'package:compiler/src/dart2jslib.dart' | 19 import 'package:compiler/src/common/codegen.dart'; |
| 20 as leg; | 20 import 'package:compiler/src/common/resolution.dart'; |
| 21 export 'package:compiler/src/dart2jslib.dart' | |
| 22 show Selector, | |
| 23 SourceSpan; | |
| 24 | 21 |
| 25 export 'package:compiler/src/messages.dart' | 22 export 'package:compiler/src/diagnostics/source_span.dart'; |
| 26 show Message, | 23 export 'package:compiler/src/diagnostics/spannable.dart'; |
| 27 MessageKind, | 24 export 'package:compiler/src/messages.dart'; |
| 28 MessageTemplate; | |
| 29 | 25 |
| 30 import 'package:compiler/src/types/types.dart' | 26 import 'package:compiler/src/types/types.dart' |
| 31 as types; | 27 as types; |
| 32 export 'package:compiler/src/types/types.dart' | 28 export 'package:compiler/src/types/types.dart' |
| 33 show TypeMask; | 29 show TypeMask; |
| 34 | 30 |
| 35 import 'package:compiler/src/util/util.dart'; | 31 import 'package:compiler/src/util/util.dart'; |
| 36 export 'package:compiler/src/util/util.dart'; | 32 export 'package:compiler/src/util/util.dart'; |
| 37 | 33 |
| 38 import 'package:compiler/src/dart2jslib.dart' | 34 import 'package:compiler/src/compiler.dart' |
| 39 show Compiler; | 35 show Compiler; |
| 40 | 36 |
| 41 export 'package:compiler/src/tree/tree.dart'; | 37 export 'package:compiler/src/tree/tree.dart'; |
| 42 | 38 |
| 43 import 'mock_compiler.dart'; | 39 import 'mock_compiler.dart'; |
| 44 export 'mock_compiler.dart'; | 40 export 'mock_compiler.dart'; |
| 45 | 41 |
| 46 import 'output_collector.dart'; | 42 import 'output_collector.dart'; |
| 47 export 'output_collector.dart'; | 43 export 'output_collector.dart'; |
| 48 | 44 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 64 compiler.parseScript(code); | 60 compiler.parseScript(code); |
| 65 lego.Element element = compiler.mainApp.find(entry); | 61 lego.Element element = compiler.mainApp.find(entry); |
| 66 if (element == null) return null; | 62 if (element == null) return null; |
| 67 compiler.phase = Compiler.PHASE_RESOLVING; | 63 compiler.phase = Compiler.PHASE_RESOLVING; |
| 68 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, | 64 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, |
| 69 compiler.globalDependencies); | 65 compiler.globalDependencies); |
| 70 compiler.processQueue(compiler.enqueuer.resolution, element); | 66 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 71 compiler.world.populate(); | 67 compiler.world.populate(); |
| 72 compiler.backend.onResolutionComplete(); | 68 compiler.backend.onResolutionComplete(); |
| 73 var context = new js.JavaScriptItemCompilationContext(); | 69 var context = new js.JavaScriptItemCompilationContext(); |
| 74 leg.ResolutionWorkItem resolutionWork = | 70 ResolutionWorkItem resolutionWork = |
| 75 new leg.ResolutionWorkItem(element, context); | 71 new ResolutionWorkItem(element, context); |
| 76 resolutionWork.run(compiler, compiler.enqueuer.resolution); | 72 resolutionWork.run(compiler, compiler.enqueuer.resolution); |
| 77 leg.CodegenWorkItem work = | 73 CodegenWorkItem work = |
| 78 new leg.CodegenWorkItem(compiler, element, context); | 74 new CodegenWorkItem(compiler, element, context); |
| 79 compiler.phase = Compiler.PHASE_COMPILING; | 75 compiler.phase = Compiler.PHASE_COMPILING; |
| 80 work.run(compiler, compiler.enqueuer.codegen); | 76 work.run(compiler, compiler.enqueuer.codegen); |
| 81 js.JavaScriptBackend backend = compiler.backend; | 77 js.JavaScriptBackend backend = compiler.backend; |
| 82 String generated = backend.assembleCode(element); | 78 String generated = backend.assembleCode(element); |
| 83 if (check != null) { | 79 if (check != null) { |
| 84 check(generated); | 80 check(generated); |
| 85 } | 81 } |
| 86 return generated; | 82 return generated; |
| 87 }); | 83 }); |
| 88 } | 84 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 258 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
| 263 final spaceRe = new RegExp('\\s+'); | 259 final spaceRe = new RegExp('\\s+'); |
| 264 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 260 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
| 265 if (shouldMatch) { | 261 if (shouldMatch) { |
| 266 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 262 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
| 267 } else { | 263 } else { |
| 268 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 264 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
| 269 } | 265 } |
| 270 }); | 266 }); |
| 271 } | 267 } |
| OLD | NEW |