| 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_new.dart'; | 10 import 'package:compiler/compiler_new.dart'; |
| 11 | 11 |
| 12 import 'package:compiler/src/elements/elements.dart'; | 12 import 'package:compiler/src/elements/elements.dart'; |
| 13 export 'package:compiler/src/elements/elements.dart'; | 13 export 'package:compiler/src/elements/elements.dart'; |
| 14 | 14 |
| 15 import 'package:compiler/src/js_backend/js_backend.dart' as js; | 15 import 'package:compiler/src/js_backend/js_backend.dart' as js; |
| 16 | 16 |
| 17 import 'package:compiler/src/commandline_options.dart'; | 17 import 'package:compiler/src/commandline_options.dart'; |
| 18 import 'package:compiler/src/common/codegen.dart'; | 18 import 'package:compiler/src/common/codegen.dart'; |
| 19 import 'package:compiler/src/common/resolution.dart'; | 19 import 'package:compiler/src/common/resolution.dart'; |
| 20 | 20 |
| 21 export 'package:compiler/src/diagnostics/messages.dart'; | 21 export 'package:compiler/src/diagnostics/messages.dart'; |
| 22 export 'package:compiler/src/diagnostics/source_span.dart'; | 22 export 'package:compiler/src/diagnostics/source_span.dart'; |
| 23 export 'package:compiler/src/diagnostics/spannable.dart'; | 23 export 'package:compiler/src/diagnostics/spannable.dart'; |
| 24 | 24 |
| 25 export 'package:compiler/src/types/types.dart' show TypeMask; | 25 export 'package:compiler/src/types/types.dart' show TypeMask; |
| 26 | 26 |
| 27 import 'package:compiler/src/util/util.dart'; | 27 import 'package:compiler/src/util/util.dart'; |
| 28 export 'package:compiler/src/util/util.dart'; | 28 export 'package:compiler/src/util/util.dart'; |
| 29 | 29 |
| 30 import 'package:compiler/src/world.dart'; |
| 31 |
| 30 import 'package:compiler/src/compiler.dart' show Compiler; | 32 import 'package:compiler/src/compiler.dart' show Compiler; |
| 31 | 33 |
| 32 export 'package:compiler/src/tree/tree.dart'; | 34 export 'package:compiler/src/tree/tree.dart'; |
| 33 | 35 |
| 34 import 'mock_compiler.dart'; | 36 import 'mock_compiler.dart'; |
| 35 export 'mock_compiler.dart'; | 37 export 'mock_compiler.dart'; |
| 36 | 38 |
| 37 import 'memory_compiler.dart' hide compilerFor; | 39 import 'memory_compiler.dart' hide compilerFor; |
| 38 | 40 |
| 39 import 'output_collector.dart'; | 41 import 'output_collector.dart'; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 compiler.parseScript(code); | 74 compiler.parseScript(code); |
| 73 LibraryElement mainApp = compiler.mainApp; | 75 LibraryElement mainApp = compiler.mainApp; |
| 74 MethodElement element = mainApp.find(entry); | 76 MethodElement element = mainApp.find(entry); |
| 75 if (element == null) return null; | 77 if (element == null) return null; |
| 76 compiler.phase = Compiler.PHASE_RESOLVING; | 78 compiler.phase = Compiler.PHASE_RESOLVING; |
| 77 compiler.processQueue(compiler.enqueuer.resolution, element, | 79 compiler.processQueue(compiler.enqueuer.resolution, element, |
| 78 compiler.libraryLoader.libraries); | 80 compiler.libraryLoader.libraries); |
| 79 ResolutionWorkItem resolutionWork = | 81 ResolutionWorkItem resolutionWork = |
| 80 new ResolutionWorkItem(compiler.resolution, element); | 82 new ResolutionWorkItem(compiler.resolution, element); |
| 81 resolutionWork.run(); | 83 resolutionWork.run(); |
| 82 compiler.closeResolution(); | 84 ClosedWorld closedWorld = compiler.closeResolution().closedWorld; |
| 83 CodegenWorkItem work = new CodegenWorkItem(compiler.backend, element); | 85 CodegenWorkItem work = |
| 86 new CodegenWorkItem(compiler.backend, closedWorld, element); |
| 84 compiler.phase = Compiler.PHASE_COMPILING; | 87 compiler.phase = Compiler.PHASE_COMPILING; |
| 85 work.run(); | 88 work.run(); |
| 86 js.JavaScriptBackend backend = compiler.backend; | 89 js.JavaScriptBackend backend = compiler.backend; |
| 87 String generated = backend.getGeneratedCode(element); | 90 String generated = backend.getGeneratedCode(element); |
| 88 if (check != null) { | 91 if (check != null) { |
| 89 check(generated); | 92 check(generated); |
| 90 } | 93 } |
| 91 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; | 94 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; |
| 92 } else { | 95 } else { |
| 93 List<String> options = <String>[Flags.disableTypeInference]; | 96 List<String> options = <String>[Flags.disableTypeInference]; |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 } | 296 } |
| 294 } | 297 } |
| 295 | 298 |
| 296 return checker; | 299 return checker; |
| 297 } | 300 } |
| 298 | 301 |
| 299 RegExp _directivePattern = new RegExp( | 302 RegExp _directivePattern = new RegExp( |
| 300 // \1 \2 \3 | 303 // \1 \2 \3 |
| 301 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', | 304 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', |
| 302 multiLine: true); | 305 multiLine: true); |
| OLD | NEW |