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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 void checkFunctionTypes(ir.FunctionNode node) { | 76 void checkFunctionTypes(ir.FunctionNode node) { |
77 checkType(node.returnType); | 77 checkType(node.returnType); |
78 node.positionalParameters.forEach((v) => checkType(v.type)); | 78 node.positionalParameters.forEach((v) => checkType(v.type)); |
79 node.namedParameters.forEach((v) => checkType(v.type)); | 79 node.namedParameters.forEach((v) => checkType(v.type)); |
80 } | 80 } |
81 | 81 |
82 ResolutionImpact buildField(ir.Field field) { | 82 ResolutionImpact buildField(ir.Field field) { |
83 checkType(field.type); | 83 checkType(field.type); |
84 if (field.initializer != null) { | 84 if (field.initializer != null) { |
85 visitNode(field.initializer); | 85 visitNode(field.initializer); |
| 86 if (!field.isConst) { |
| 87 impactBuilder.registerFeature(Feature.LAZY_FIELD); |
| 88 } |
86 } else { | 89 } else { |
87 impactBuilder.registerFeature(Feature.FIELD_WITHOUT_INITIALIZER); | 90 impactBuilder.registerFeature(Feature.FIELD_WITHOUT_INITIALIZER); |
88 } | 91 } |
89 return impactBuilder; | 92 return impactBuilder; |
90 } | 93 } |
91 | 94 |
92 ResolutionImpact buildProcedure(ir.Procedure procedure) { | 95 ResolutionImpact buildProcedure(ir.Procedure procedure) { |
93 if (procedure.kind == ir.ProcedureKind.Method || | 96 if (procedure.kind == ir.ProcedureKind.Method || |
94 procedure.kind == ir.ProcedureKind.Operator) { | 97 procedure.kind == ir.ProcedureKind.Operator) { |
95 checkFunctionTypes(procedure.function); | 98 checkFunctionTypes(procedure.function); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
319 } else { | 322 } else { |
320 impactBuilder.registerFeature(Feature.LOCAL_WITHOUT_INITIALIZER); | 323 impactBuilder.registerFeature(Feature.LOCAL_WITHOUT_INITIALIZER); |
321 } | 324 } |
322 } | 325 } |
323 | 326 |
324 // TODO(johnniwinther): Make this throw and visit child nodes explicitly | 327 // TODO(johnniwinther): Make this throw and visit child nodes explicitly |
325 // instead to ensure that we don't visit unwanted parts of the ir. | 328 // instead to ensure that we don't visit unwanted parts of the ir. |
326 @override | 329 @override |
327 void defaultNode(ir.Node node) => node.visitChildren(this); | 330 void defaultNode(ir.Node node) => node.visitChildren(this); |
328 } | 331 } |
OLD | NEW |