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

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

Issue 1909843002: Pull the 'keyword' property into Token. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
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 2377 matching lines...) Expand 10 before | Expand all | Expand 10 after
2388 _enclosingExecutable = 2388 _enclosingExecutable =
2389 _findIdentifier(_enclosingExecutable.functions, functionName); 2389 _findIdentifier(_enclosingExecutable.functions, functionName);
2390 } else { 2390 } else {
2391 List<PropertyAccessorElement> accessors; 2391 List<PropertyAccessorElement> accessors;
2392 if (_enclosingClass != null) { 2392 if (_enclosingClass != null) {
2393 accessors = _enclosingClass.accessors; 2393 accessors = _enclosingClass.accessors;
2394 } else { 2394 } else {
2395 accessors = _enclosingUnit.accessors; 2395 accessors = _enclosingUnit.accessors;
2396 } 2396 }
2397 PropertyAccessorElement accessor; 2397 PropertyAccessorElement accessor;
2398 if ((property as KeywordToken).keyword == Keyword.GET) { 2398 if (property.keyword == Keyword.GET) {
2399 accessor = _findIdentifier(accessors, functionName); 2399 accessor = _findIdentifier(accessors, functionName);
2400 } else if ((property as KeywordToken).keyword == Keyword.SET) { 2400 } else if (property.keyword == Keyword.SET) {
2401 accessor = _findWithNameAndOffset(accessors, functionName, 2401 accessor = _findWithNameAndOffset(accessors, functionName,
2402 functionName.name + '=', functionName.offset); 2402 functionName.name + '=', functionName.offset);
2403 _expectedElements.remove(accessor); 2403 _expectedElements.remove(accessor);
2404 functionName.staticElement = accessor; 2404 functionName.staticElement = accessor;
2405 } 2405 }
2406 _enclosingExecutable = accessor; 2406 _enclosingExecutable = accessor;
2407 } 2407 }
2408 } 2408 }
2409 node.functionExpression.element = _enclosingExecutable; 2409 node.functionExpression.element = _enclosingExecutable;
2410 super.visitFunctionDeclaration(node); 2410 super.visitFunctionDeclaration(node);
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
2501 if (property == null) { 2501 if (property == null) {
2502 String elementName = nameOfMethod == '-' && 2502 String elementName = nameOfMethod == '-' &&
2503 node.parameters != null && 2503 node.parameters != null &&
2504 node.parameters.parameters.isEmpty ? 'unary-' : nameOfMethod; 2504 node.parameters.parameters.isEmpty ? 'unary-' : nameOfMethod;
2505 _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods, 2505 _enclosingExecutable = _findWithNameAndOffset(_enclosingClass.methods,
2506 methodName, elementName, methodName.offset); 2506 methodName, elementName, methodName.offset);
2507 _expectedElements.remove(_enclosingExecutable); 2507 _expectedElements.remove(_enclosingExecutable);
2508 methodName.staticElement = _enclosingExecutable; 2508 methodName.staticElement = _enclosingExecutable;
2509 } else { 2509 } else {
2510 PropertyAccessorElement accessor; 2510 PropertyAccessorElement accessor;
2511 if ((property as KeywordToken).keyword == Keyword.GET) { 2511 if (property.keyword == Keyword.GET) {
2512 accessor = _findIdentifier(_enclosingClass.accessors, methodName); 2512 accessor = _findIdentifier(_enclosingClass.accessors, methodName);
2513 } else if ((property as KeywordToken).keyword == Keyword.SET) { 2513 } else if (property.keyword == Keyword.SET) {
2514 accessor = _findWithNameAndOffset(_enclosingClass.accessors, 2514 accessor = _findWithNameAndOffset(_enclosingClass.accessors,
2515 methodName, nameOfMethod + '=', methodName.offset); 2515 methodName, nameOfMethod + '=', methodName.offset);
2516 _expectedElements.remove(accessor); 2516 _expectedElements.remove(accessor);
2517 methodName.staticElement = accessor; 2517 methodName.staticElement = accessor;
2518 } 2518 }
2519 _enclosingExecutable = accessor; 2519 _enclosingExecutable = accessor;
2520 } 2520 }
2521 super.visitMethodDeclaration(node); 2521 super.visitMethodDeclaration(node);
2522 _resolveMetadata(node, node.metadata, _enclosingExecutable); 2522 _resolveMetadata(node, node.metadata, _enclosingExecutable);
2523 return null; 2523 return null;
(...skipping 8281 matching lines...) Expand 10 before | Expand all | Expand 10 after
10805 nonFields.add(node); 10805 nonFields.add(node);
10806 return null; 10806 return null;
10807 } 10807 }
10808 10808
10809 @override 10809 @override
10810 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 10810 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
10811 10811
10812 @override 10812 @override
10813 Object visitWithClause(WithClause node) => null; 10813 Object visitWithClause(WithClause node) => null;
10814 } 10814 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698