| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 import '../compiler_helper.dart'; | 5 import '../compiler_helper.dart'; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:compiler/src/dart2jslib.dart'; | 8 import 'package:compiler/src/dart2jslib.dart'; |
| 9 import 'package:compiler/src/dart_backend/dart_backend.dart'; | 9 import 'package:compiler/src/dart_backend/dart_backend.dart'; |
| 10 import 'package:compiler/src/dart_backend/backend_ast_to_frontend_ast.dart' | 10 import 'package:compiler/src/dart_backend/backend_ast_to_frontend_ast.dart' |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 compiler.parseScript(code); | 27 compiler.parseScript(code); |
| 28 Element element = compiler.mainApp.find('main'); | 28 Element element = compiler.mainApp.find('main'); |
| 29 if (element == null) return null; | 29 if (element == null) return null; |
| 30 compiler.mainFunction = element; | 30 compiler.mainFunction = element; |
| 31 compiler.phase = Compiler.PHASE_RESOLVING; | 31 compiler.phase = Compiler.PHASE_RESOLVING; |
| 32 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, | 32 compiler.backend.enqueueHelpers(compiler.enqueuer.resolution, |
| 33 compiler.globalDependencies); | 33 compiler.globalDependencies); |
| 34 compiler.processQueue(compiler.enqueuer.resolution, element); | 34 compiler.processQueue(compiler.enqueuer.resolution, element); |
| 35 compiler.world.populate(); | 35 compiler.world.populate(); |
| 36 compiler.backend.onResolutionComplete(); | 36 compiler.backend.onResolutionComplete(); |
| 37 compiler.irBuilder.buildNodes(useNewBackend: true); | 37 compiler.irBuilder.buildNodes(); |
| 38 compiler.phase = Compiler.PHASE_COMPILING; | 38 compiler.phase = Compiler.PHASE_COMPILING; |
| 39 DartBackend backend = compiler.backend; | 39 DartBackend backend = compiler.backend; |
| 40 backend.assembleProgram(); | 40 backend.assembleProgram(); |
| 41 String generated = compiler.assembledCode; | 41 String generated = compiler.assembledCode; |
| 42 return generated; | 42 return generated; |
| 43 }); | 43 }); |
| 44 } | 44 } |
| 45 | 45 |
| 46 Future test(String code, String feature) { | 46 Future test(String code, String feature) { |
| 47 return compile(code).then((output) { | 47 return compile(code).then((output) { |
| 48 if (output == null || !output.contains('main() /* new backend */')) { | 48 if (output == null || !output.contains('main() /* new backend */')) { |
| 49 throw 'New backend appears to be deactivated for $feature.\n' | 49 throw 'New backend appears to be deactivated for $feature.\n' |
| 50 'Output was: $output'; | 50 'Output was: $output'; |
| 51 } | 51 } |
| 52 }); | 52 }); |
| 53 } | 53 } |
| 54 | 54 |
| 55 main() { | 55 main() { |
| 56 INSERT_NEW_BACKEND_COMMENT = true; | 56 INSERT_NEW_BACKEND_COMMENT = true; |
| 57 | 57 |
| 58 asyncTest(() => Future.forEach([ | 58 asyncTest(() => Future.forEach([ |
| 59 () => test(TestStaticField, 'static fields'), | 59 () => test(TestStaticField, 'static fields'), |
| 60 ], (f) => f())); | 60 ], (f) => f())); |
| 61 } | 61 } |
| OLD | NEW |