| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.test.message_kind_helper; | 5 library dart2js.test.message_kind_helper; |
| 6 | 6 |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'dart:async'; | 8 import 'dart:async'; |
| 9 | 9 |
| 10 import 'package:compiler/src/compiler.dart' show | 10 import 'package:compiler/src/compiler.dart' show |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 messages.add(message); | 75 messages.add(message); |
| 76 } | 76 } |
| 77 | 77 |
| 78 bool oldBackendIsDart; | 78 bool oldBackendIsDart; |
| 79 if (cachedCompiler != null) { | 79 if (cachedCompiler != null) { |
| 80 oldBackendIsDart = cachedCompiler.backend is DartBackend; | 80 oldBackendIsDart = cachedCompiler.backend is DartBackend; |
| 81 } | 81 } |
| 82 bool newBackendIsDart = template.options.contains('--output-type=dart'); | 82 bool newBackendIsDart = template.options.contains('--output-type=dart'); |
| 83 | 83 |
| 84 Compiler compiler = compilerFor( | 84 Compiler compiler = compilerFor( |
| 85 example, | 85 memorySourceFiles: example, |
| 86 diagnosticHandler: new LegacyCompilerDiagnostics(collect), | 86 diagnosticHandler: new LegacyCompilerDiagnostics(collect), |
| 87 options: ['--analyze-only', | 87 options: ['--analyze-only', |
| 88 '--enable-experimental-mirrors']..addAll(template.options), | 88 '--enable-experimental-mirrors']..addAll(template.options), |
| 89 cachedCompiler: | 89 cachedCompiler: |
| 90 // TODO(johnniwinther): Remove this restriction when constant | 90 // TODO(johnniwinther): Remove this restriction when constant |
| 91 // values can be computed directly from the expressions. | 91 // values can be computed directly from the expressions. |
| 92 oldBackendIsDart == newBackendIsDart ? cachedCompiler : null); | 92 oldBackendIsDart == newBackendIsDart ? cachedCompiler : null); |
| 93 | 93 |
| 94 return compiler.run(Uri.parse('memory:main.dart')).then((_) { | 94 return compiler.run(Uri.parse('memory:main.dart')).then((_) { |
| 95 | 95 |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 kindsWithPendingClasses.contains(template)); | 142 kindsWithPendingClasses.contains(template)); |
| 143 | 143 |
| 144 if (!pendingStuff) { | 144 if (!pendingStuff) { |
| 145 // If there is pending stuff, or the compiler was cancelled, we | 145 // If there is pending stuff, or the compiler was cancelled, we |
| 146 // shouldn't reuse the compiler. | 146 // shouldn't reuse the compiler. |
| 147 cachedCompiler = compiler; | 147 cachedCompiler = compiler; |
| 148 } | 148 } |
| 149 }); | 149 }); |
| 150 }).then((_) => cachedCompiler); | 150 }).then((_) => cachedCompiler); |
| 151 } | 151 } |
| OLD | NEW |