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 import 'package:compiler/src/js_backend/element_strategy.dart' |
| 17 show ElementCodegenWorkItem; |
16 | 18 |
17 import 'package:compiler/src/commandline_options.dart'; | 19 import 'package:compiler/src/commandline_options.dart'; |
18 import 'package:compiler/src/common/codegen.dart'; | 20 import 'package:compiler/src/common/codegen.dart'; |
19 import 'package:compiler/src/common/resolution.dart'; | 21 import 'package:compiler/src/common/resolution.dart'; |
20 | 22 |
21 export 'package:compiler/src/diagnostics/messages.dart'; | 23 export 'package:compiler/src/diagnostics/messages.dart'; |
22 export 'package:compiler/src/diagnostics/source_span.dart'; | 24 export 'package:compiler/src/diagnostics/source_span.dart'; |
23 export 'package:compiler/src/diagnostics/spannable.dart'; | 25 export 'package:compiler/src/diagnostics/spannable.dart'; |
24 | 26 |
25 export 'package:compiler/src/types/types.dart' show TypeMask; | 27 export 'package:compiler/src/types/types.dart' show TypeMask; |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 MethodElement element = mainApp.find(entry); | 78 MethodElement element = mainApp.find(entry); |
77 if (element == null) return null; | 79 if (element == null) return null; |
78 compiler.phase = Compiler.PHASE_RESOLVING; | 80 compiler.phase = Compiler.PHASE_RESOLVING; |
79 compiler.processQueue(compiler.enqueuer.resolution, element, | 81 compiler.processQueue(compiler.enqueuer.resolution, element, |
80 compiler.libraryLoader.libraries); | 82 compiler.libraryLoader.libraries); |
81 ResolutionWorkItem resolutionWork = | 83 ResolutionWorkItem resolutionWork = |
82 new ResolutionWorkItem(compiler.resolution, element); | 84 new ResolutionWorkItem(compiler.resolution, element); |
83 resolutionWork.run(); | 85 resolutionWork.run(); |
84 ClosedWorld closedWorld = compiler.closeResolution().closedWorld; | 86 ClosedWorld closedWorld = compiler.closeResolution().closedWorld; |
85 CodegenWorkItem work = | 87 CodegenWorkItem work = |
86 new CodegenWorkItem(compiler.backend, closedWorld, element); | 88 new ElementCodegenWorkItem(compiler.backend, closedWorld, element); |
87 compiler.phase = Compiler.PHASE_COMPILING; | 89 compiler.phase = Compiler.PHASE_COMPILING; |
88 work.run(); | 90 work.run(); |
89 js.JavaScriptBackend backend = compiler.backend; | 91 js.JavaScriptBackend backend = compiler.backend; |
90 String generated = backend.getGeneratedCode(element); | 92 String generated = backend.getGeneratedCode(element); |
91 if (check != null) { | 93 if (check != null) { |
92 check(generated); | 94 check(generated); |
93 } | 95 } |
94 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; | 96 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; |
95 } else { | 97 } else { |
96 List<String> options = <String>[Flags.disableTypeInference]; | 98 List<String> options = <String>[Flags.disableTypeInference]; |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 } | 298 } |
297 } | 299 } |
298 | 300 |
299 return checker; | 301 return checker; |
300 } | 302 } |
301 | 303 |
302 RegExp _directivePattern = new RegExp( | 304 RegExp _directivePattern = new RegExp( |
303 // \1 \2 \3 | 305 // \1 \2 \3 |
304 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', | 306 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', |
305 multiLine: true); | 307 multiLine: true); |
OLD | NEW |