| 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 js_backend.backend; | 5 library js_backend.backend; |
| 6 | 6 |
| 7 import '../common.dart'; | 7 import '../common.dart'; |
| 8 import '../common/backend_api.dart' | 8 import '../common/backend_api.dart' |
| 9 show ForeignResolver, NativeRegistry, ImpactTransformer; | 9 show ForeignResolver, NativeRegistry, ImpactTransformer; |
| 10 import '../common/codegen.dart' show CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenWorkItem; |
| 11 import '../common/names.dart' show Uris; | 11 import '../common/names.dart' show Uris; |
| 12 import '../common/resolution.dart' show Resolution, Target; | 12 import '../common/resolution.dart' show Resolution, Target; |
| 13 import '../common/tasks.dart' show CompilerTask; | 13 import '../common/tasks.dart' show CompilerTask; |
| 14 import '../compiler.dart' show Compiler; | 14 import '../compiler.dart' show Compiler; |
| 15 import '../constants/constant_system.dart'; | 15 import '../constants/constant_system.dart'; |
| 16 import '../constants/expressions.dart'; | 16 import '../constants/expressions.dart'; |
| 17 import '../constants/values.dart'; | 17 import '../constants/values.dart'; |
| 18 import '../common_elements.dart' show CommonElements; | 18 import '../common_elements.dart' show CommonElements; |
| 19 import '../deferred_load.dart' show DeferredLoadTask; | 19 import '../deferred_load.dart' show DeferredLoadTask; |
| 20 import '../dump_info.dart' show DumpInfoTask; | 20 import '../dump_info.dart' show DumpInfoTask; |
| 21 import '../elements/elements.dart'; | 21 import '../elements/elements.dart'; |
| 22 import '../elements/entities.dart'; | 22 import '../elements/entities.dart'; |
| 23 import '../elements/names.dart'; | 23 import '../elements/names.dart'; |
| 24 import '../elements/resolution_types.dart'; | 24 import '../elements/resolution_types.dart'; |
| 25 import '../elements/types.dart'; |
| 25 import '../enqueue.dart' | 26 import '../enqueue.dart' |
| 26 show | 27 show |
| 27 DirectEnqueuerStrategy, | 28 DirectEnqueuerStrategy, |
| 28 Enqueuer, | 29 Enqueuer, |
| 29 EnqueueTask, | 30 EnqueueTask, |
| 30 ResolutionEnqueuer, | 31 ResolutionEnqueuer, |
| 31 TreeShakingEnqueuerStrategy; | 32 TreeShakingEnqueuerStrategy; |
| 32 import '../frontend_strategy.dart'; | 33 import '../frontend_strategy.dart'; |
| 33 import '../io/source_information.dart' show SourceInformationStrategy; | 34 import '../io/source_information.dart' show SourceInformationStrategy; |
| 34 import '../js/js.dart' as jsAst; | 35 import '../js/js.dart' as jsAst; |
| (...skipping 965 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 } | 1001 } |
| 1001 reporter.reportHint(hint, infos); | 1002 reporter.reportHint(hint, infos); |
| 1002 } | 1003 } |
| 1003 return programSize; | 1004 return programSize; |
| 1004 } | 1005 } |
| 1005 | 1006 |
| 1006 /** | 1007 /** |
| 1007 * Returns [:true:] if the checking of [type] is performed directly on the | 1008 * Returns [:true:] if the checking of [type] is performed directly on the |
| 1008 * object and not on an interceptor. | 1009 * object and not on an interceptor. |
| 1009 */ | 1010 */ |
| 1010 bool hasDirectCheckFor(ResolutionDartType type) { | 1011 bool hasDirectCheckFor(DartType type) { |
| 1011 Element element = type.element; | 1012 if (!type.isInterfaceType) return false; |
| 1013 InterfaceType interfaceType = type; |
| 1014 ClassEntity element = interfaceType.element; |
| 1012 return element == commonElements.stringClass || | 1015 return element == commonElements.stringClass || |
| 1013 element == commonElements.boolClass || | 1016 element == commonElements.boolClass || |
| 1014 element == commonElements.numClass || | 1017 element == commonElements.numClass || |
| 1015 element == commonElements.intClass || | 1018 element == commonElements.intClass || |
| 1016 element == commonElements.doubleClass || | 1019 element == commonElements.doubleClass || |
| 1017 element == commonElements.jsArrayClass || | 1020 element == commonElements.jsArrayClass || |
| 1018 element == commonElements.jsMutableArrayClass || | 1021 element == commonElements.jsMutableArrayClass || |
| 1019 element == commonElements.jsExtendableArrayClass || | 1022 element == commonElements.jsExtendableArrayClass || |
| 1020 element == commonElements.jsFixedArrayClass || | 1023 element == commonElements.jsFixedArrayClass || |
| 1021 element == commonElements.jsUnmodifiableArrayClass; | 1024 element == commonElements.jsUnmodifiableArrayClass; |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1394 | 1397 |
| 1395 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1398 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1396 return !selector.isGetter; | 1399 return !selector.isGetter; |
| 1397 } | 1400 } |
| 1398 | 1401 |
| 1399 /// Returns `true` if [member] is called from a subclass via `super`. | 1402 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1400 bool isAliasedSuperMember(MemberEntity member) { | 1403 bool isAliasedSuperMember(MemberEntity member) { |
| 1401 return _aliasedSuperMembers.contains(member); | 1404 return _aliasedSuperMembers.contains(member); |
| 1402 } | 1405 } |
| 1403 } | 1406 } |
| OLD | NEW |