Chromium Code Reviews| 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:analyzer/dart/ast/ast.dart'; | 5 import 'package:analyzer/dart/ast/ast.dart'; |
| 6 import 'package:analyzer/dart/ast/visitor.dart'; | 6 import 'package:analyzer/dart/ast/visitor.dart'; |
| 7 import 'package:analyzer/dart/element/type.dart'; | 7 import 'package:analyzer/dart/element/type.dart'; |
| 8 | 8 |
| 9 /// Visitor that applies resolution data from the front end (obtained via | 9 /// Visitor that applies resolution data from the front end (obtained via |
| 10 /// [ResolutionStorer]) to an analyzer AST. | 10 /// [ResolutionStorer]) to an analyzer AST. |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 @override | 31 @override |
| 32 void visitInstanceCreationExpression(InstanceCreationExpression node) { | 32 void visitInstanceCreationExpression(InstanceCreationExpression node) { |
| 33 node.argumentList?.accept(this); | 33 node.argumentList?.accept(this); |
| 34 // TODO(paulberry): store resolution of node.constructorName. | 34 // TODO(paulberry): store resolution of node.constructorName. |
| 35 node.staticType = _getTypeFor(node.constructorName); | 35 node.staticType = _getTypeFor(node.constructorName); |
| 36 } | 36 } |
| 37 | 37 |
| 38 @override | 38 @override |
| 39 void visitMethodInvocation(MethodInvocation node) { | 39 void visitMethodInvocation(MethodInvocation node) { |
| 40 node.target?.accept(this); | 40 node.target?.accept(this); |
| 41 node.methodName.staticType = _getTypeFor(node.methodName); | |
|
scheglov
2017/07/21 04:03:03
Could we move this statement after arguments, so a
Paul Berry
2017/07/21 17:40:11
Unfortunately, your suggestion would break a diffe
scheglov
2017/07/21 17:43:58
OK, thank you for the explanation.
| |
| 41 // TODO(paulberry): store resolution of node.methodName. | 42 // TODO(paulberry): store resolution of node.methodName. |
| 42 // TODO(paulberry): store resolution of node.typeArguments. | 43 // TODO(paulberry): store resolution of node.typeArguments. |
| 43 node.argumentList.accept(this); | 44 node.argumentList.accept(this); |
| 44 node.staticType = _getTypeFor(node.methodName); | 45 node.staticType = _getTypeFor(node.argumentList); |
| 45 } | 46 } |
| 46 | 47 |
| 47 @override | 48 @override |
| 48 void visitParenthesizedExpression(ParenthesizedExpression node) { | 49 void visitParenthesizedExpression(ParenthesizedExpression node) { |
| 49 node.visitChildren(this); | 50 node.visitChildren(this); |
| 50 node.staticType = node.expression.staticType; | 51 node.staticType = node.expression.staticType; |
| 51 } | 52 } |
| 52 | 53 |
| 53 @override | 54 @override |
| 54 void visitVariableDeclaration(VariableDeclaration node) { | 55 void visitVariableDeclaration(VariableDeclaration node) { |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 114 DartType _getTypeFor(AstNode node) { | 115 DartType _getTypeFor(AstNode node) { |
| 115 if (_debug) print('Getting type for $node'); | 116 if (_debug) print('Getting type for $node'); |
| 116 if (node.offset != _typeOffsets[_typeIndex]) { | 117 if (node.offset != _typeOffsets[_typeIndex]) { |
| 117 throw new StateError( | 118 throw new StateError( |
| 118 'Expected a type for analyzer offset ${node.offset}; got one for ' | 119 'Expected a type for analyzer offset ${node.offset}; got one for ' |
| 119 'kernel offset ${_typeOffsets[_typeIndex]}'); | 120 'kernel offset ${_typeOffsets[_typeIndex]}'); |
| 120 } | 121 } |
| 121 return super._getTypeFor(node); | 122 return super._getTypeFor(node); |
| 122 } | 123 } |
| 123 } | 124 } |
| OLD | NEW |