OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 import 'package:kernel/ast.dart' as ir; | 5 import 'package:kernel/ast.dart' as ir; |
6 | 6 |
7 import '../common.dart'; | 7 import '../common.dart'; |
8 import '../common/names.dart'; | 8 import '../common/names.dart'; |
9 import '../compiler.dart'; | 9 import '../compiler.dart'; |
10 import '../constants/expressions.dart'; | 10 import '../constants/expressions.dart'; |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 checkType(node.returnType); | 100 checkType(node.returnType); |
101 } | 101 } |
102 node.positionalParameters.forEach(handleParameter); | 102 node.positionalParameters.forEach(handleParameter); |
103 node.namedParameters.forEach(handleParameter); | 103 node.namedParameters.forEach(handleParameter); |
104 } | 104 } |
105 | 105 |
106 ResolutionImpact buildField(ir.Field field) { | 106 ResolutionImpact buildField(ir.Field field) { |
107 checkType(field.type); | 107 checkType(field.type); |
108 if (field.initializer != null) { | 108 if (field.initializer != null) { |
109 visitNode(field.initializer); | 109 visitNode(field.initializer); |
110 if (!field.isInstanceMember && !field.isConst) { | 110 if (!field.isInstanceMember && |
| 111 !field.isConst && |
| 112 field.initializer is! ir.NullLiteral) { |
111 impactBuilder.registerFeature(Feature.LAZY_FIELD); | 113 impactBuilder.registerFeature(Feature.LAZY_FIELD); |
112 } | 114 } |
113 } else { | |
114 impactBuilder.registerFeature(Feature.FIELD_WITHOUT_INITIALIZER); | |
115 } | 115 } |
116 if (field.isInstanceMember && astAdapter.isNative(field.enclosingClass)) { | 116 if (field.isInstanceMember && astAdapter.isNative(field.enclosingClass)) { |
117 impactBuilder | 117 impactBuilder |
118 .registerNativeData(astAdapter.getNativeBehaviorForFieldLoad(field)); | 118 .registerNativeData(astAdapter.getNativeBehaviorForFieldLoad(field)); |
119 impactBuilder | 119 impactBuilder |
120 .registerNativeData(astAdapter.getNativeBehaviorForFieldStore(field)); | 120 .registerNativeData(astAdapter.getNativeBehaviorForFieldStore(field)); |
121 } | 121 } |
122 return impactBuilder; | 122 return impactBuilder; |
123 } | 123 } |
124 | 124 |
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
568 Element target = astAdapter.getElement(node.target).declaration; | 568 Element target = astAdapter.getElement(node.target).declaration; |
569 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( | 569 impactBuilder.registerStaticUse(new StaticUse.superConstructorInvoke( |
570 target, astAdapter.getCallStructure(node.arguments))); | 570 target, astAdapter.getCallStructure(node.arguments))); |
571 } | 571 } |
572 | 572 |
573 // TODO(johnniwinther): Make this throw and visit child nodes explicitly | 573 // TODO(johnniwinther): Make this throw and visit child nodes explicitly |
574 // instead to ensure that we don't visit unwanted parts of the ir. | 574 // instead to ensure that we don't visit unwanted parts of the ir. |
575 @override | 575 @override |
576 void defaultNode(ir.Node node) => node.visitChildren(this); | 576 void defaultNode(ir.Node node) => node.visitChildren(this); |
577 } | 577 } |
OLD | NEW |