Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(312)

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1513643009: Clean up package imports and library names (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library engine.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import '../task/strong/info.dart' show InferredType, StaticInfo; 9 import 'package:analyzer/src/generated/ast.dart';
10 import 'ast.dart'; 10 import 'package:analyzer/src/generated/constant.dart';
11 import 'constant.dart'; 11 import 'package:analyzer/src/generated/element.dart';
12 import 'element.dart'; 12 import 'package:analyzer/src/generated/element_resolver.dart';
13 import 'element_resolver.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
14 import 'engine.dart'; 14 import 'package:analyzer/src/generated/error.dart';
15 import 'error.dart'; 15 import 'package:analyzer/src/generated/error_verifier.dart';
16 import 'error_verifier.dart'; 16 import 'package:analyzer/src/generated/java_core.dart';
17 import 'java_core.dart'; 17 import 'package:analyzer/src/generated/java_engine.dart';
18 import 'java_engine.dart'; 18 import 'package:analyzer/src/generated/scanner.dart';
19 import 'scanner.dart'; 19 import 'package:analyzer/src/generated/source.dart';
20 import 'scanner.dart' as sc; 20 import 'package:analyzer/src/generated/static_type_analyzer.dart';
21 import 'source.dart'; 21 import 'package:analyzer/src/generated/type_system.dart';
22 import 'static_type_analyzer.dart'; 22 import 'package:analyzer/src/generated/utilities_dart.dart';
23 import 'type_system.dart'; 23 import 'package:analyzer/src/task/strong/info.dart' show InferredType, StaticInf o;
24 import 'utilities_dart.dart';
25 24
26 export 'type_system.dart'; 25 export 'package:analyzer/src/generated/type_system.dart';
27 26
28 /** 27 /**
29 * Instances of the class `BestPracticesVerifier` traverse an AST structure look ing for 28 * Instances of the class `BestPracticesVerifier` traverse an AST structure look ing for
30 * violations of Dart best practices. 29 * violations of Dart best practices.
31 */ 30 */
32 class BestPracticesVerifier extends RecursiveAstVisitor<Object> { 31 class BestPracticesVerifier extends RecursiveAstVisitor<Object> {
33 // static String _HASHCODE_GETTER_NAME = "hashCode"; 32 // static String _HASHCODE_GETTER_NAME = "hashCode";
34 33
35 static String _NULL_TYPE_NAME = "Null"; 34 static String _NULL_TYPE_NAME = "Null";
36 35
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 80 }
82 81
83 @override 82 @override
84 Object visitAssertStatement(AssertStatement node) { 83 Object visitAssertStatement(AssertStatement node) {
85 _checkForPossibleNullCondition(node.condition); 84 _checkForPossibleNullCondition(node.condition);
86 return super.visitAssertStatement(node); 85 return super.visitAssertStatement(node);
87 } 86 }
88 87
89 @override 88 @override
90 Object visitAssignmentExpression(AssignmentExpression node) { 89 Object visitAssignmentExpression(AssignmentExpression node) {
91 sc.TokenType operatorType = node.operator.type; 90 TokenType operatorType = node.operator.type;
92 if (operatorType == sc.TokenType.EQ) { 91 if (operatorType == TokenType.EQ) {
93 _checkForUseOfVoidResult(node.rightHandSide); 92 _checkForUseOfVoidResult(node.rightHandSide);
94 _checkForInvalidAssignment(node.leftHandSide, node.rightHandSide); 93 _checkForInvalidAssignment(node.leftHandSide, node.rightHandSide);
95 } else { 94 } else {
96 _checkForDeprecatedMemberUse(node.bestElement, node); 95 _checkForDeprecatedMemberUse(node.bestElement, node);
97 } 96 }
98 return super.visitAssignmentExpression(node); 97 return super.visitAssignmentExpression(node);
99 } 98 }
100 99
101 @override 100 @override
102 Object visitBinaryExpression(BinaryExpression node) { 101 Object visitBinaryExpression(BinaryExpression node) {
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 bool _checkAllTypeChecks(IsExpression node) { 261 bool _checkAllTypeChecks(IsExpression node) {
263 Expression expression = node.expression; 262 Expression expression = node.expression;
264 TypeName typeName = node.type; 263 TypeName typeName = node.type;
265 DartType lhsType = expression.staticType; 264 DartType lhsType = expression.staticType;
266 DartType rhsType = typeName.type; 265 DartType rhsType = typeName.type;
267 if (lhsType == null || rhsType == null) { 266 if (lhsType == null || rhsType == null) {
268 return false; 267 return false;
269 } 268 }
270 String rhsNameStr = typeName.name.name; 269 String rhsNameStr = typeName.name.name;
271 // if x is dynamic 270 // if x is dynamic
272 if (rhsType.isDynamic && rhsNameStr == sc.Keyword.DYNAMIC.syntax) { 271 if (rhsType.isDynamic && rhsNameStr == Keyword.DYNAMIC.syntax) {
273 if (node.notOperator == null) { 272 if (node.notOperator == null) {
274 // the is case 273 // the is case
275 _errorReporter.reportErrorForNode( 274 _errorReporter.reportErrorForNode(
276 HintCode.UNNECESSARY_TYPE_CHECK_TRUE, node); 275 HintCode.UNNECESSARY_TYPE_CHECK_TRUE, node);
277 } else { 276 } else {
278 // the is not case 277 // the is not case
279 _errorReporter.reportErrorForNode( 278 _errorReporter.reportErrorForNode(
280 HintCode.UNNECESSARY_TYPE_CHECK_FALSE, node); 279 HintCode.UNNECESSARY_TYPE_CHECK_FALSE, node);
281 } 280 }
282 return true; 281 return true;
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 521
523 /** 522 /**
524 * Check for the passed binary expression for the [HintCode.DIVISION_OPTIMIZAT ION]. 523 * Check for the passed binary expression for the [HintCode.DIVISION_OPTIMIZAT ION].
525 * 524 *
526 * @param node the binary expression to check 525 * @param node the binary expression to check
527 * @return `true` if and only if a hint code is generated on the passed node 526 * @return `true` if and only if a hint code is generated on the passed node
528 * See [HintCode.DIVISION_OPTIMIZATION]. 527 * See [HintCode.DIVISION_OPTIMIZATION].
529 */ 528 */
530 bool _checkForDivisionOptimizationHint(BinaryExpression node) { 529 bool _checkForDivisionOptimizationHint(BinaryExpression node) {
531 // Return if the operator is not '/' 530 // Return if the operator is not '/'
532 if (node.operator.type != sc.TokenType.SLASH) { 531 if (node.operator.type != TokenType.SLASH) {
533 return false; 532 return false;
534 } 533 }
535 // Return if the '/' operator is not defined in core, or if we don't know 534 // Return if the '/' operator is not defined in core, or if we don't know
536 // its static or propagated type 535 // its static or propagated type
537 MethodElement methodElement = node.bestElement; 536 MethodElement methodElement = node.bestElement;
538 if (methodElement == null) { 537 if (methodElement == null) {
539 return false; 538 return false;
540 } 539 }
541 LibraryElement libraryElement = methodElement.library; 540 LibraryElement libraryElement = methodElement.library;
542 if (libraryElement != null && !libraryElement.isDartCore) { 541 if (libraryElement != null && !libraryElement.isDartCore) {
(...skipping 1121 matching lines...) Expand 10 before | Expand all | Expand 10 after
1664 * Create a new instance of the [DeadCodeVerifier]. 1663 * Create a new instance of the [DeadCodeVerifier].
1665 * 1664 *
1666 * @param errorReporter the error reporter 1665 * @param errorReporter the error reporter
1667 */ 1666 */
1668 DeadCodeVerifier(this._errorReporter, {TypeSystem typeSystem}) 1667 DeadCodeVerifier(this._errorReporter, {TypeSystem typeSystem})
1669 : this._typeSystem = 1668 : this._typeSystem =
1670 (typeSystem != null) ? typeSystem : new TypeSystemImpl(); 1669 (typeSystem != null) ? typeSystem : new TypeSystemImpl();
1671 1670
1672 @override 1671 @override
1673 Object visitBinaryExpression(BinaryExpression node) { 1672 Object visitBinaryExpression(BinaryExpression node) {
1674 sc.Token operator = node.operator; 1673 Token operator = node.operator;
1675 bool isAmpAmp = operator.type == sc.TokenType.AMPERSAND_AMPERSAND; 1674 bool isAmpAmp = operator.type == TokenType.AMPERSAND_AMPERSAND;
1676 bool isBarBar = operator.type == sc.TokenType.BAR_BAR; 1675 bool isBarBar = operator.type == TokenType.BAR_BAR;
1677 if (isAmpAmp || isBarBar) { 1676 if (isAmpAmp || isBarBar) {
1678 Expression lhsCondition = node.leftOperand; 1677 Expression lhsCondition = node.leftOperand;
1679 if (!_isDebugConstant(lhsCondition)) { 1678 if (!_isDebugConstant(lhsCondition)) {
1680 EvaluationResultImpl lhsResult = _getConstantBooleanValue(lhsCondition); 1679 EvaluationResultImpl lhsResult = _getConstantBooleanValue(lhsCondition);
1681 if (lhsResult != null) { 1680 if (lhsResult != null) {
1682 if (lhsResult.value.toBoolValue() == true && isBarBar) { 1681 if (lhsResult.value.toBoolValue() == true && isBarBar) {
1683 // report error on else block: true || !e! 1682 // report error on else block: true || !e!
1684 _errorReporter.reportErrorForNode( 1683 _errorReporter.reportErrorForNode(
1685 HintCode.DEAD_CODE, node.rightOperand); 1684 HintCode.DEAD_CODE, node.rightOperand);
1686 // only visit the LHS: 1685 // only visit the LHS:
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after
2161 } else { 2160 } else {
2162 return super.visitFieldFormalParameter(node); 2161 return super.visitFieldFormalParameter(node);
2163 } 2162 }
2164 } 2163 }
2165 2164
2166 @override 2165 @override
2167 Object visitFunctionDeclaration(FunctionDeclaration node) { 2166 Object visitFunctionDeclaration(FunctionDeclaration node) {
2168 ExecutableElement outerExecutable = _enclosingExecutable; 2167 ExecutableElement outerExecutable = _enclosingExecutable;
2169 try { 2168 try {
2170 SimpleIdentifier functionName = node.name; 2169 SimpleIdentifier functionName = node.name;
2171 sc.Token property = node.propertyKeyword; 2170 Token property = node.propertyKeyword;
2172 if (property == null) { 2171 if (property == null) {
2173 if (_enclosingExecutable != null) { 2172 if (_enclosingExecutable != null) {
2174 _enclosingExecutable = 2173 _enclosingExecutable =
2175 _findIdentifier(_enclosingExecutable.functions, functionName); 2174 _findIdentifier(_enclosingExecutable.functions, functionName);
2176 } else { 2175 } else {
2177 _enclosingExecutable = 2176 _enclosingExecutable =
2178 _findIdentifier(_enclosingUnit.functions, functionName); 2177 _findIdentifier(_enclosingUnit.functions, functionName);
2179 } 2178 }
2180 } else { 2179 } else {
2181 if (_enclosingExecutable != null) { 2180 if (_enclosingExecutable != null) {
2182 _enclosingExecutable = 2181 _enclosingExecutable =
2183 _findIdentifier(_enclosingExecutable.functions, functionName); 2182 _findIdentifier(_enclosingExecutable.functions, functionName);
2184 } else { 2183 } else {
2185 PropertyAccessorElement accessor = 2184 PropertyAccessorElement accessor =
2186 _findIdentifier(_enclosingUnit.accessors, functionName); 2185 _findIdentifier(_enclosingUnit.accessors, functionName);
2187 if ((property as sc.KeywordToken).keyword == sc.Keyword.SET) { 2186 if ((property as KeywordToken).keyword == Keyword.SET) {
2188 accessor = accessor.variable.setter; 2187 accessor = accessor.variable.setter;
2189 functionName.staticElement = accessor; 2188 functionName.staticElement = accessor;
2190 } 2189 }
2191 _enclosingExecutable = accessor; 2190 _enclosingExecutable = accessor;
2192 } 2191 }
2193 } 2192 }
2194 node.functionExpression.element = _enclosingExecutable; 2193 node.functionExpression.element = _enclosingExecutable;
2195 return super.visitFunctionDeclaration(node); 2194 return super.visitFunctionDeclaration(node);
2196 } finally { 2195 } finally {
2197 _enclosingExecutable = outerExecutable; 2196 _enclosingExecutable = outerExecutable;
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
2271 @override 2270 @override
2272 Object visitLibraryDirective(LibraryDirective node) { 2271 Object visitLibraryDirective(LibraryDirective node) {
2273 node.element = _enclosingUnit.library; 2272 node.element = _enclosingUnit.library;
2274 return super.visitLibraryDirective(node); 2273 return super.visitLibraryDirective(node);
2275 } 2274 }
2276 2275
2277 @override 2276 @override
2278 Object visitMethodDeclaration(MethodDeclaration node) { 2277 Object visitMethodDeclaration(MethodDeclaration node) {
2279 ExecutableElement outerExecutable = _enclosingExecutable; 2278 ExecutableElement outerExecutable = _enclosingExecutable;
2280 try { 2279 try {
2281 sc.Token property = node.propertyKeyword; 2280 Token property = node.propertyKeyword;
2282 SimpleIdentifier methodName = node.name; 2281 SimpleIdentifier methodName = node.name;
2283 String nameOfMethod = methodName.name; 2282 String nameOfMethod = methodName.name;
2284 if (property == null) { 2283 if (property == null) {
2285 _enclosingExecutable = _findWithNameAndOffset( 2284 _enclosingExecutable = _findWithNameAndOffset(
2286 _enclosingClass.methods, nameOfMethod, methodName.offset); 2285 _enclosingClass.methods, nameOfMethod, methodName.offset);
2287 methodName.staticElement = _enclosingExecutable; 2286 methodName.staticElement = _enclosingExecutable;
2288 } else { 2287 } else {
2289 PropertyAccessorElement accessor = 2288 PropertyAccessorElement accessor =
2290 _findIdentifier(_enclosingClass.accessors, methodName); 2289 _findIdentifier(_enclosingClass.accessors, methodName);
2291 if ((property as sc.KeywordToken).keyword == sc.Keyword.SET) { 2290 if ((property as KeywordToken).keyword == Keyword.SET) {
2292 accessor = accessor.variable.setter; 2291 accessor = accessor.variable.setter;
2293 methodName.staticElement = accessor; 2292 methodName.staticElement = accessor;
2294 } 2293 }
2295 _enclosingExecutable = accessor; 2294 _enclosingExecutable = accessor;
2296 } 2295 }
2297 return super.visitMethodDeclaration(node); 2296 return super.visitMethodDeclaration(node);
2298 } finally { 2297 } finally {
2299 _enclosingExecutable = outerExecutable; 2298 _enclosingExecutable = outerExecutable;
2300 } 2299 }
2301 } 2300 }
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2911 if (expression != null) { 2910 if (expression != null) {
2912 ElementHolder holder = new ElementHolder(); 2911 ElementHolder holder = new ElementHolder();
2913 bool wasInFunction = _inFunction; 2912 bool wasInFunction = _inFunction;
2914 _inFunction = true; 2913 _inFunction = true;
2915 try { 2914 try {
2916 _visitChildren(holder, node); 2915 _visitChildren(holder, node);
2917 } finally { 2916 } finally {
2918 _inFunction = wasInFunction; 2917 _inFunction = wasInFunction;
2919 } 2918 }
2920 FunctionBody body = expression.body; 2919 FunctionBody body = expression.body;
2921 sc.Token property = node.propertyKeyword; 2920 Token property = node.propertyKeyword;
2922 if (property == null || _inFunction) { 2921 if (property == null || _inFunction) {
2923 SimpleIdentifier functionName = node.name; 2922 SimpleIdentifier functionName = node.name;
2924 FunctionElementImpl element = 2923 FunctionElementImpl element =
2925 new FunctionElementImpl.forNode(functionName); 2924 new FunctionElementImpl.forNode(functionName);
2926 _setDocRange(element, node); 2925 _setDocRange(element, node);
2927 if (node.externalKeyword != null) { 2926 if (node.externalKeyword != null) {
2928 element.external = true; 2927 element.external = true;
2929 } 2928 }
2930 element.functions = holder.functions; 2929 element.functions = holder.functions;
2931 element.labels = holder.labels; 2930 element.labels = holder.labels;
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
3140 try { 3139 try {
3141 ElementHolder holder = new ElementHolder(); 3140 ElementHolder holder = new ElementHolder();
3142 bool wasInFunction = _inFunction; 3141 bool wasInFunction = _inFunction;
3143 _inFunction = true; 3142 _inFunction = true;
3144 try { 3143 try {
3145 _visitChildren(holder, node); 3144 _visitChildren(holder, node);
3146 } finally { 3145 } finally {
3147 _inFunction = wasInFunction; 3146 _inFunction = wasInFunction;
3148 } 3147 }
3149 bool isStatic = node.isStatic; 3148 bool isStatic = node.isStatic;
3150 sc.Token property = node.propertyKeyword; 3149 Token property = node.propertyKeyword;
3151 FunctionBody body = node.body; 3150 FunctionBody body = node.body;
3152 if (property == null) { 3151 if (property == null) {
3153 SimpleIdentifier methodName = node.name; 3152 SimpleIdentifier methodName = node.name;
3154 String nameOfMethod = methodName.name; 3153 String nameOfMethod = methodName.name;
3155 if (nameOfMethod == sc.TokenType.MINUS.lexeme && 3154 if (nameOfMethod == TokenType.MINUS.lexeme &&
3156 node.parameters.parameters.length == 0) { 3155 node.parameters.parameters.length == 0) {
3157 nameOfMethod = "unary-"; 3156 nameOfMethod = "unary-";
3158 } 3157 }
3159 MethodElementImpl element = 3158 MethodElementImpl element =
3160 new MethodElementImpl(nameOfMethod, methodName.offset); 3159 new MethodElementImpl(nameOfMethod, methodName.offset);
3161 _setDocRange(element, node); 3160 _setDocRange(element, node);
3162 element.abstract = node.isAbstract; 3161 element.abstract = node.isAbstract;
3163 if (node.externalKeyword != null) { 3162 if (node.externalKeyword != null) {
3164 element.external = true; 3163 element.external = true;
3165 } 3164 }
(...skipping 980 matching lines...) Expand 10 before | Expand all | Expand 10 after
4146 4145
4147 @override 4146 @override
4148 bool visitAssertStatement(AssertStatement node) => false; 4147 bool visitAssertStatement(AssertStatement node) => false;
4149 4148
4150 @override 4149 @override
4151 bool visitAssignmentExpression(AssignmentExpression node) { 4150 bool visitAssignmentExpression(AssignmentExpression node) {
4152 Expression leftHandSide = node.leftHandSide; 4151 Expression leftHandSide = node.leftHandSide;
4153 if (_nodeExits(leftHandSide)) { 4152 if (_nodeExits(leftHandSide)) {
4154 return true; 4153 return true;
4155 } 4154 }
4156 if (node.operator.type == sc.TokenType.QUESTION_QUESTION_EQ) { 4155 if (node.operator.type == TokenType.QUESTION_QUESTION_EQ) {
4157 return false; 4156 return false;
4158 } 4157 }
4159 if (leftHandSide is PropertyAccess && 4158 if (leftHandSide is PropertyAccess &&
4160 leftHandSide.operator.type == sc.TokenType.QUESTION_PERIOD) { 4159 leftHandSide.operator.type == TokenType.QUESTION_PERIOD) {
4161 return false; 4160 return false;
4162 } 4161 }
4163 return _nodeExits(node.rightHandSide); 4162 return _nodeExits(node.rightHandSide);
4164 } 4163 }
4165 4164
4166 @override 4165 @override
4167 bool visitAwaitExpression(AwaitExpression node) => 4166 bool visitAwaitExpression(AwaitExpression node) =>
4168 _nodeExits(node.expression); 4167 _nodeExits(node.expression);
4169 4168
4170 @override 4169 @override
4171 bool visitBinaryExpression(BinaryExpression node) { 4170 bool visitBinaryExpression(BinaryExpression node) {
4172 Expression lhsExpression = node.leftOperand; 4171 Expression lhsExpression = node.leftOperand;
4173 Expression rhsExpression = node.rightOperand; 4172 Expression rhsExpression = node.rightOperand;
4174 sc.TokenType operatorType = node.operator.type; 4173 TokenType operatorType = node.operator.type;
4175 // If the operator is ||, then only consider the RHS of the binary 4174 // If the operator is ||, then only consider the RHS of the binary
4176 // expression if the left hand side is the false literal. 4175 // expression if the left hand side is the false literal.
4177 // TODO(jwren) Do we want to take constant expressions into account, 4176 // TODO(jwren) Do we want to take constant expressions into account,
4178 // evaluate if(false) {} differently than if(<condition>), when <condition> 4177 // evaluate if(false) {} differently than if(<condition>), when <condition>
4179 // evaluates to a constant false value? 4178 // evaluates to a constant false value?
4180 if (operatorType == sc.TokenType.BAR_BAR) { 4179 if (operatorType == TokenType.BAR_BAR) {
4181 if (lhsExpression is BooleanLiteral) { 4180 if (lhsExpression is BooleanLiteral) {
4182 BooleanLiteral booleanLiteral = lhsExpression; 4181 BooleanLiteral booleanLiteral = lhsExpression;
4183 if (!booleanLiteral.value) { 4182 if (!booleanLiteral.value) {
4184 return _nodeExits(rhsExpression); 4183 return _nodeExits(rhsExpression);
4185 } 4184 }
4186 } 4185 }
4187 return _nodeExits(lhsExpression); 4186 return _nodeExits(lhsExpression);
4188 } 4187 }
4189 // If the operator is &&, then only consider the RHS of the binary 4188 // If the operator is &&, then only consider the RHS of the binary
4190 // expression if the left hand side is the true literal. 4189 // expression if the left hand side is the true literal.
4191 if (operatorType == sc.TokenType.AMPERSAND_AMPERSAND) { 4190 if (operatorType == TokenType.AMPERSAND_AMPERSAND) {
4192 if (lhsExpression is BooleanLiteral) { 4191 if (lhsExpression is BooleanLiteral) {
4193 BooleanLiteral booleanLiteral = lhsExpression; 4192 BooleanLiteral booleanLiteral = lhsExpression;
4194 if (booleanLiteral.value) { 4193 if (booleanLiteral.value) {
4195 return _nodeExits(rhsExpression); 4194 return _nodeExits(rhsExpression);
4196 } 4195 }
4197 } 4196 }
4198 return _nodeExits(lhsExpression); 4197 return _nodeExits(lhsExpression);
4199 } 4198 }
4200 // If the operator is ??, then don't consider the RHS of the binary 4199 // If the operator is ??, then don't consider the RHS of the binary
4201 // expression. 4200 // expression.
4202 if (operatorType == sc.TokenType.QUESTION_QUESTION) { 4201 if (operatorType == TokenType.QUESTION_QUESTION) {
4203 return _nodeExits(lhsExpression); 4202 return _nodeExits(lhsExpression);
4204 } 4203 }
4205 return _nodeExits(lhsExpression) || _nodeExits(rhsExpression); 4204 return _nodeExits(lhsExpression) || _nodeExits(rhsExpression);
4206 } 4205 }
4207 4206
4208 @override 4207 @override
4209 bool visitBlock(Block node) => _visitStatements(node.statements); 4208 bool visitBlock(Block node) => _visitStatements(node.statements);
4210 4209
4211 @override 4210 @override
4212 bool visitBlockFunctionBody(BlockFunctionBody node) => _nodeExits(node.block); 4211 bool visitBlockFunctionBody(BlockFunctionBody node) => _nodeExits(node.block);
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
4393 @override 4392 @override
4394 bool visitLiteral(Literal node) => false; 4393 bool visitLiteral(Literal node) => false;
4395 4394
4396 @override 4395 @override
4397 bool visitMethodInvocation(MethodInvocation node) { 4396 bool visitMethodInvocation(MethodInvocation node) {
4398 Expression target = node.realTarget; 4397 Expression target = node.realTarget;
4399 if (target != null) { 4398 if (target != null) {
4400 if (target.accept(this)) { 4399 if (target.accept(this)) {
4401 return true; 4400 return true;
4402 } 4401 }
4403 if (node.operator.type == sc.TokenType.QUESTION_PERIOD) { 4402 if (node.operator.type == TokenType.QUESTION_PERIOD) {
4404 return false; 4403 return false;
4405 } 4404 }
4406 } 4405 }
4407 return _nodeExits(node.argumentList); 4406 return _nodeExits(node.argumentList);
4408 } 4407 }
4409 4408
4410 @override 4409 @override
4411 bool visitNamedExpression(NamedExpression node) => 4410 bool visitNamedExpression(NamedExpression node) =>
4412 node.expression.accept(this); 4411 node.expression.accept(this);
4413 4412
(...skipping 2070 matching lines...) Expand 10 before | Expand all | Expand 10 after
6484 * @return the created synthetic element 6483 * @return the created synthetic element
6485 */ 6484 */
6486 static ExecutableElement _createSyntheticExecutableElement( 6485 static ExecutableElement _createSyntheticExecutableElement(
6487 List<ExecutableElement> elementArrayToMerge, 6486 List<ExecutableElement> elementArrayToMerge,
6488 String name, 6487 String name,
6489 int numOfRequiredParameters, 6488 int numOfRequiredParameters,
6490 int numOfPositionalParameters, 6489 int numOfPositionalParameters,
6491 List<String> namedParameters) { 6490 List<String> namedParameters) {
6492 DynamicTypeImpl dynamicType = DynamicTypeImpl.instance; 6491 DynamicTypeImpl dynamicType = DynamicTypeImpl.instance;
6493 SimpleIdentifier nameIdentifier = new SimpleIdentifier( 6492 SimpleIdentifier nameIdentifier = new SimpleIdentifier(
6494 new sc.StringToken(sc.TokenType.IDENTIFIER, name, 0)); 6493 new StringToken(TokenType.IDENTIFIER, name, 0));
6495 ExecutableElementImpl executable; 6494 ExecutableElementImpl executable;
6496 if (elementArrayToMerge[0] is MethodElement) { 6495 if (elementArrayToMerge[0] is MethodElement) {
6497 MultiplyInheritedMethodElementImpl unionedMethod = 6496 MultiplyInheritedMethodElementImpl unionedMethod =
6498 new MultiplyInheritedMethodElementImpl(nameIdentifier); 6497 new MultiplyInheritedMethodElementImpl(nameIdentifier);
6499 unionedMethod.inheritedElements = elementArrayToMerge; 6498 unionedMethod.inheritedElements = elementArrayToMerge;
6500 executable = unionedMethod; 6499 executable = unionedMethod;
6501 } else { 6500 } else {
6502 MultiplyInheritedPropertyAccessorElementImpl unionedPropertyAccessor = 6501 MultiplyInheritedPropertyAccessorElementImpl unionedPropertyAccessor =
6503 new MultiplyInheritedPropertyAccessorElementImpl(nameIdentifier); 6502 new MultiplyInheritedPropertyAccessorElementImpl(nameIdentifier);
6504 unionedPropertyAccessor.getter = 6503 unionedPropertyAccessor.getter =
(...skipping 1800 matching lines...) Expand 10 before | Expand all | Expand 10 after
8305 @override 8304 @override
8306 Object visitAssertStatement(AssertStatement node) { 8305 Object visitAssertStatement(AssertStatement node) {
8307 super.visitAssertStatement(node); 8306 super.visitAssertStatement(node);
8308 _propagateTrueState(node.condition); 8307 _propagateTrueState(node.condition);
8309 return null; 8308 return null;
8310 } 8309 }
8311 8310
8312 @override 8311 @override
8313 Object visitAssignmentExpression(AssignmentExpression node) { 8312 Object visitAssignmentExpression(AssignmentExpression node) {
8314 safelyVisit(node.leftHandSide); 8313 safelyVisit(node.leftHandSide);
8315 sc.TokenType operator = node.operator.type; 8314 TokenType operator = node.operator.type;
8316 if (operator == sc.TokenType.EQ || 8315 if (operator == TokenType.EQ ||
8317 operator == sc.TokenType.QUESTION_QUESTION_EQ) { 8316 operator == TokenType.QUESTION_QUESTION_EQ) {
8318 InferenceContext.setType( 8317 InferenceContext.setType(
8319 node.rightHandSide, node.leftHandSide.staticType); 8318 node.rightHandSide, node.leftHandSide.staticType);
8320 } 8319 }
8321 safelyVisit(node.rightHandSide); 8320 safelyVisit(node.rightHandSide);
8322 node.accept(elementResolver); 8321 node.accept(elementResolver);
8323 node.accept(typeAnalyzer); 8322 node.accept(typeAnalyzer);
8324 return null; 8323 return null;
8325 } 8324 }
8326 8325
8327 @override 8326 @override
8328 Object visitAwaitExpression(AwaitExpression node) { 8327 Object visitAwaitExpression(AwaitExpression node) {
8329 //TODO(leafp): Handle the implicit union type here 8328 //TODO(leafp): Handle the implicit union type here
8330 DartType contextType = InferenceContext.getType(node); 8329 DartType contextType = InferenceContext.getType(node);
8331 if (contextType != null) { 8330 if (contextType != null) {
8332 InterfaceType futureT = 8331 InterfaceType futureT =
8333 typeProvider.futureType.substitute4([contextType]); 8332 typeProvider.futureType.substitute4([contextType]);
8334 InferenceContext.setType(node.expression, futureT); 8333 InferenceContext.setType(node.expression, futureT);
8335 } 8334 }
8336 return super.visitAwaitExpression(node); 8335 return super.visitAwaitExpression(node);
8337 } 8336 }
8338 8337
8339 @override 8338 @override
8340 Object visitBinaryExpression(BinaryExpression node) { 8339 Object visitBinaryExpression(BinaryExpression node) {
8341 sc.TokenType operatorType = node.operator.type; 8340 TokenType operatorType = node.operator.type;
8342 Expression leftOperand = node.leftOperand; 8341 Expression leftOperand = node.leftOperand;
8343 Expression rightOperand = node.rightOperand; 8342 Expression rightOperand = node.rightOperand;
8344 if (operatorType == sc.TokenType.AMPERSAND_AMPERSAND) { 8343 if (operatorType == TokenType.AMPERSAND_AMPERSAND) {
8345 safelyVisit(leftOperand); 8344 safelyVisit(leftOperand);
8346 if (rightOperand != null) { 8345 if (rightOperand != null) {
8347 _overrideManager.enterScope(); 8346 _overrideManager.enterScope();
8348 try { 8347 try {
8349 _promoteManager.enterScope(); 8348 _promoteManager.enterScope();
8350 try { 8349 try {
8351 _propagateTrueState(leftOperand); 8350 _propagateTrueState(leftOperand);
8352 // Type promotion. 8351 // Type promotion.
8353 _promoteTypes(leftOperand); 8352 _promoteTypes(leftOperand);
8354 _clearTypePromotionsIfPotentiallyMutatedIn(leftOperand); 8353 _clearTypePromotionsIfPotentiallyMutatedIn(leftOperand);
8355 _clearTypePromotionsIfPotentiallyMutatedIn(rightOperand); 8354 _clearTypePromotionsIfPotentiallyMutatedIn(rightOperand);
8356 _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated( 8355 _clearTypePromotionsIfAccessedInClosureAndProtentiallyMutated(
8357 rightOperand); 8356 rightOperand);
8358 // Visit right operand. 8357 // Visit right operand.
8359 rightOperand.accept(this); 8358 rightOperand.accept(this);
8360 } finally { 8359 } finally {
8361 _promoteManager.exitScope(); 8360 _promoteManager.exitScope();
8362 } 8361 }
8363 } finally { 8362 } finally {
8364 _overrideManager.exitScope(); 8363 _overrideManager.exitScope();
8365 } 8364 }
8366 } 8365 }
8367 } else if (operatorType == sc.TokenType.BAR_BAR) { 8366 } else if (operatorType == TokenType.BAR_BAR) {
8368 safelyVisit(leftOperand); 8367 safelyVisit(leftOperand);
8369 if (rightOperand != null) { 8368 if (rightOperand != null) {
8370 _overrideManager.enterScope(); 8369 _overrideManager.enterScope();
8371 try { 8370 try {
8372 _propagateFalseState(leftOperand); 8371 _propagateFalseState(leftOperand);
8373 rightOperand.accept(this); 8372 rightOperand.accept(this);
8374 } finally { 8373 } finally {
8375 _overrideManager.exitScope(); 8374 _overrideManager.exitScope();
8376 } 8375 }
8377 } 8376 }
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after
9600 _promoteManager.setType(element, potentialType); 9599 _promoteManager.setType(element, potentialType);
9601 } 9600 }
9602 } 9601 }
9603 9602
9604 /** 9603 /**
9605 * Promotes type information using given condition. 9604 * Promotes type information using given condition.
9606 */ 9605 */
9607 void _promoteTypes(Expression condition) { 9606 void _promoteTypes(Expression condition) {
9608 if (condition is BinaryExpression) { 9607 if (condition is BinaryExpression) {
9609 BinaryExpression binary = condition; 9608 BinaryExpression binary = condition;
9610 if (binary.operator.type == sc.TokenType.AMPERSAND_AMPERSAND) { 9609 if (binary.operator.type == TokenType.AMPERSAND_AMPERSAND) {
9611 Expression left = binary.leftOperand; 9610 Expression left = binary.leftOperand;
9612 Expression right = binary.rightOperand; 9611 Expression right = binary.rightOperand;
9613 _promoteTypes(left); 9612 _promoteTypes(left);
9614 _promoteTypes(right); 9613 _promoteTypes(right);
9615 _clearTypePromotionsIfPotentiallyMutatedIn(right); 9614 _clearTypePromotionsIfPotentiallyMutatedIn(right);
9616 } 9615 }
9617 } else if (condition is IsExpression) { 9616 } else if (condition is IsExpression) {
9618 IsExpression is2 = condition; 9617 IsExpression is2 = condition;
9619 if (is2.notOperator == null) { 9618 if (is2.notOperator == null) {
9620 _promote(is2.expression, is2.type.type); 9619 _promote(is2.expression, is2.type.type);
9621 } 9620 }
9622 } else if (condition is ParenthesizedExpression) { 9621 } else if (condition is ParenthesizedExpression) {
9623 _promoteTypes(condition.expression); 9622 _promoteTypes(condition.expression);
9624 } 9623 }
9625 } 9624 }
9626 9625
9627 /** 9626 /**
9628 * Propagate any type information that results from knowing that the given con dition will have 9627 * Propagate any type information that results from knowing that the given con dition will have
9629 * been evaluated to 'false'. 9628 * been evaluated to 'false'.
9630 * 9629 *
9631 * @param condition the condition that will have evaluated to 'false' 9630 * @param condition the condition that will have evaluated to 'false'
9632 */ 9631 */
9633 void _propagateFalseState(Expression condition) { 9632 void _propagateFalseState(Expression condition) {
9634 if (condition is BinaryExpression) { 9633 if (condition is BinaryExpression) {
9635 BinaryExpression binary = condition; 9634 BinaryExpression binary = condition;
9636 if (binary.operator.type == sc.TokenType.BAR_BAR) { 9635 if (binary.operator.type == TokenType.BAR_BAR) {
9637 _propagateFalseState(binary.leftOperand); 9636 _propagateFalseState(binary.leftOperand);
9638 _propagateFalseState(binary.rightOperand); 9637 _propagateFalseState(binary.rightOperand);
9639 } 9638 }
9640 } else if (condition is IsExpression) { 9639 } else if (condition is IsExpression) {
9641 IsExpression is2 = condition; 9640 IsExpression is2 = condition;
9642 if (is2.notOperator != null) { 9641 if (is2.notOperator != null) {
9643 // Since an is-statement doesn't actually change the type, we don't 9642 // Since an is-statement doesn't actually change the type, we don't
9644 // let it affect the propagated type when it would result in a loss 9643 // let it affect the propagated type when it would result in a loss
9645 // of precision. 9644 // of precision.
9646 overrideExpression(is2.expression, is2.type.type, false, false); 9645 overrideExpression(is2.expression, is2.type.type, false, false);
9647 } 9646 }
9648 } else if (condition is PrefixExpression) { 9647 } else if (condition is PrefixExpression) {
9649 PrefixExpression prefix = condition; 9648 PrefixExpression prefix = condition;
9650 if (prefix.operator.type == sc.TokenType.BANG) { 9649 if (prefix.operator.type == TokenType.BANG) {
9651 _propagateTrueState(prefix.operand); 9650 _propagateTrueState(prefix.operand);
9652 } 9651 }
9653 } else if (condition is ParenthesizedExpression) { 9652 } else if (condition is ParenthesizedExpression) {
9654 _propagateFalseState(condition.expression); 9653 _propagateFalseState(condition.expression);
9655 } 9654 }
9656 } 9655 }
9657 9656
9658 /** 9657 /**
9659 * Propagate any type information that results from knowing that the given exp ression will have 9658 * Propagate any type information that results from knowing that the given exp ression will have
9660 * been evaluated without altering the flow of execution. 9659 * been evaluated without altering the flow of execution.
9661 * 9660 *
9662 * @param expression the expression that will have been evaluated 9661 * @param expression the expression that will have been evaluated
9663 */ 9662 */
9664 void _propagateState(Expression expression) { 9663 void _propagateState(Expression expression) {
9665 // TODO(brianwilkerson) Implement this. 9664 // TODO(brianwilkerson) Implement this.
9666 } 9665 }
9667 9666
9668 /** 9667 /**
9669 * Propagate any type information that results from knowing that the given con dition will have 9668 * Propagate any type information that results from knowing that the given con dition will have
9670 * been evaluated to 'true'. 9669 * been evaluated to 'true'.
9671 * 9670 *
9672 * @param condition the condition that will have evaluated to 'true' 9671 * @param condition the condition that will have evaluated to 'true'
9673 */ 9672 */
9674 void _propagateTrueState(Expression condition) { 9673 void _propagateTrueState(Expression condition) {
9675 if (condition is BinaryExpression) { 9674 if (condition is BinaryExpression) {
9676 BinaryExpression binary = condition; 9675 BinaryExpression binary = condition;
9677 if (binary.operator.type == sc.TokenType.AMPERSAND_AMPERSAND) { 9676 if (binary.operator.type == TokenType.AMPERSAND_AMPERSAND) {
9678 _propagateTrueState(binary.leftOperand); 9677 _propagateTrueState(binary.leftOperand);
9679 _propagateTrueState(binary.rightOperand); 9678 _propagateTrueState(binary.rightOperand);
9680 } 9679 }
9681 } else if (condition is IsExpression) { 9680 } else if (condition is IsExpression) {
9682 IsExpression is2 = condition; 9681 IsExpression is2 = condition;
9683 if (is2.notOperator == null) { 9682 if (is2.notOperator == null) {
9684 // Since an is-statement doesn't actually change the type, we don't 9683 // Since an is-statement doesn't actually change the type, we don't
9685 // let it affect the propagated type when it would result in a loss 9684 // let it affect the propagated type when it would result in a loss
9686 // of precision. 9685 // of precision.
9687 overrideExpression(is2.expression, is2.type.type, false, false); 9686 overrideExpression(is2.expression, is2.type.type, false, false);
9688 } 9687 }
9689 } else if (condition is PrefixExpression) { 9688 } else if (condition is PrefixExpression) {
9690 PrefixExpression prefix = condition; 9689 PrefixExpression prefix = condition;
9691 if (prefix.operator.type == sc.TokenType.BANG) { 9690 if (prefix.operator.type == TokenType.BANG) {
9692 _propagateFalseState(prefix.operand); 9691 _propagateFalseState(prefix.operand);
9693 } 9692 }
9694 } else if (condition is ParenthesizedExpression) { 9693 } else if (condition is ParenthesizedExpression) {
9695 _propagateTrueState(condition.expression); 9694 _propagateTrueState(condition.expression);
9696 } 9695 }
9697 } 9696 }
9698 } 9697 }
9699 9698
9700 /** 9699 /**
9701 * The abstract class `Scope` defines the behavior common to name scopes used by the resolver 9700 * The abstract class `Scope` defines the behavior common to name scopes used by the resolver
(...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
10017 new AnalysisError(source, offset, length, errorCode, arguments)); 10016 new AnalysisError(source, offset, length, errorCode, arguments));
10018 } 10017 }
10019 10018
10020 /** 10019 /**
10021 * Report an error with the given error code and arguments. 10020 * Report an error with the given error code and arguments.
10022 * 10021 *
10023 * @param errorCode the error code of the error to be reported 10022 * @param errorCode the error code of the error to be reported
10024 * @param token the token specifying the location of the error 10023 * @param token the token specifying the location of the error
10025 * @param arguments the arguments to the error, used to compose the error mess age 10024 * @param arguments the arguments to the error, used to compose the error mess age
10026 */ 10025 */
10027 void reportErrorForToken(ErrorCode errorCode, sc.Token token, 10026 void reportErrorForToken(ErrorCode errorCode, Token token,
10028 [List<Object> arguments]) { 10027 [List<Object> arguments]) {
10029 errorListener.onError(new AnalysisError( 10028 errorListener.onError(new AnalysisError(
10030 source, token.offset, token.length, errorCode, arguments)); 10029 source, token.offset, token.length, errorCode, arguments));
10031 } 10030 }
10032 10031
10033 /** 10032 /**
10034 * Visit the given AST node if it is not null. 10033 * Visit the given AST node if it is not null.
10035 * 10034 *
10036 * @param node the node to be visited 10035 * @param node the node to be visited
10037 */ 10036 */
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
10760 void findIn(CompilationUnit unit) { 10759 void findIn(CompilationUnit unit) {
10761 _gatherTodoComments(unit.beginToken); 10760 _gatherTodoComments(unit.beginToken);
10762 } 10761 }
10763 10762
10764 /** 10763 /**
10765 * Search the comment tokens reachable from the given token and create errors for each to-do 10764 * Search the comment tokens reachable from the given token and create errors for each to-do
10766 * comment. 10765 * comment.
10767 * 10766 *
10768 * @param token the head of the list of tokens being searched 10767 * @param token the head of the list of tokens being searched
10769 */ 10768 */
10770 void _gatherTodoComments(sc.Token token) { 10769 void _gatherTodoComments(Token token) {
10771 while (token != null && token.type != sc.TokenType.EOF) { 10770 while (token != null && token.type != TokenType.EOF) {
10772 sc.Token commentToken = token.precedingComments; 10771 Token commentToken = token.precedingComments;
10773 while (commentToken != null) { 10772 while (commentToken != null) {
10774 if (commentToken.type == sc.TokenType.SINGLE_LINE_COMMENT || 10773 if (commentToken.type == TokenType.SINGLE_LINE_COMMENT ||
10775 commentToken.type == sc.TokenType.MULTI_LINE_COMMENT) { 10774 commentToken.type == TokenType.MULTI_LINE_COMMENT) {
10776 _scrapeTodoComment(commentToken); 10775 _scrapeTodoComment(commentToken);
10777 } 10776 }
10778 commentToken = commentToken.next; 10777 commentToken = commentToken.next;
10779 } 10778 }
10780 token = token.next; 10779 token = token.next;
10781 } 10780 }
10782 } 10781 }
10783 10782
10784 /** 10783 /**
10785 * Look for user defined tasks in comments and convert them into info level an alysis issues. 10784 * Look for user defined tasks in comments and convert them into info level an alysis issues.
10786 * 10785 *
10787 * @param commentToken the comment token to analyze 10786 * @param commentToken the comment token to analyze
10788 */ 10787 */
10789 void _scrapeTodoComment(sc.Token commentToken) { 10788 void _scrapeTodoComment(Token commentToken) {
10790 JavaPatternMatcher matcher = 10789 JavaPatternMatcher matcher =
10791 new JavaPatternMatcher(TodoCode.TODO_REGEX, commentToken.lexeme); 10790 new JavaPatternMatcher(TodoCode.TODO_REGEX, commentToken.lexeme);
10792 if (matcher.find()) { 10791 if (matcher.find()) {
10793 int offset = 10792 int offset =
10794 commentToken.offset + matcher.start() + matcher.group(1).length; 10793 commentToken.offset + matcher.start() + matcher.group(1).length;
10795 int length = matcher.group(2).length; 10794 int length = matcher.group(2).length;
10796 _errorReporter.reportErrorForOffset( 10795 _errorReporter.reportErrorForOffset(
10797 TodoCode.TODO, offset, length, [matcher.group(2)]); 10796 TodoCode.TODO, offset, length, [matcher.group(2)]);
10798 } 10797 }
10799 } 10798 }
(...skipping 1854 matching lines...) Expand 10 before | Expand all | Expand 10 after
12654 ClassElement element = type.element; 12653 ClassElement element = type.element;
12655 if (element != null && element.isEnum) { 12654 if (element != null && element.isEnum) {
12656 reportErrorForNode(enumTypeError, typeName); 12655 reportErrorForNode(enumTypeError, typeName);
12657 return null; 12656 return null;
12658 } 12657 }
12659 return type; 12658 return type;
12660 } 12659 }
12661 // If the type is not an InterfaceType, then visitTypeName() sets the type 12660 // If the type is not an InterfaceType, then visitTypeName() sets the type
12662 // to be a DynamicTypeImpl 12661 // to be a DynamicTypeImpl
12663 Identifier name = typeName.name; 12662 Identifier name = typeName.name;
12664 if (name.name == sc.Keyword.DYNAMIC.syntax) { 12663 if (name.name == Keyword.DYNAMIC.syntax) {
12665 reportErrorForNode(dynamicTypeError, name, [name.name]); 12664 reportErrorForNode(dynamicTypeError, name, [name.name]);
12666 } else { 12665 } else {
12667 reportErrorForNode(nonTypeError, name, [name.name]); 12666 reportErrorForNode(nonTypeError, name, [name.name]);
12668 } 12667 }
12669 return null; 12668 return null;
12670 } 12669 }
12671 12670
12672 /** 12671 /**
12673 * Resolve the types in the given list of type names. 12672 * Resolve the types in the given list of type names.
12674 * 12673 *
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
12727 functionElement.shareParameters(parameters); 12726 functionElement.shareParameters(parameters);
12728 functionElement.returnType = _computeReturnType(returnType); 12727 functionElement.returnType = _computeReturnType(returnType);
12729 functionElement.enclosingElement = element; 12728 functionElement.enclosingElement = element;
12730 element.type = new FunctionTypeImpl(functionElement); 12729 element.type = new FunctionTypeImpl(functionElement);
12731 } 12730 }
12732 12731
12733 /** 12732 /**
12734 * @return `true` if the name of the given [TypeName] is an built-in identifie r. 12733 * @return `true` if the name of the given [TypeName] is an built-in identifie r.
12735 */ 12734 */
12736 static bool _isBuiltInIdentifier(TypeName node) { 12735 static bool _isBuiltInIdentifier(TypeName node) {
12737 sc.Token token = node.name.beginToken; 12736 Token token = node.name.beginToken;
12738 return token.type == sc.TokenType.KEYWORD; 12737 return token.type == TokenType.KEYWORD;
12739 } 12738 }
12740 12739
12741 /** 12740 /**
12742 * @return `true` if given [TypeName] is used as a type annotation. 12741 * @return `true` if given [TypeName] is used as a type annotation.
12743 */ 12742 */
12744 static bool _isTypeAnnotation(TypeName node) { 12743 static bool _isTypeAnnotation(TypeName node) {
12745 AstNode parent = node.parent; 12744 AstNode parent = node.parent;
12746 if (parent is VariableDeclarationList) { 12745 if (parent is VariableDeclarationList) {
12747 return identical(parent.type, node); 12746 return identical(parent.type, node);
12748 } 12747 }
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after
13316 nonFields.add(node); 13315 nonFields.add(node);
13317 return null; 13316 return null;
13318 } 13317 }
13319 13318
13320 @override 13319 @override
13321 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 13320 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
13322 13321
13323 @override 13322 @override
13324 Object visitWithClause(WithClause node) => null; 13323 Object visitWithClause(WithClause node) => null;
13325 } 13324 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/parser.dart ('k') | pkg/analyzer/lib/src/generated/scanner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698