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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 } | 206 } |
207 | 207 |
208 types.TypeMask findTypeMask(compiler, String name, | 208 types.TypeMask findTypeMask(compiler, String name, |
209 [String how = 'nonNullExact']) { | 209 [String how = 'nonNullExact']) { |
210 var sourceName = name; | 210 var sourceName = name; |
211 var element = compiler.mainApp.find(sourceName); | 211 var element = compiler.mainApp.find(sourceName); |
212 if (element == null) { | 212 if (element == null) { |
213 element = compiler.backend.helpers.interceptorsLibrary.find(sourceName); | 213 element = compiler.backend.helpers.interceptorsLibrary.find(sourceName); |
214 } | 214 } |
215 if (element == null) { | 215 if (element == null) { |
216 element = compiler.coreLibrary.find(sourceName); | 216 element = compiler.commonElements.coreLibrary.find(sourceName); |
217 } | 217 } |
218 Expect.isNotNull(element, 'Could not locate $name'); | 218 Expect.isNotNull(element, 'Could not locate $name'); |
219 switch (how) { | 219 switch (how) { |
220 case 'exact': | 220 case 'exact': |
221 return new types.TypeMask.exact(element, compiler.world); | 221 return new types.TypeMask.exact(element, compiler.world); |
222 case 'nonNullExact': | 222 case 'nonNullExact': |
223 return new types.TypeMask.nonNullExact(element, compiler.world); | 223 return new types.TypeMask.nonNullExact(element, compiler.world); |
224 case 'subclass': | 224 case 'subclass': |
225 return new types.TypeMask.subclass(element, compiler.world); | 225 return new types.TypeMask.subclass(element, compiler.world); |
226 case 'nonNullSubclass': | 226 case 'nonNullSubclass': |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
290 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); | 290 regexp = regexp.replaceAll(xRe, '(?:$anyIdentifier)'); |
291 final spaceRe = new RegExp('\\s+'); | 291 final spaceRe = new RegExp('\\s+'); |
292 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); | 292 regexp = regexp.replaceAll(spaceRe, '(?:\\s*)'); |
293 if (shouldMatch) { | 293 if (shouldMatch) { |
294 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); | 294 Expect.isTrue(new RegExp(regexp).hasMatch(generated)); |
295 } else { | 295 } else { |
296 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); | 296 Expect.isFalse(new RegExp(regexp).hasMatch(generated)); |
297 } | 297 } |
298 }); | 298 }); |
299 } | 299 } |
OLD | NEW |