Chromium Code Reviews| 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 'dart:async' show Future; | |
| 8 | |
| 9 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; | 7 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames; |
| 10 | 8 |
| 11 import '../common.dart'; | 9 import '../common.dart'; |
| 12 import '../common/backend_api.dart' | 10 import '../common/backend_api.dart' |
| 13 show BackendClasses, ForeignResolver, NativeRegistry, ImpactTransformer; | 11 show BackendClasses, ForeignResolver, NativeRegistry, ImpactTransformer; |
| 14 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; | 12 import '../common/codegen.dart' show CodegenImpact, CodegenWorkItem; |
| 15 import '../common/names.dart' show Uris; | 13 import '../common/names.dart' show Uris; |
| 16 import '../common/resolution.dart' | 14 import '../common/resolution.dart' |
| 17 show Frontend, Resolution, ResolutionImpact, Target; | 15 show Frontend, Resolution, ResolutionImpact, Target; |
| 18 import '../common/tasks.dart' show CompilerTask; | 16 import '../common/tasks.dart' show CompilerTask; |
| (...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 979 var kind = element.kind; | 977 var kind = element.kind; |
| 980 if (kind == ElementKind.TYPEDEF) { | 978 if (kind == ElementKind.TYPEDEF) { |
| 981 return const WorldImpact(); | 979 return const WorldImpact(); |
| 982 } | 980 } |
| 983 if (element.isConstructor && | 981 if (element.isConstructor && |
| 984 element.enclosingClass == helpers.jsNullClass) { | 982 element.enclosingClass == helpers.jsNullClass) { |
| 985 // Work around a problem compiling JSNull's constructor. | 983 // Work around a problem compiling JSNull's constructor. |
| 986 return const CodegenImpact(); | 984 return const CodegenImpact(); |
| 987 } | 985 } |
| 988 if (kind.category == ElementCategory.VARIABLE) { | 986 if (kind.category == ElementCategory.VARIABLE) { |
| 989 VariableElement variableElement = element; | 987 VariableElement variableElement = element as VariableElement; |
|
Johnni Winther
2017/04/03 12:07:33
Why is this necessary? VariableElement is a subtyp
ahe
2017/04/03 12:25:07
Done.
| |
| 990 ConstantExpression constant = variableElement.constant; | 988 ConstantExpression constant = variableElement.constant; |
| 991 if (constant != null) { | 989 if (constant != null) { |
| 992 ConstantValue initialValue = constants.getConstantValue(constant); | 990 ConstantValue initialValue = constants.getConstantValue(constant); |
| 993 if (initialValue != null) { | 991 if (initialValue != null) { |
| 994 work.registry.worldImpact | 992 work.registry.worldImpact |
| 995 .registerConstantUse(new ConstantUse.init(initialValue)); | 993 .registerConstantUse(new ConstantUse.init(initialValue)); |
| 996 // We don't need to generate code for static or top-level | 994 // We don't need to generate code for static or top-level |
| 997 // variables. For instance variables, we may need to generate | 995 // variables. For instance variables, we may need to generate |
| 998 // the checked setter. | 996 // the checked setter. |
| 999 if (Elements.isStaticOrTopLevel(element)) { | 997 if (Elements.isStaticOrTopLevel(element)) { |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1608 | 1606 |
| 1609 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1607 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
| 1610 return !selector.isGetter; | 1608 return !selector.isGetter; |
| 1611 } | 1609 } |
| 1612 | 1610 |
| 1613 /// Returns `true` if [member] is called from a subclass via `super`. | 1611 /// Returns `true` if [member] is called from a subclass via `super`. |
| 1614 bool isAliasedSuperMember(MemberEntity member) { | 1612 bool isAliasedSuperMember(MemberEntity member) { |
| 1615 return _aliasedSuperMembers.contains(member); | 1613 return _aliasedSuperMembers.contains(member); |
| 1616 } | 1614 } |
| 1617 } | 1615 } |
| OLD | NEW |