| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 '../closure.dart'; | 7 import '../closure.dart'; |
| 8 import '../common.dart'; | 8 import '../common.dart'; |
| 9 import '../common_elements.dart'; | 9 import '../common_elements.dart'; |
| 10 import '../compiler.dart'; | 10 import '../compiler.dart'; |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 ClosedWorldRefiner closedWorldRefiner, | 90 ClosedWorldRefiner closedWorldRefiner, |
| 91 FunctionEntity mainElement) | 91 FunctionEntity mainElement) |
| 92 : super( | 92 : super( |
| 93 compiler, | 93 compiler, |
| 94 closedWorld, | 94 closedWorld, |
| 95 closedWorldRefiner, | 95 closedWorldRefiner, |
| 96 mainElement, | 96 mainElement, |
| 97 new KernelTypeSystemStrategy( | 97 new KernelTypeSystemStrategy( |
| 98 _elementMap, _globalLocalsMap, _closureDataLookup)); | 98 _elementMap, _globalLocalsMap, _closureDataLookup)); |
| 99 | 99 |
| 100 ElementEnvironment get _elementEnvironment => _elementMap.elementEnvironment; |
| 101 |
| 100 @override | 102 @override |
| 101 ConstantValue getFieldConstant(FieldEntity field) { | 103 ConstantValue getFieldConstant(FieldEntity field) { |
| 102 throw new UnimplementedError('KernelInferrerEngine.getFieldConstant'); | 104 return _elementMap.getFieldConstantValue(field); |
| 103 } | 105 } |
| 104 | 106 |
| 105 @override | 107 @override |
| 106 bool isFieldInitializerPotentiallyNull( | 108 bool isFieldInitializerPotentiallyNull( |
| 107 FieldEntity field, ir.Node initializer) { | 109 FieldEntity field, ir.Node initializer) { |
| 108 throw new UnimplementedError( | 110 // TODO(johnniwinther): Implement the ad-hoc check in ast inferrer? |
| 109 'KernelInferrerEngine.isFieldInitializerPotentiallyNull'); | 111 return true; |
| 110 } | 112 } |
| 111 | 113 |
| 112 @override | 114 @override |
| 113 TypeInformation computeMemberTypeInformation( | 115 TypeInformation computeMemberTypeInformation( |
| 114 MemberEntity member, ir.Node body) { | 116 MemberEntity member, ir.Node body) { |
| 115 KernelTypeGraphBuilder visitor = | 117 KernelTypeGraphBuilder visitor = |
| 116 new KernelTypeGraphBuilder(member, compiler, _elementMap, this); | 118 new KernelTypeGraphBuilder(member, compiler, _elementMap, this, body); |
| 117 return visitor.run(); | 119 return visitor.run(); |
| 118 } | 120 } |
| 119 | 121 |
| 120 @override | 122 @override |
| 121 FunctionEntity lookupCallMethod(ClassEntity cls) { | 123 FunctionEntity lookupCallMethod(ClassEntity cls) { |
| 122 throw new UnimplementedError('KernelInferrerEngine.lookupCallMethod'); | 124 throw new UnimplementedError('KernelInferrerEngine.lookupCallMethod'); |
| 123 } | 125 } |
| 124 | 126 |
| 125 @override | 127 @override |
| 126 void forEachParameter(FunctionEntity method, void f(Local parameter)) { | 128 void forEachParameter(FunctionEntity method, void f(Local parameter)) { |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 ConstructorEntity constructor = member; | 262 ConstructorEntity constructor = member; |
| 261 if (constructor.isFactoryConstructor) { | 263 if (constructor.isFactoryConstructor) { |
| 262 DartType type = _elementEnvironment.getFunctionType(constructor); | 264 DartType type = _elementEnvironment.getFunctionType(constructor); |
| 263 return new FactoryConstructorTypeInformation(constructor, type); | 265 return new FactoryConstructorTypeInformation(constructor, type); |
| 264 } else { | 266 } else { |
| 265 return new GenerativeConstructorTypeInformation(constructor); | 267 return new GenerativeConstructorTypeInformation(constructor); |
| 266 } | 268 } |
| 267 } | 269 } |
| 268 } | 270 } |
| 269 } | 271 } |
| OLD | NEW |