| 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 | 4 | 
| 5 // Test that the CPS IR code generator generates source information. | 5 // Test that the CPS IR code generator generates source information. | 
| 6 | 6 | 
| 7 library source_information_tests; | 7 library source_information_tests; | 
| 8 | 8 | 
| 9 import 'package:async_helper/async_helper.dart'; | 9 import 'package:async_helper/async_helper.dart'; | 
| 10 import 'package:expect/expect.dart'; | 10 import 'package:expect/expect.dart'; | 
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 53       } | 53       } | 
| 54       foundElement = element; | 54       foundElement = element; | 
| 55     } | 55     } | 
| 56   } | 56   } | 
| 57 | 57 | 
| 58   if (foundElement == null) { | 58   if (foundElement == null) { | 
| 59     Expect.fail('There is no compiled element called $name'); | 59     Expect.fail('There is no compiled element called $name'); | 
| 60   } | 60   } | 
| 61 | 61 | 
| 62   js.Node ast = compiler.enqueuer.codegen.generatedCode[foundElement]; | 62   js.Node ast = compiler.enqueuer.codegen.generatedCode[foundElement]; | 
| 63   return js.prettyPrint(ast, compiler).getText(); | 63   return js.prettyPrint(ast, compiler); | 
| 64 } | 64 } | 
| 65 | 65 | 
| 66 runTests(List<TestEntry> tests) { | 66 runTests(List<TestEntry> tests) { | 
| 67   for (TestEntry test in tests) { | 67   for (TestEntry test in tests) { | 
| 68     Map files = {TEST_MAIN_FILE: test.source}; | 68     Map files = {TEST_MAIN_FILE: test.source}; | 
| 69     asyncTest(() { | 69     asyncTest(() { | 
| 70       CompilerImpl compiler = compilerFor( | 70       CompilerImpl compiler = compilerFor( | 
| 71           memorySourceFiles: files, options: <String>['--use-cps-ir']); | 71           memorySourceFiles: files, options: <String>['--use-cps-ir']); | 
| 72       ir.FunctionDefinition irNodeForMain; | 72       ir.FunctionDefinition irNodeForMain; | 
| 73 | 73 | 
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 143   print('Hello'); | 143   print('Hello'); | 
| 144   print('World'); | 144   print('World'); | 
| 145 } | 145 } | 
| 146 """, const ['memory:test.dart:[2,3]', | 146 """, const ['memory:test.dart:[2,3]', | 
| 147             'memory:test.dart:[3,3]']), | 147             'memory:test.dart:[3,3]']), | 
| 148 ]; | 148 ]; | 
| 149 | 149 | 
| 150 void main() { | 150 void main() { | 
| 151   runTests(tests); | 151   runTests(tests); | 
| 152 } | 152 } | 
| OLD | NEW | 
|---|