| 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 library source_map_name_test; | 5 library source_map_name_test; |
| 6 | 6 |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'package:expect/expect.dart'; | 8 import 'package:expect/expect.dart'; |
| 9 import 'package:compiler/src/compiler.dart'; | 9 import 'package:compiler/src/compiler.dart'; |
| 10 import 'package:compiler/src/elements/elements.dart'; | 10 import 'package:compiler/src/elements/elements.dart'; |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 97 } |
| 98 Expect.isNotNull(element, "Element '$name' not found."); | 98 Expect.isNotNull(element, "Element '$name' not found."); |
| 99 return element; | 99 return element; |
| 100 } | 100 } |
| 101 | 101 |
| 102 void checkName(String expectedName, | 102 void checkName(String expectedName, |
| 103 [List<String> expectedClosureNames, String lookupName]) { | 103 [List<String> expectedClosureNames, String lookupName]) { |
| 104 if (lookupName == null) { | 104 if (lookupName == null) { |
| 105 lookupName = expectedName; | 105 lookupName = expectedName; |
| 106 } | 106 } |
| 107 var element = lookup(lookupName); | 107 dynamic element = lookup(lookupName); |
| 108 check(element, expectedName); | 108 check(element, expectedName); |
| 109 if (element.isConstructor) { | 109 if (element.isConstructor) { |
| 110 var constructorBody = | 110 var constructorBody = |
| 111 element.enclosingClass.lookupConstructorBody(element.name); | 111 element.enclosingClass.lookupConstructorBody(element.name); |
| 112 Expect.isNotNull( | 112 Expect.isNotNull( |
| 113 element, "Constructor body '${element.name}' not found."); | 113 element, "Constructor body '${element.name}' not found."); |
| 114 check(constructorBody, expectedName); | 114 check(constructorBody, expectedName); |
| 115 } | 115 } |
| 116 | 116 |
| 117 if (expectedClosureNames != null) { | 117 if (expectedClosureNames != null) { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 147 checkName('Class.instanceAnonymous', | 147 checkName('Class.instanceAnonymous', |
| 148 ['Class.instanceAnonymous.<anonymous function>']); | 148 ['Class.instanceAnonymous.<anonymous function>']); |
| 149 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']); | 149 checkName('Class.instanceLocal', ['Class.instanceLocal.localMethod']); |
| 150 checkName('Class.instanceNestedLocal', [ | 150 checkName('Class.instanceNestedLocal', [ |
| 151 'Class.instanceNestedLocal.localMethod', | 151 'Class.instanceNestedLocal.localMethod', |
| 152 'Class.instanceNestedLocal.localMethod.<anonymous function>', | 152 'Class.instanceNestedLocal.localMethod.<anonymous function>', |
| 153 'Class.instanceNestedLocal.localMethod.nestedLocalMethod' | 153 'Class.instanceNestedLocal.localMethod.nestedLocalMethod' |
| 154 ]); | 154 ]); |
| 155 }); | 155 }); |
| 156 } | 156 } |
| OLD | NEW |