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

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

Issue 1710763002: Support for 'unary-' in DeclarationResolver. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 months 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/declaration_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/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 2376 matching lines...) Expand 10 before | Expand all | Expand 10 after
2387 } 2387 }
2388 2388
2389 @override 2389 @override
2390 Object visitMethodDeclaration(MethodDeclaration node) { 2390 Object visitMethodDeclaration(MethodDeclaration node) {
2391 ExecutableElement outerExecutable = _enclosingExecutable; 2391 ExecutableElement outerExecutable = _enclosingExecutable;
2392 try { 2392 try {
2393 Token property = node.propertyKeyword; 2393 Token property = node.propertyKeyword;
2394 SimpleIdentifier methodName = node.name; 2394 SimpleIdentifier methodName = node.name;
2395 String nameOfMethod = methodName.name; 2395 String nameOfMethod = methodName.name;
2396 if (property == null) { 2396 if (property == null) {
2397 String elementName = nameOfMethod == '-' &&
2398 node.parameters != null &&
2399 node.parameters.parameters.isEmpty ? 'unary-' : nameOfMethod;
2397 _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods, 2400 _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods,
2398 methodName, nameOfMethod, methodName.offset); 2401 methodName, elementName, methodName.offset);
2399 _expectedElements.remove(_enclosingExecutable); 2402 _expectedElements.remove(_enclosingExecutable);
2400 methodName.staticElement = _enclosingExecutable; 2403 methodName.staticElement = _enclosingExecutable;
2401 } else { 2404 } else {
2402 PropertyAccessorElement accessor; 2405 PropertyAccessorElement accessor;
2403 if ((property as KeywordToken).keyword == Keyword.GET) { 2406 if ((property as KeywordToken).keyword == Keyword.GET) {
2404 accessor = _findIdentifier(_enclosingClass.accessors, methodName); 2407 accessor = _findIdentifier(_enclosingClass.accessors, methodName);
2405 } else if ((property as KeywordToken).keyword == Keyword.SET) { 2408 } else if ((property as KeywordToken).keyword == Keyword.SET) {
2406 accessor = _findWithNameAndOffset(_enclosingClass.accessors, 2409 accessor = _findWithNameAndOffset(_enclosingClass.accessors,
2407 methodName, methodName.name + '=', methodName.offset); 2410 methodName, nameOfMethod + '=', methodName.offset);
2408 _expectedElements.remove(accessor); 2411 _expectedElements.remove(accessor);
2409 methodName.staticElement = accessor; 2412 methodName.staticElement = accessor;
2410 } 2413 }
2411 _enclosingExecutable = accessor; 2414 _enclosingExecutable = accessor;
2412 } 2415 }
2413 super.visitMethodDeclaration(node); 2416 super.visitMethodDeclaration(node);
2414 _resolveMetadata(node.metadata, _enclosingExecutable); 2417 _resolveMetadata(node.metadata, _enclosingExecutable);
2415 return null; 2418 return null;
2416 } finally { 2419 } finally {
2417 _enclosingExecutable = outerExecutable; 2420 _enclosingExecutable = outerExecutable;
(...skipping 10364 matching lines...) Expand 10 before | Expand all | Expand 10 after
12782 nonFields.add(node); 12785 nonFields.add(node);
12783 return null; 12786 return null;
12784 } 12787 }
12785 12788
12786 @override 12789 @override
12787 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 12790 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
12788 12791
12789 @override 12792 @override
12790 Object visitWithClause(WithClause node) => null; 12793 Object visitWithClause(WithClause node) => null;
12791 } 12794 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/declaration_resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698