| OLD | NEW |
| 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 engine.resolver; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 | 8 |
| 9 import 'ast.dart'; | 9 import 'ast.dart'; |
| 10 import 'constant.dart'; | 10 import 'constant.dart'; |
| (...skipping 10739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10750 Object visitEnumDeclaration(EnumDeclaration node) { | 10750 Object visitEnumDeclaration(EnumDeclaration node) { |
| 10751 // | 10751 // |
| 10752 // Resolve the metadata in the library scope | 10752 // Resolve the metadata in the library scope |
| 10753 // and associate the annotations with the element. | 10753 // and associate the annotations with the element. |
| 10754 // | 10754 // |
| 10755 if (node.metadata != null) { | 10755 if (node.metadata != null) { |
| 10756 node.metadata.accept(this); | 10756 node.metadata.accept(this); |
| 10757 ElementResolver.setMetadata(node.element, node); | 10757 ElementResolver.setMetadata(node.element, node); |
| 10758 } | 10758 } |
| 10759 // | 10759 // |
| 10760 // There is nothing else to do because everything else was resolved by the | 10760 // Continue the enum resolution. |
| 10761 // element builder. | |
| 10762 // | 10761 // |
| 10762 ClassElement outerType = enclosingClass; |
| 10763 try { |
| 10764 enclosingClass = node.element; |
| 10765 typeAnalyzer.thisType = |
| 10766 enclosingClass == null ? null : enclosingClass.type; |
| 10767 super.visitEnumDeclaration(node); |
| 10768 node.accept(elementResolver); |
| 10769 node.accept(typeAnalyzer); |
| 10770 } finally { |
| 10771 typeAnalyzer.thisType = outerType == null ? null : outerType.type; |
| 10772 enclosingClass = outerType; |
| 10773 _enclosingClassDeclaration = null; |
| 10774 } |
| 10763 return null; | 10775 return null; |
| 10764 } | 10776 } |
| 10765 | 10777 |
| 10766 @override | 10778 @override |
| 10767 Object visitExpressionFunctionBody(ExpressionFunctionBody node) { | 10779 Object visitExpressionFunctionBody(ExpressionFunctionBody node) { |
| 10768 safelyVisit(_commentBeforeFunction); | 10780 safelyVisit(_commentBeforeFunction); |
| 10769 if (resolveOnlyCommentInFunctionBody) { | 10781 if (resolveOnlyCommentInFunctionBody) { |
| 10770 return null; | 10782 return null; |
| 10771 } | 10783 } |
| 10772 _overrideManager.enterScope(); | 10784 _overrideManager.enterScope(); |
| (...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 12089 _implicitLabelScope = _implicitLabelScope.nest(node); | 12101 _implicitLabelScope = _implicitLabelScope.nest(node); |
| 12090 visitStatementInScope(node.body); | 12102 visitStatementInScope(node.body); |
| 12091 safelyVisit(node.condition); | 12103 safelyVisit(node.condition); |
| 12092 } finally { | 12104 } finally { |
| 12093 _implicitLabelScope = outerImplicitScope; | 12105 _implicitLabelScope = outerImplicitScope; |
| 12094 } | 12106 } |
| 12095 return null; | 12107 return null; |
| 12096 } | 12108 } |
| 12097 | 12109 |
| 12098 @override | 12110 @override |
| 12111 Object visitEnumDeclaration(EnumDeclaration node) { |
| 12112 ClassElement classElement = node.element; |
| 12113 Scope outerScope = nameScope; |
| 12114 try { |
| 12115 if (classElement == null) { |
| 12116 AnalysisEngine.instance.logger.logInformation( |
| 12117 "Missing element for enum declaration ${node.name.name} in ${definin
gLibrary.source.fullName}", |
| 12118 new CaughtException(new AnalysisException(), null)); |
| 12119 super.visitEnumDeclaration(node); |
| 12120 } else { |
| 12121 ClassElement outerClass = enclosingClass; |
| 12122 try { |
| 12123 enclosingClass = node.element; |
| 12124 nameScope = new ClassScope(nameScope, classElement); |
| 12125 visitEnumMembersInScope(node); |
| 12126 } finally { |
| 12127 enclosingClass = outerClass; |
| 12128 } |
| 12129 } |
| 12130 } finally { |
| 12131 nameScope = outerScope; |
| 12132 } |
| 12133 return null; |
| 12134 } |
| 12135 |
| 12136 void visitEnumMembersInScope(EnumDeclaration node) { |
| 12137 safelyVisit(node.documentationComment); |
| 12138 node.metadata.accept(this); |
| 12139 node.constants.accept(this); |
| 12140 } |
| 12141 |
| 12142 @override |
| 12099 Object visitForEachStatement(ForEachStatement node) { | 12143 Object visitForEachStatement(ForEachStatement node) { |
| 12100 Scope outerNameScope = nameScope; | 12144 Scope outerNameScope = nameScope; |
| 12101 ImplicitLabelScope outerImplicitScope = _implicitLabelScope; | 12145 ImplicitLabelScope outerImplicitScope = _implicitLabelScope; |
| 12102 try { | 12146 try { |
| 12103 nameScope = new EnclosedScope(nameScope); | 12147 nameScope = new EnclosedScope(nameScope); |
| 12104 _implicitLabelScope = _implicitLabelScope.nest(node); | 12148 _implicitLabelScope = _implicitLabelScope.nest(node); |
| 12105 visitForEachStatementInScope(node); | 12149 visitForEachStatementInScope(node); |
| 12106 } finally { | 12150 } finally { |
| 12107 nameScope = outerNameScope; | 12151 nameScope = outerNameScope; |
| 12108 _implicitLabelScope = outerImplicitScope; | 12152 _implicitLabelScope = outerImplicitScope; |
| (...skipping 3238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15347 nonFields.add(node); | 15391 nonFields.add(node); |
| 15348 return null; | 15392 return null; |
| 15349 } | 15393 } |
| 15350 | 15394 |
| 15351 @override | 15395 @override |
| 15352 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); | 15396 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); |
| 15353 | 15397 |
| 15354 @override | 15398 @override |
| 15355 Object visitWithClause(WithClause node) => null; | 15399 Object visitWithClause(WithClause node) => null; |
| 15356 } | 15400 } |
| OLD | NEW |