| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 dart2js.resolution_strategy; | 5 library dart2js.resolution_strategy; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common_elements.dart'; | 8 import '../common_elements.dart'; |
| 9 import '../common/backend_api.dart'; | 9 import '../common/backend_api.dart'; |
| 10 import '../common/names.dart'; | 10 import '../common/names.dart'; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 } | 346 } |
| 347 return member?.declaration; | 347 return member?.declaration; |
| 348 } | 348 } |
| 349 | 349 |
| 350 @override | 350 @override |
| 351 ClassElement lookupClass(LibraryElement library, String name, | 351 ClassElement lookupClass(LibraryElement library, String name, |
| 352 {bool required: false}) { | 352 {bool required: false}) { |
| 353 ClassElement cls = library.implementation.findLocal(name); | 353 ClassElement cls = library.implementation.findLocal(name); |
| 354 if (cls == null && required) { | 354 if (cls == null && required) { |
| 355 throw new SpannableAssertionFailure( | 355 throw new SpannableAssertionFailure( |
| 356 cls, | 356 library, |
| 357 "The library '${library.libraryName}' does not " | 357 "The library '${library.libraryName}' does not " |
| 358 "contain required class: '$name'."); | 358 "contain required class: '$name'."); |
| 359 } | 359 } |
| 360 return cls?.declaration; | 360 return cls?.declaration; |
| 361 } | 361 } |
| 362 | 362 |
| 363 @override | 363 @override |
| 364 void forEachClass(LibraryElement library, void f(ClassElement cls)) { | 364 void forEachClass(LibraryElement library, void f(ClassElement cls)) { |
| 365 library.implementation.forEachLocalMember((member) { | 365 library.implementation.forEachLocalMember((member) { |
| 366 if (member.isClass) { | 366 if (member.isClass) { |
| 367 f(member); | 367 f(member); |
| 368 } | 368 } |
| 369 }); | 369 }); |
| 370 } | 370 } |
| 371 | 371 |
| 372 @override | 372 @override |
| 373 LibraryElement lookupLibrary(Uri uri, {bool required: false}) { | 373 LibraryElement lookupLibrary(Uri uri, {bool required: false}) { |
| 374 LibraryElement library = _libraryProvider.lookupLibrary(uri); | 374 LibraryElement library = _libraryProvider.lookupLibrary(uri); |
| 375 // If the script of the library is synthesized, the library does not exist | 375 // If the script of the library is synthesized, the library does not exist |
| 376 // and we do not try to load the helpers. | 376 // and we do not try to load the helpers. |
| 377 // | 377 // |
| 378 // This could for example happen if dart:async is disabled, then loading it | 378 // This could for example happen if dart:async is disabled, then loading it |
| 379 // should not try to find the given element. | 379 // should not try to find the given element. |
| 380 if (library != null && library.isSynthesized) { | 380 if (library != null && library.isSynthesized) { |
| 381 return null; | 381 return null; |
| 382 } | 382 } |
| 383 if (library == null && required) { | 383 if (library == null && required) { |
| 384 throw new SpannableAssertionFailure( | 384 throw new SpannableAssertionFailure( |
| 385 library, "The library '${uri}' was not found."); | 385 NO_LOCATION_SPANNABLE, "The library '${uri}' was not found."); |
| 386 } | 386 } |
| 387 return library; | 387 return library; |
| 388 } | 388 } |
| 389 | 389 |
| 390 @override | 390 @override |
| 391 CallStructure getCallStructure(MethodElement method) { | 391 CallStructure getCallStructure(MethodElement method) { |
| 392 ResolutionFunctionType type = method.computeType(_resolution); | 392 ResolutionFunctionType type = method.computeType(_resolution); |
| 393 return new CallStructure( | 393 return new CallStructure( |
| 394 type.parameterTypes.length + | 394 type.parameterTypes.length + |
| 395 type.optionalParameterTypes.length + | 395 type.optionalParameterTypes.length + |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 library.forEachLocalMember((Element element) { | 456 library.forEachLocalMember((Element element) { |
| 457 if (element.isClass) { | 457 if (element.isClass) { |
| 458 ClassElement cls = element; | 458 ClassElement cls = element; |
| 459 if (checkJsInteropAnnotation(element)) { | 459 if (checkJsInteropAnnotation(element)) { |
| 460 nativeBasicDataBuilder.markAsJsInteropClass(cls); | 460 nativeBasicDataBuilder.markAsJsInteropClass(cls); |
| 461 } | 461 } |
| 462 } | 462 } |
| 463 }); | 463 }); |
| 464 } | 464 } |
| 465 } | 465 } |
| OLD | NEW |