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

Side by Side Diff: pkg/analyzer/lib/src/fasta/ast_builder.dart

Issue 3010913002: Revert earlier changes to fix bots (TBR) (Closed)
Patch Set: Created 3 years, 3 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/parser_fasta_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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 fasta.analyzer.ast_builder; 5 library fasta.analyzer.ast_builder;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory; 8 import 'package:analyzer/dart/ast/ast_factory.dart' show AstFactory;
9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard; 9 import 'package:analyzer/dart/ast/standard_ast_factory.dart' as standard;
10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType;
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 /// in class, method, and function declarations. 64 /// in class, method, and function declarations.
65 /// 65 ///
66 /// This is being replaced by the @native(...) annotation. 66 /// This is being replaced by the @native(...) annotation.
67 // 67 //
68 // TODO(danrubel) Move this flag to a better location 68 // TODO(danrubel) Move this flag to a better location
69 // and should only be true if either: 69 // and should only be true if either:
70 // * The current library is a platform library 70 // * The current library is a platform library
71 // * The current library has an import that uses the scheme "dart-ext". 71 // * The current library has an import that uses the scheme "dart-ext".
72 bool allowNativeClause = false; 72 bool allowNativeClause = false;
73 73
74 /// A flag indicating whether an exception should be thrown when an error is
75 /// reported for which we have no mapping into an analyzer error.
76 //
77 // TODO(brianwilkerson) Remove this flag after failing tests have been triaged .
78 bool throwOnMissingErrorMapping = true;
79
80 AstBuilder(this.errorReporter, this.library, this.member, Scope scope, 74 AstBuilder(this.errorReporter, this.library, this.member, Scope scope,
81 this.isFullAst, 75 this.isFullAst,
82 [Uri uri]) 76 [Uri uri])
83 : uri = uri ?? library.fileUri, 77 : uri = uri ?? library.fileUri,
84 super(scope); 78 super(scope);
85 79
86 createJumpTarget(JumpTargetKind kind, int charOffset) { 80 createJumpTarget(JumpTargetKind kind, int charOffset) {
87 // TODO(ahe): Implement jump targets. 81 // TODO(ahe): Implement jump targets.
88 return null; 82 return null;
89 } 83 }
(...skipping 990 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 String lexeme = token.lexeme; 1074 String lexeme = token.lexeme;
1081 if (identical('async', lexeme) || identical('yield', lexeme)) { 1075 if (identical('async', lexeme) || identical('yield', lexeme)) {
1082 errorReporter?.reportErrorForOffset( 1076 errorReporter?.reportErrorForOffset(
1083 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER, 1077 ParserErrorCode.ASYNC_KEYWORD_USED_AS_IDENTIFIER,
1084 token.charOffset, 1078 token.charOffset,
1085 token.charCount); 1079 token.charCount);
1086 push(ast.simpleIdentifier(token)); 1080 push(ast.simpleIdentifier(token));
1087 return token; 1081 return token;
1088 } 1082 }
1089 } 1083 }
1090 if (throwOnMissingErrorMapping) { 1084 return super.handleUnrecoverableError(token, message);
1091 throw new UnimplementedError('Failed to map $message at $token');
1092 }
1093 } 1085 }
1094 1086
1095 void handleUnaryPrefixExpression(Token token) { 1087 void handleUnaryPrefixExpression(Token token) {
1096 debugEvent("UnaryPrefixExpression"); 1088 debugEvent("UnaryPrefixExpression");
1097 push(ast.prefixExpression(token, pop())); 1089 push(ast.prefixExpression(token, pop()));
1098 } 1090 }
1099 1091
1100 void handleUnaryPrefixAssignmentExpression(Token token) { 1092 void handleUnaryPrefixAssignmentExpression(Token token) {
1101 debugEvent("UnaryPrefixAssignmentExpression"); 1093 debugEvent("UnaryPrefixAssignmentExpression");
1102 push(ast.prefixExpression(token, pop())); 1094 push(ast.prefixExpression(token, pop()));
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
1957 errorReporter?.reportErrorForOffset( 1949 errorReporter?.reportErrorForOffset(
1958 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]); 1950 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]);
1959 } else { 1951 } else {
1960 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN, 1952 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN,
1961 charOffset, text.length, [text]); 1953 charOffset, text.length, [text]);
1962 } 1954 }
1963 return; 1955 return;
1964 default: 1956 default:
1965 // fall through 1957 // fall through
1966 } 1958 }
1967 if (throwOnMissingErrorMapping) {
1968 throw new UnimplementedError('Failed to map $message at $charOffset');
1969 }
1970 } 1959 }
1971 1960
1972 /// A marker method used to mark locations where a token is being located in 1961 /// A marker method used to mark locations where a token is being located in
1973 /// an unsafe way. In all such cases the parser needs to be fixed to pass in 1962 /// an unsafe way. In all such cases the parser needs to be fixed to pass in
1974 /// the token. 1963 /// the token.
1975 Token unsafeToken(Token token, TokenType tokenType) { 1964 Token unsafeToken(Token token, TokenType tokenType) {
1976 // TODO(brianwilkerson) Eliminate the need for this method. 1965 // TODO(brianwilkerson) Eliminate the need for this method.
1977 return token.type == tokenType ? token : null; 1966 return token.type == tokenType ? token : null;
1978 } 1967 }
1979 } 1968 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 } else if (identical('var', s)) { 2065 } else if (identical('var', s)) {
2077 finalConstOrVarKeyword = token; 2066 finalConstOrVarKeyword = token;
2078 } else if (identical('covariant', s)) { 2067 } else if (identical('covariant', s)) {
2079 covariantKeyword = token; 2068 covariantKeyword = token;
2080 } else { 2069 } else {
2081 unhandled("$s", "modifier", token.charOffset, null); 2070 unhandled("$s", "modifier", token.charOffset, null);
2082 } 2071 }
2083 } 2072 }
2084 } 2073 }
2085 } 2074 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/parser_fasta_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698