| 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'; |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 } | 124 } |
| 125 | 125 |
| 126 CompilationResult result = await runCompiler( | 126 CompilationResult result = await runCompiler( |
| 127 memorySourceFiles: source, | 127 memorySourceFiles: source, |
| 128 options: options, | 128 options: options, |
| 129 outputProvider: outputCollector); | 129 outputProvider: outputCollector); |
| 130 Expect.isTrue(result.isSuccess); | 130 Expect.isTrue(result.isSuccess); |
| 131 Compiler compiler = result.compiler; | 131 Compiler compiler = result.compiler; |
| 132 LibraryElement mainApp = | 132 LibraryElement mainApp = |
| 133 compiler.frontendStrategy.elementEnvironment.mainLibrary; | 133 compiler.frontendStrategy.elementEnvironment.mainLibrary; |
| 134 Element element = mainApp.find(entry); | 134 MemberElement element = mainApp.find(entry); |
| 135 js.JavaScriptBackend backend = compiler.backend; | 135 js.JavaScriptBackend backend = compiler.backend; |
| 136 String generated = backend.getGeneratedCode(element); | 136 String generated = backend.getGeneratedCode(element); |
| 137 if (check != null) { | 137 if (check != null) { |
| 138 check(generated); | 138 check(generated); |
| 139 } | 139 } |
| 140 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; | 140 return returnAll ? outputCollector.getOutput('', OutputType.js) : generated; |
| 141 } | 141 } |
| 142 } | 142 } |
| 143 | 143 |
| 144 Future<String> compileAll(String code, | 144 Future<String> compileAll(String code, |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 } | 301 } |
| 302 } | 302 } |
| 303 } | 303 } |
| 304 | 304 |
| 305 return checker; | 305 return checker; |
| 306 } | 306 } |
| 307 | 307 |
| 308 RegExp _directivePattern = new RegExp( | 308 RegExp _directivePattern = new RegExp( |
| 309 // \1 \2 \3 | 309 // \1 \2 \3 |
| 310 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', multiLine: true); | 310 r'''// *(present|absent): *(?:"([^"]*)"|'([^'']*)')''', multiLine: true); |
| OLD | NEW |