Chromium Code Reviews| 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 '../compiler.dart'; | 8 import '../compiler.dart'; |
| 9 import '../constants/expressions.dart'; | 9 import '../constants/expressions.dart'; |
| 10 import '../dart_types.dart'; | 10 import '../dart_types.dart'; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 188 } | 188 } |
| 189 for (ir.NamedExpression argument in arguments.named) { | 189 for (ir.NamedExpression argument in arguments.named) { |
| 190 argument.value.accept(this); | 190 argument.value.accept(this); |
| 191 } | 191 } |
| 192 } | 192 } |
| 193 | 193 |
| 194 @override | 194 @override |
| 195 void visitStaticInvocation(ir.StaticInvocation invocation) { | 195 void visitStaticInvocation(ir.StaticInvocation invocation) { |
| 196 _visitArguments(invocation.arguments); | 196 _visitArguments(invocation.arguments); |
| 197 Element target = astAdapter.getElement(invocation.target).declaration; | 197 Element target = astAdapter.getElement(invocation.target).declaration; |
| 198 impactBuilder.registerStaticUse(new StaticUse.staticInvoke( | 198 if (target.isFactoryConstructor) { |
| 199 target, astAdapter.getCallStructure(invocation.arguments))); | 199 impactBuilder.registerStaticUse(new StaticUse.constructorInvoke( |
| 200 target, astAdapter.getCallStructure(invocation.arguments))); | |
| 201 // TODO(johnniwinther): We should not mark the type as instantiated but | |
| 202 // rather follow the type arguments directly. | |
|
Harry Terkelsen
2016/09/16 16:58:30
What do you mean by "follow the type arguments"? I
Johnni Winther
2016/09/19 08:10:18
Consider this:
abstract class A<T> {
factory A.
| |
| 203 ClassElement cls = | |
| 204 astAdapter.getElement(invocation.target.enclosingClass); | |
| 205 List<DartType> typeArguments = | |
| 206 astAdapter.getDartTypes(invocation.arguments.types); | |
| 207 impactBuilder.registerTypeUse( | |
| 208 new TypeUse.instantiation(new InterfaceType(cls, typeArguments))); | |
| 209 if (typeArguments.any((DartType type) => !type.isDynamic)) { | |
| 210 impactBuilder.registerFeature(Feature.TYPE_VARIABLE_BOUNDS_CHECK); | |
| 211 } | |
| 212 } else { | |
| 213 impactBuilder.registerStaticUse(new StaticUse.staticInvoke( | |
| 214 target, astAdapter.getCallStructure(invocation.arguments))); | |
| 215 } | |
| 200 } | 216 } |
| 201 | 217 |
| 202 @override | 218 @override |
| 203 void visitStaticGet(ir.StaticGet node) { | 219 void visitStaticGet(ir.StaticGet node) { |
| 204 Element target = astAdapter.getElement(node.target).declaration; | 220 Element target = astAdapter.getElement(node.target).declaration; |
| 205 impactBuilder.registerStaticUse(new StaticUse.staticGet(target)); | 221 impactBuilder.registerStaticUse(new StaticUse.staticGet(target)); |
| 206 } | 222 } |
| 207 | 223 |
| 208 @override | 224 @override |
| 209 void visitMethodInvocation(ir.MethodInvocation invocation) { | 225 void visitMethodInvocation(ir.MethodInvocation invocation) { |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 236 @override | 252 @override |
| 237 void visitAssertStatement(ir.AssertStatement node) { | 253 void visitAssertStatement(ir.AssertStatement node) { |
| 238 impactBuilder.registerFeature( | 254 impactBuilder.registerFeature( |
| 239 node.message != null ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); | 255 node.message != null ? Feature.ASSERT_WITH_MESSAGE : Feature.ASSERT); |
| 240 node.visitChildren(this); | 256 node.visitChildren(this); |
| 241 } | 257 } |
| 242 | 258 |
| 243 @override | 259 @override |
| 244 void defaultNode(ir.Node node) => node.visitChildren(this); | 260 void defaultNode(ir.Node node) => node.visitChildren(this); |
| 245 } | 261 } |
| OLD | NEW |