OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 compiler_helper; | 5 library compiler_helper; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import "package:expect/expect.dart"; | 8 import "package:expect/expect.dart"; |
9 | 9 |
10 import 'package:compiler/src/elements/elements.dart' | 10 import 'package:compiler/src/elements/elements.dart' |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 var element = lib.find(name); | 193 var element = lib.find(name); |
194 Expect.isNotNull(element, 'Could not locate $name.'); | 194 Expect.isNotNull(element, 'Could not locate $name.'); |
195 return element; | 195 return element; |
196 } | 196 } |
197 | 197 |
198 types.TypeMask findTypeMask(compiler, String name, | 198 types.TypeMask findTypeMask(compiler, String name, |
199 [String how = 'nonNullExact']) { | 199 [String how = 'nonNullExact']) { |
200 var sourceName = name; | 200 var sourceName = name; |
201 var element = compiler.mainApp.find(sourceName); | 201 var element = compiler.mainApp.find(sourceName); |
202 if (element == null) { | 202 if (element == null) { |
203 element = compiler.backend.interceptorsLibrary.find(sourceName); | 203 element = compiler.backend.helpers.interceptorsLibrary.find(sourceName); |
204 } | 204 } |
205 if (element == null) { | 205 if (element == null) { |
206 element = compiler.coreLibrary.find(sourceName); | 206 element = compiler.coreLibrary.find(sourceName); |
207 } | 207 } |
208 Expect.isNotNull(element, 'Could not locate $name'); | 208 Expect.isNotNull(element, 'Could not locate $name'); |
209 switch (how) { | 209 switch (how) { |
210 case 'exact': | 210 case 'exact': |
211 return new types.TypeMask.exact(element, compiler.world); | 211 return new types.TypeMask.exact(element, compiler.world); |
212 case 'nonNullExact': | 212 case 'nonNullExact': |
213 return new types.TypeMask.nonNullExact(element, compiler.world); | 213 return new types.TypeMask.nonNullExact(element, compiler.world); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 280 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
281 final spaceRe = new RegExp('\\s+'); | 281 final spaceRe = new RegExp('\\s+'); |
282 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 282 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
283 if (shouldMatch) { | 283 if (shouldMatch) { |
284 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 284 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
285 } else { | 285 } else { |
286 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 286 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
287 } | 287 } |
288 }); | 288 }); |
289 } | 289 } |
OLD | NEW |