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) { |
| 987 // ignore: INVALID_ASSIGNMENT |
989 VariableElement variableElement = element; | 988 VariableElement variableElement = element; |
990 ConstantExpression constant = variableElement.constant; | 989 ConstantExpression constant = variableElement.constant; |
991 if (constant != null) { | 990 if (constant != null) { |
992 ConstantValue initialValue = constants.getConstantValue(constant); | 991 ConstantValue initialValue = constants.getConstantValue(constant); |
993 if (initialValue != null) { | 992 if (initialValue != null) { |
994 work.registry.worldImpact | 993 work.registry.worldImpact |
995 .registerConstantUse(new ConstantUse.init(initialValue)); | 994 .registerConstantUse(new ConstantUse.init(initialValue)); |
996 // We don't need to generate code for static or top-level | 995 // We don't need to generate code for static or top-level |
997 // variables. For instance variables, we may need to generate | 996 // variables. For instance variables, we may need to generate |
998 // the checked setter. | 997 // the checked setter. |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1608 | 1607 |
1609 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { | 1608 bool canUseAliasedSuperMember(MemberEntity member, Selector selector) { |
1610 return !selector.isGetter; | 1609 return !selector.isGetter; |
1611 } | 1610 } |
1612 | 1611 |
1613 /// Returns `true` if [member] is called from a subclass via `super`. | 1612 /// Returns `true` if [member] is called from a subclass via `super`. |
1614 bool isAliasedSuperMember(MemberEntity member) { | 1613 bool isAliasedSuperMember(MemberEntity member) { |
1615 return _aliasedSuperMembers.contains(member); | 1614 return _aliasedSuperMembers.contains(member); |
1616 } | 1615 } |
1617 } | 1616 } |
OLD | NEW |