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

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

Issue 1526973005: Replace using '_commentBeforeFunction' with visitXyzInScope(). (Closed) Base URL: git@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 | « no previous file | pkg/analyzer/test/generated/non_error_resolver_test.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 analyzer.src.generated.resolver; 5 library analyzer.src.generated.resolver;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
(...skipping 7938 matching lines...) Expand 10 before | Expand all | Expand 10 after
7949 * `null` if the current node is not contained in a function type alias. 7949 * `null` if the current node is not contained in a function type alias.
7950 */ 7950 */
7951 FunctionTypeAlias _enclosingFunctionTypeAlias = null; 7951 FunctionTypeAlias _enclosingFunctionTypeAlias = null;
7952 7952
7953 /** 7953 /**
7954 * The element representing the function containing the current node, or `null ` if the 7954 * The element representing the function containing the current node, or `null ` if the
7955 * current node is not contained in a function. 7955 * current node is not contained in a function.
7956 */ 7956 */
7957 ExecutableElement _enclosingFunction = null; 7957 ExecutableElement _enclosingFunction = null;
7958 7958
7959 /**
7960 * The [Comment] before a [FunctionDeclaration] or a [MethodDeclaration] that
7961 * cannot be resolved where we visited it, because it should be resolved in th e scope of the body.
7962 */
7963 Comment _commentBeforeFunction = null;
7964
7965 InferenceContext inferenceContext = null; 7959 InferenceContext inferenceContext = null;
7966 7960
7967 /** 7961 /**
7968 * The object keeping track of which elements have had their types overridden. 7962 * The object keeping track of which elements have had their types overridden.
7969 */ 7963 */
7970 TypeOverrideManager _overrideManager = new TypeOverrideManager(); 7964 TypeOverrideManager _overrideManager = new TypeOverrideManager();
7971 7965
7972 /** 7966 /**
7973 * The object keeping track of which elements have had their types promoted. 7967 * The object keeping track of which elements have had their types promoted.
7974 */ 7968 */
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
8115 8109
8116 /** 8110 /**
8117 * Prepares this [ResolverVisitor] to using it for incremental resolution. 8111 * Prepares this [ResolverVisitor] to using it for incremental resolution.
8118 */ 8112 */
8119 void initForIncrementalResolution([Declaration declaration = null]) { 8113 void initForIncrementalResolution([Declaration declaration = null]) {
8120 if (declaration != null) { 8114 if (declaration != null) {
8121 Element element = declaration.element; 8115 Element element = declaration.element;
8122 if (element is ExecutableElement) { 8116 if (element is ExecutableElement) {
8123 _enclosingFunction = element; 8117 _enclosingFunction = element;
8124 } 8118 }
8125 _commentBeforeFunction = declaration.documentationComment;
8126 } 8119 }
8127 _overrideManager.enterScope(); 8120 _overrideManager.enterScope();
8128 } 8121 }
8129 8122
8130 /** 8123 /**
8131 * If it is appropriate to do so, override the current type of the static and propagated elements 8124 * If it is appropriate to do so, override the current type of the static and propagated elements
8132 * associated with the given expression with the given type. Generally speakin g, it is appropriate 8125 * associated with the given expression with the given type. Generally speakin g, it is appropriate
8133 * if the given type is more specific than the current type. 8126 * if the given type is more specific than the current type.
8134 * 8127 *
8135 * @param expression the expression used to access the static and propagated e lements whose types 8128 * @param expression the expression used to access the static and propagated e lements whose types
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
8410 safelyVisit(leftOperand); 8403 safelyVisit(leftOperand);
8411 safelyVisit(rightOperand); 8404 safelyVisit(rightOperand);
8412 } 8405 }
8413 node.accept(elementResolver); 8406 node.accept(elementResolver);
8414 node.accept(typeAnalyzer); 8407 node.accept(typeAnalyzer);
8415 return null; 8408 return null;
8416 } 8409 }
8417 8410
8418 @override 8411 @override
8419 Object visitBlockFunctionBody(BlockFunctionBody node) { 8412 Object visitBlockFunctionBody(BlockFunctionBody node) {
8420 safelyVisit(_commentBeforeFunction);
8421 _overrideManager.enterScope(); 8413 _overrideManager.enterScope();
8422 try { 8414 try {
8423 inferenceContext.pushReturnContext(InferenceContext.getType(node)); 8415 inferenceContext.pushReturnContext(InferenceContext.getType(node));
8424 super.visitBlockFunctionBody(node); 8416 super.visitBlockFunctionBody(node);
8425 } finally { 8417 } finally {
8426 _overrideManager.exitScope(); 8418 _overrideManager.exitScope();
8427 inferenceContext.popReturnContext(); 8419 inferenceContext.popReturnContext();
8428 } 8420 }
8429 return null; 8421 return null;
8430 } 8422 }
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
8495 node.accept(typeAnalyzer); 8487 node.accept(typeAnalyzer);
8496 } 8488 }
8497 8489
8498 @override 8490 @override
8499 Object visitComment(Comment node) { 8491 Object visitComment(Comment node) {
8500 AstNode parent = node.parent; 8492 AstNode parent = node.parent;
8501 if (parent is FunctionDeclaration || 8493 if (parent is FunctionDeclaration ||
8502 parent is FunctionTypeAlias || 8494 parent is FunctionTypeAlias ||
8503 parent is ConstructorDeclaration || 8495 parent is ConstructorDeclaration ||
8504 parent is MethodDeclaration) { 8496 parent is MethodDeclaration) {
8505 if (!identical(node, _commentBeforeFunction)) { 8497 return null;
8506 _commentBeforeFunction = node;
8507 return null;
8508 }
8509 } 8498 }
8510 super.visitComment(node); 8499 super.visitComment(node);
8511 _commentBeforeFunction = null;
8512 return null; 8500 return null;
8513 } 8501 }
8514 8502
8515 @override 8503 @override
8516 Object visitCommentReference(CommentReference node) { 8504 Object visitCommentReference(CommentReference node) {
8517 // 8505 //
8518 // We do not visit the identifier because it needs to be visited in the 8506 // We do not visit the identifier because it needs to be visited in the
8519 // context of the reference. 8507 // context of the reference.
8520 // 8508 //
8521 node.accept(elementResolver); 8509 node.accept(elementResolver);
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
8626 } finally { 8614 } finally {
8627 _enclosingFunction = outerFunction; 8615 _enclosingFunction = outerFunction;
8628 } 8616 }
8629 ConstructorElementImpl constructor = node.element; 8617 ConstructorElementImpl constructor = node.element;
8630 constructor.constantInitializers = 8618 constructor.constantInitializers =
8631 new ConstantAstCloner().cloneNodeList(node.initializers); 8619 new ConstantAstCloner().cloneNodeList(node.initializers);
8632 return null; 8620 return null;
8633 } 8621 }
8634 8622
8635 @override 8623 @override
8624 void visitConstructorDeclarationInScope(ConstructorDeclaration node) {
8625 super.visitConstructorDeclarationInScope(node);
8626 if (node.documentationComment != null) {
Brian Wilkerson 2015/12/17 14:54:21 These three lines occur often enough that it might
scheglov 2015/12/17 18:52:04 Done.
8627 super.visitComment(node.documentationComment);
8628 }
8629 }
8630
8631 @override
8636 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) { 8632 Object visitConstructorFieldInitializer(ConstructorFieldInitializer node) {
8637 // 8633 //
8638 // We visit the expression, but do not visit the field name because it needs 8634 // We visit the expression, but do not visit the field name because it needs
8639 // to be visited in the context of the constructor field initializer node. 8635 // to be visited in the context of the constructor field initializer node.
8640 // 8636 //
8641 FieldElement fieldElement = enclosingClass.getField(node.fieldName.name); 8637 FieldElement fieldElement = enclosingClass.getField(node.fieldName.name);
8642 InferenceContext.setType(node.expression, fieldElement?.type); 8638 InferenceContext.setType(node.expression, fieldElement?.type);
8643 safelyVisit(node.expression); 8639 safelyVisit(node.expression);
8644 node.accept(elementResolver); 8640 node.accept(elementResolver);
8645 node.accept(typeAnalyzer); 8641 node.accept(typeAnalyzer);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
8699 } finally { 8695 } finally {
8700 _overrideManager.exitScope(); 8696 _overrideManager.exitScope();
8701 } 8697 }
8702 // TODO(brianwilkerson) If the loop can only be exited because the condition 8698 // TODO(brianwilkerson) If the loop can only be exited because the condition
8703 // is false, then propagateFalseState(node.getCondition()); 8699 // is false, then propagateFalseState(node.getCondition());
8704 return null; 8700 return null;
8705 } 8701 }
8706 8702
8707 @override 8703 @override
8708 Object visitEmptyFunctionBody(EmptyFunctionBody node) { 8704 Object visitEmptyFunctionBody(EmptyFunctionBody node) {
8709 safelyVisit(_commentBeforeFunction);
8710 if (resolveOnlyCommentInFunctionBody) { 8705 if (resolveOnlyCommentInFunctionBody) {
8711 return null; 8706 return null;
8712 } 8707 }
8713 return super.visitEmptyFunctionBody(node); 8708 return super.visitEmptyFunctionBody(node);
8714 } 8709 }
8715 8710
8716 @override 8711 @override
8717 Object visitEnumDeclaration(EnumDeclaration node) { 8712 Object visitEnumDeclaration(EnumDeclaration node) {
8718 // 8713 //
8719 // Resolve the metadata in the library scope 8714 // Resolve the metadata in the library scope
(...skipping 17 matching lines...) Expand all
8737 } finally { 8732 } finally {
8738 typeAnalyzer.thisType = outerType == null ? null : outerType.type; 8733 typeAnalyzer.thisType = outerType == null ? null : outerType.type;
8739 enclosingClass = outerType; 8734 enclosingClass = outerType;
8740 _enclosingClassDeclaration = null; 8735 _enclosingClassDeclaration = null;
8741 } 8736 }
8742 return null; 8737 return null;
8743 } 8738 }
8744 8739
8745 @override 8740 @override
8746 Object visitExpressionFunctionBody(ExpressionFunctionBody node) { 8741 Object visitExpressionFunctionBody(ExpressionFunctionBody node) {
8747 safelyVisit(_commentBeforeFunction);
8748 if (resolveOnlyCommentInFunctionBody) { 8742 if (resolveOnlyCommentInFunctionBody) {
8749 return null; 8743 return null;
8750 } 8744 }
8751 _overrideManager.enterScope(); 8745 _overrideManager.enterScope();
8752 try { 8746 try {
8753 InferenceContext.setTypeFromNode(node.expression, node); 8747 InferenceContext.setTypeFromNode(node.expression, node);
8754 super.visitExpressionFunctionBody(node); 8748 super.visitExpressionFunctionBody(node);
8755 } finally { 8749 } finally {
8756 _overrideManager.exitScope(); 8750 _overrideManager.exitScope();
8757 } 8751 }
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
8875 InferenceContext.setType( 8869 InferenceContext.setType(
8876 node.functionExpression, _enclosingFunction.type); 8870 node.functionExpression, _enclosingFunction.type);
8877 super.visitFunctionDeclaration(node); 8871 super.visitFunctionDeclaration(node);
8878 } finally { 8872 } finally {
8879 _enclosingFunction = outerFunction; 8873 _enclosingFunction = outerFunction;
8880 } 8874 }
8881 return null; 8875 return null;
8882 } 8876 }
8883 8877
8884 @override 8878 @override
8879 void visitFunctionDeclarationInScope(FunctionDeclaration node) {
8880 super.visitFunctionDeclarationInScope(node);
8881 if (node.documentationComment != null) {
8882 super.visitComment(node.documentationComment);
8883 }
8884 }
8885
8886 @override
8885 Object visitFunctionExpression(FunctionExpression node) { 8887 Object visitFunctionExpression(FunctionExpression node) {
8886 ExecutableElement outerFunction = _enclosingFunction; 8888 ExecutableElement outerFunction = _enclosingFunction;
8887 try { 8889 try {
8888 _enclosingFunction = node.element; 8890 _enclosingFunction = node.element;
8889 _overrideManager.enterScope(); 8891 _overrideManager.enterScope();
8890 try { 8892 try {
8891 DartType functionType = InferenceContext.getType(node); 8893 DartType functionType = InferenceContext.getType(node);
8892 if (functionType is FunctionType) { 8894 if (functionType is FunctionType) {
8893 _inferFormalParameterList(node.parameters, functionType); 8895 _inferFormalParameterList(node.parameters, functionType);
8894 InferenceContext.setType(node.body, functionType.returnType); 8896 InferenceContext.setType(node.body, functionType.returnType);
(...skipping 29 matching lines...) Expand all
8924 _enclosingFunctionTypeAlias = node; 8926 _enclosingFunctionTypeAlias = node;
8925 try { 8927 try {
8926 super.visitFunctionTypeAlias(node); 8928 super.visitFunctionTypeAlias(node);
8927 } finally { 8929 } finally {
8928 _enclosingFunctionTypeAlias = outerAlias; 8930 _enclosingFunctionTypeAlias = outerAlias;
8929 } 8931 }
8930 return null; 8932 return null;
8931 } 8933 }
8932 8934
8933 @override 8935 @override
8934 Object visitFormalParameterList(FormalParameterList node) { 8936 void visitFunctionTypeAliasInScope(FunctionTypeAlias node) {
8935 super.visitFormalParameterList(node); 8937 super.visitFunctionTypeAliasInScope(node);
8936 if (_commentBeforeFunction != null) { 8938 if (node.documentationComment != null) {
8937 safelyVisit(_commentBeforeFunction); 8939 super.visitComment(node.documentationComment);
8938 _commentBeforeFunction = null;
8939 } 8940 }
8940 return null;
8941 } 8941 }
8942 8942
8943 @override 8943 @override
8944 Object visitHideCombinator(HideCombinator node) => null; 8944 Object visitHideCombinator(HideCombinator node) => null;
8945 8945
8946 @override 8946 @override
8947 Object visitIfStatement(IfStatement node) { 8947 Object visitIfStatement(IfStatement node) {
8948 Expression condition = node.condition; 8948 Expression condition = node.condition;
8949 safelyVisit(condition); 8949 safelyVisit(condition);
8950 Map<VariableElement, DartType> thenOverrides = 8950 Map<VariableElement, DartType> thenOverrides =
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
9102 _enclosingFunction = node.element; 9102 _enclosingFunction = node.element;
9103 InferenceContext.setType(node.body, node.element.type?.returnType); 9103 InferenceContext.setType(node.body, node.element.type?.returnType);
9104 super.visitMethodDeclaration(node); 9104 super.visitMethodDeclaration(node);
9105 } finally { 9105 } finally {
9106 _enclosingFunction = outerFunction; 9106 _enclosingFunction = outerFunction;
9107 } 9107 }
9108 return null; 9108 return null;
9109 } 9109 }
9110 9110
9111 @override 9111 @override
9112 void visitMethodDeclarationInScope(MethodDeclaration node) {
9113 super.visitMethodDeclarationInScope(node);
9114 if (node.documentationComment != null) {
9115 super.visitComment(node.documentationComment);
9116 }
9117 }
9118
9119 @override
9112 Object visitMethodInvocation(MethodInvocation node) { 9120 Object visitMethodInvocation(MethodInvocation node) {
9113 // 9121 //
9114 // We visit the target and argument list, but do not visit the method name 9122 // We visit the target and argument list, but do not visit the method name
9115 // because it needs to be visited in the context of the invocation. 9123 // because it needs to be visited in the context of the invocation.
9116 // 9124 //
9117 safelyVisit(node.target); 9125 safelyVisit(node.target);
9118 safelyVisit(node.typeArguments); 9126 safelyVisit(node.typeArguments);
9119 node.accept(elementResolver); 9127 node.accept(elementResolver);
9120 _inferFunctionExpressionsParametersTypes(node.argumentList); 9128 _inferFunctionExpressionsParametersTypes(node.argumentList);
9121 Element methodElement = node.methodName.staticElement; 9129 Element methodElement = node.methodName.staticElement;
(...skipping 1078 matching lines...) Expand 10 before | Expand all | Expand 10 after
10200 buffer.write("."); 10208 buffer.write(".");
10201 buffer.write(node.name.name); 10209 buffer.write(node.name.name);
10202 } 10210 }
10203 buffer.write(" in "); 10211 buffer.write(" in ");
10204 buffer.write(definingLibrary.source.fullName); 10212 buffer.write(definingLibrary.source.fullName);
10205 AnalysisEngine.instance.logger.logInformation(buffer.toString(), 10213 AnalysisEngine.instance.logger.logInformation(buffer.toString(),
10206 new CaughtException(new AnalysisException(), null)); 10214 new CaughtException(new AnalysisException(), null));
10207 } else { 10215 } else {
10208 nameScope = new FunctionScope(nameScope, constructorElement); 10216 nameScope = new FunctionScope(nameScope, constructorElement);
10209 } 10217 }
10210 super.visitConstructorDeclaration(node); 10218 visitConstructorDeclarationInScope(node);
10211 } finally { 10219 } finally {
10212 nameScope = outerScope; 10220 nameScope = outerScope;
10213 } 10221 }
10214 return null; 10222 return null;
10215 } 10223 }
10216 10224
10225 void visitConstructorDeclarationInScope(ConstructorDeclaration node) {
10226 super.visitConstructorDeclaration(node);
10227 }
10228
10217 @override 10229 @override
10218 Object visitDeclaredIdentifier(DeclaredIdentifier node) { 10230 Object visitDeclaredIdentifier(DeclaredIdentifier node) {
10219 VariableElement element = node.element; 10231 VariableElement element = node.element;
10220 if (element != null) { 10232 if (element != null) {
10221 nameScope.define(element); 10233 nameScope.define(element);
10222 } 10234 }
10223 super.visitDeclaredIdentifier(node); 10235 super.visitDeclaredIdentifier(node);
10224 return null; 10236 return null;
10225 } 10237 }
10226 10238
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
10358 } 10370 }
10359 Scope outerScope = nameScope; 10371 Scope outerScope = nameScope;
10360 try { 10372 try {
10361 if (functionElement == null) { 10373 if (functionElement == null) {
10362 AnalysisEngine.instance.logger.logInformation( 10374 AnalysisEngine.instance.logger.logInformation(
10363 "Missing element for top-level function ${node.name.name} in ${defin ingLibrary.source.fullName}", 10375 "Missing element for top-level function ${node.name.name} in ${defin ingLibrary.source.fullName}",
10364 new CaughtException(new AnalysisException(), null)); 10376 new CaughtException(new AnalysisException(), null));
10365 } else { 10377 } else {
10366 nameScope = new FunctionScope(nameScope, functionElement); 10378 nameScope = new FunctionScope(nameScope, functionElement);
10367 } 10379 }
10368 super.visitFunctionDeclaration(node); 10380 visitFunctionDeclarationInScope(node);
10369 } finally { 10381 } finally {
10370 nameScope = outerScope; 10382 nameScope = outerScope;
10371 } 10383 }
10372 return null; 10384 return null;
10373 } 10385 }
10374 10386
10387 void visitFunctionDeclarationInScope(FunctionDeclaration node) {
10388 super.visitFunctionDeclaration(node);
10389 }
10390
10375 @override 10391 @override
10376 Object visitFunctionExpression(FunctionExpression node) { 10392 Object visitFunctionExpression(FunctionExpression node) {
10377 if (node.parent is FunctionDeclaration) { 10393 if (node.parent is FunctionDeclaration) {
10378 // We have already created a function scope and don't need to do so again. 10394 // We have already created a function scope and don't need to do so again.
10379 super.visitFunctionExpression(node); 10395 super.visitFunctionExpression(node);
10380 } else { 10396 } else {
10381 Scope outerScope = nameScope; 10397 Scope outerScope = nameScope;
10382 try { 10398 try {
10383 ExecutableElement functionElement = node.element; 10399 ExecutableElement functionElement = node.element;
10384 if (functionElement == null) { 10400 if (functionElement == null) {
(...skipping 22 matching lines...) Expand all
10407 } 10423 }
10408 } 10424 }
10409 return null; 10425 return null;
10410 } 10426 }
10411 10427
10412 @override 10428 @override
10413 Object visitFunctionTypeAlias(FunctionTypeAlias node) { 10429 Object visitFunctionTypeAlias(FunctionTypeAlias node) {
10414 Scope outerScope = nameScope; 10430 Scope outerScope = nameScope;
10415 try { 10431 try {
10416 nameScope = new FunctionTypeScope(nameScope, node.element); 10432 nameScope = new FunctionTypeScope(nameScope, node.element);
10417 super.visitFunctionTypeAlias(node); 10433 visitFunctionTypeAliasInScope(node);
10418 } finally { 10434 } finally {
10419 nameScope = outerScope; 10435 nameScope = outerScope;
10420 } 10436 }
10421 return null; 10437 return null;
10422 } 10438 }
10423 10439
10440 void visitFunctionTypeAliasInScope(FunctionTypeAlias node) {
10441 super.visitFunctionTypeAlias(node);
10442 }
10443
10424 @override 10444 @override
10425 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) { 10445 Object visitFunctionTypedFormalParameter(FunctionTypedFormalParameter node) {
10426 Scope outerScope = nameScope; 10446 Scope outerScope = nameScope;
10427 try { 10447 try {
10428 ParameterElement parameterElement = node.element; 10448 ParameterElement parameterElement = node.element;
10429 if (parameterElement == null) { 10449 if (parameterElement == null) {
10430 AnalysisEngine.instance.logger.logInformation( 10450 AnalysisEngine.instance.logger.logInformation(
10431 "Missing element for function typed formal parameter ${node.identifi er.name} in ${definingLibrary.source.fullName}", 10451 "Missing element for function typed formal parameter ${node.identifi er.name} in ${definingLibrary.source.fullName}",
10432 new CaughtException(new AnalysisException(), null)); 10452 new CaughtException(new AnalysisException(), null));
10433 } else { 10453 } else {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
10468 Scope outerScope = nameScope; 10488 Scope outerScope = nameScope;
10469 try { 10489 try {
10470 ExecutableElement methodElement = node.element; 10490 ExecutableElement methodElement = node.element;
10471 if (methodElement == null) { 10491 if (methodElement == null) {
10472 AnalysisEngine.instance.logger.logInformation( 10492 AnalysisEngine.instance.logger.logInformation(
10473 "Missing element for method ${node.name.name} in ${definingLibrary.s ource.fullName}", 10493 "Missing element for method ${node.name.name} in ${definingLibrary.s ource.fullName}",
10474 new CaughtException(new AnalysisException(), null)); 10494 new CaughtException(new AnalysisException(), null));
10475 } else { 10495 } else {
10476 nameScope = new FunctionScope(nameScope, methodElement); 10496 nameScope = new FunctionScope(nameScope, methodElement);
10477 } 10497 }
10478 super.visitMethodDeclaration(node); 10498 visitMethodDeclarationInScope(node);
10479 } finally { 10499 } finally {
10480 nameScope = outerScope; 10500 nameScope = outerScope;
10481 } 10501 }
10482 return null; 10502 return null;
10483 } 10503 }
10484 10504
10505 void visitMethodDeclarationInScope(MethodDeclaration node) {
10506 super.visitMethodDeclaration(node);
10507 }
10508
10485 /** 10509 /**
10486 * Visit the given statement after it's scope has been created. This is used b y ResolverVisitor to 10510 * Visit the given statement after it's scope has been created. This is used b y ResolverVisitor to
10487 * correctly visit the 'then' and 'else' statements of an 'if' statement. 10511 * correctly visit the 'then' and 'else' statements of an 'if' statement.
10488 * 10512 *
10489 * @param node the statement to be visited 10513 * @param node the statement to be visited
10490 */ 10514 */
10491 void visitStatementInScope(Statement node) { 10515 void visitStatementInScope(Statement node) {
10492 if (node is Block) { 10516 if (node is Block) {
10493 // Don't create a scope around a block because the block will create it's 10517 // Don't create a scope around a block because the block will create it's
10494 // own scope. 10518 // own scope.
(...skipping 2864 matching lines...) Expand 10 before | Expand all | Expand 10 after
13359 nonFields.add(node); 13383 nonFields.add(node);
13360 return null; 13384 return null;
13361 } 13385 }
13362 13386
13363 @override 13387 @override
13364 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 13388 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
13365 13389
13366 @override 13390 @override
13367 Object visitWithClause(WithClause node) => null; 13391 Object visitWithClause(WithClause node) => null;
13368 } 13392 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/non_error_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698