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

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

Issue 2799133003: enhance analyzer to parse uppercase and built-in/pseudo keywords (Closed)
Patch Set: Created 3 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
« no previous file with comments | « pkg/analyzer/lib/src/fasta/token_utils.dart ('k') | pkg/analyzer/lib/src/generated/parser.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.error_verifier; 5 library analyzer.src.generated.error_verifier;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import "dart:math" as math; 8 import "dart:math" as math;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 2609 matching lines...) Expand 10 before | Expand all | Expand 10 after
2620 * Verify that the given [identifier] is not a keyword, and generates the 2620 * Verify that the given [identifier] is not a keyword, and generates the
2621 * given [errorCode] on the identifier if it is a keyword. 2621 * given [errorCode] on the identifier if it is a keyword.
2622 * 2622 *
2623 * See [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME], 2623 * See [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME],
2624 * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME], and 2624 * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_PARAMETER_NAME], and
2625 * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]. 2625 * [CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME].
2626 */ 2626 */
2627 void _checkForBuiltInIdentifierAsName( 2627 void _checkForBuiltInIdentifierAsName(
2628 SimpleIdentifier identifier, ErrorCode errorCode) { 2628 SimpleIdentifier identifier, ErrorCode errorCode) {
2629 Token token = identifier.token; 2629 Token token = identifier.token;
2630 if (token.type == TokenType.KEYWORD) { 2630 if (token.type == TokenType.KEYWORD && token.keyword?.isPseudo != true) {
Paul Berry 2017/04/06 17:09:49 Since token.keyword is non-null if and only if tok
danrubel 2017/04/06 19:21:35 Unfortunately that change will report errors on an
2631 _errorReporter 2631 _errorReporter
2632 .reportErrorForNode(errorCode, identifier, [identifier.name]); 2632 .reportErrorForNode(errorCode, identifier, [identifier.name]);
2633 } 2633 }
2634 } 2634 }
2635 2635
2636 /** 2636 /**
2637 * Verify that the given [switchCase] is terminated with 'break', 'continue', 2637 * Verify that the given [switchCase] is terminated with 'break', 'continue',
2638 * 'return' or 'throw'. 2638 * 'return' or 'throw'.
2639 * 2639 *
2640 * see [StaticWarningCode.CASE_BLOCK_NOT_TERMINATED]. 2640 * see [StaticWarningCode.CASE_BLOCK_NOT_TERMINATED].
(...skipping 4518 matching lines...) Expand 10 before | Expand all | Expand 10 after
7159 class _InvocationCollector extends RecursiveAstVisitor { 7159 class _InvocationCollector extends RecursiveAstVisitor {
7160 final List<String> superCalls = <String>[]; 7160 final List<String> superCalls = <String>[];
7161 7161
7162 @override 7162 @override
7163 visitMethodInvocation(MethodInvocation node) { 7163 visitMethodInvocation(MethodInvocation node) {
7164 if (node.target is SuperExpression) { 7164 if (node.target is SuperExpression) {
7165 superCalls.add(node.methodName.name); 7165 superCalls.add(node.methodName.name);
7166 } 7166 }
7167 } 7167 }
7168 } 7168 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/fasta/token_utils.dart ('k') | pkg/analyzer/lib/src/generated/parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698