| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // VMOptions=-DUSE_CPS_IR=true | 4 // VMOptions=-DUSE_CPS_IR=true |
| 5 | 5 |
| 6 // Test that the CPS IR code generator generates source information. | 6 // Test that the CPS IR code generator generates source information. |
| 7 | 7 |
| 8 library source_information_tests; | 8 library source_information_tests; |
| 9 | 9 |
| 10 import 'package:async_helper/async_helper.dart'; | 10 import 'package:async_helper/async_helper.dart'; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 String formatTest(Map test) { | 34 String formatTest(Map test) { |
| 35 return test[TEST_MAIN_FILE]; | 35 return test[TEST_MAIN_FILE]; |
| 36 } | 36 } |
| 37 | 37 |
| 38 js.Node getCodeForMain(Compiler compiler) { | 38 js.Node getCodeForMain(Compiler compiler) { |
| 39 Element mainFunction = compiler.mainFunction; | 39 Element mainFunction = compiler.mainFunction; |
| 40 return compiler.enqueuer.codegen.generatedCode[mainFunction]; | 40 return compiler.enqueuer.codegen.generatedCode[mainFunction]; |
| 41 } | 41 } |
| 42 | 42 |
| 43 js.Node getJsNodeForElement(Compiler compiler, | 43 js.Node getJsNodeForElement(Compiler compiler, Element element) { |
| 44 Element element) { | |
| 45 return compiler.enqueuer.codegen.generatedCode[element]; | 44 return compiler.enqueuer.codegen.generatedCode[element]; |
| 46 } | 45 } |
| 47 | 46 |
| 48 ir.ExecutableDefinition getIrNodeForElement(Compiler compiler, | 47 ir.RootNode getIrNodeForElement(Compiler compiler, Element element) { |
| 49 Element element) { | |
| 50 return compiler.irBuilder.getIr(element); | 48 return compiler.irBuilder.getIr(element); |
| 51 } | 49 } |
| 52 | 50 |
| 53 String getCodeForMethod(Compiler compiler, | 51 String getCodeForMethod(Compiler compiler, String name) { |
| 54 String name) { | |
| 55 Element foundElement; | 52 Element foundElement; |
| 56 for (Element element in compiler.enqueuer.codegen.generatedCode.keys) { | 53 for (Element element in compiler.enqueuer.codegen.generatedCode.keys) { |
| 57 if (element.toString() == name) { | 54 if (element.toString() == name) { |
| 58 if (foundElement != null) { | 55 if (foundElement != null) { |
| 59 Expect.fail('Multiple compiled elements are called $name'); | 56 Expect.fail('Multiple compiled elements are called $name'); |
| 60 } | 57 } |
| 61 foundElement = element; | 58 foundElement = element; |
| 62 } | 59 } |
| 63 } | 60 } |
| 64 | 61 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 print('Hello'); | 137 print('Hello'); |
| 141 print('World'); | 138 print('World'); |
| 142 } | 139 } |
| 143 """, const ['memory:test.dart:[2,3]', | 140 """, const ['memory:test.dart:[2,3]', |
| 144 'memory:test.dart:[3,3]']), | 141 'memory:test.dart:[3,3]']), |
| 145 ]; | 142 ]; |
| 146 | 143 |
| 147 void main() { | 144 void main() { |
| 148 runTests(tests); | 145 runTests(tests); |
| 149 } | 146 } |
| OLD | NEW |