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

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

Issue 3007033002: report const class as a more specific error code (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 1916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1927 } 1927 }
1928 } 1928 }
1929 return text; 1929 return text;
1930 } 1930 }
1931 1931
1932 switch (code.analyzerCode) { 1932 switch (code.analyzerCode) {
1933 case "EXPECTED_TYPE_NAME": 1933 case "EXPECTED_TYPE_NAME":
1934 errorReporter?.reportErrorForOffset( 1934 errorReporter?.reportErrorForOffset(
1935 ParserErrorCode.EXPECTED_TYPE_NAME, charOffset, 1); 1935 ParserErrorCode.EXPECTED_TYPE_NAME, charOffset, 1);
1936 return; 1936 return;
1937 case "NATIVE_CLAUSE_SHOULD_BE_ANNOTATION": 1937 case "CONST_CLASS":
1938 if (!allowNativeClause) { 1938 errorReporter?.reportErrorForOffset(
1939 errorReporter?.reportErrorForOffset( 1939 ParserErrorCode.CONST_CLASS, charOffset, 1);
1940 ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
1941 charOffset,
1942 1);
1943 }
1944 return; 1940 return;
1945 case "EXPECTED_STRING_LITERAL": 1941 case "EXPECTED_STRING_LITERAL":
1946 errorReporter?.reportErrorForOffset( 1942 errorReporter?.reportErrorForOffset(
1947 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1); 1943 ParserErrorCode.EXPECTED_STRING_LITERAL, charOffset, 1);
1948 return; 1944 return;
1949 case "EXTRANEOUS_MODIFIER": 1945 case "EXTRANEOUS_MODIFIER":
1950 String text = stringOrTokenLexeme(); 1946 String text = stringOrTokenLexeme();
1951 errorReporter?.reportErrorForOffset(ParserErrorCode.EXTRANEOUS_MODIFIER, 1947 errorReporter?.reportErrorForOffset(ParserErrorCode.EXTRANEOUS_MODIFIER,
1952 charOffset, text.length, [text]); 1948 charOffset, text.length, [text]);
1953 return; 1949 return;
1950 case "NATIVE_CLAUSE_SHOULD_BE_ANNOTATION":
1951 if (!allowNativeClause) {
1952 errorReporter?.reportErrorForOffset(
1953 ParserErrorCode.NATIVE_CLAUSE_SHOULD_BE_ANNOTATION,
1954 charOffset,
1955 1);
1956 }
1957 return;
1954 case "UNEXPECTED_TOKEN": 1958 case "UNEXPECTED_TOKEN":
1955 String text = stringOrTokenLexeme(); 1959 String text = stringOrTokenLexeme();
1956 if (text == ';') { 1960 if (text == ';') {
1957 errorReporter?.reportErrorForOffset( 1961 errorReporter?.reportErrorForOffset(
1958 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]); 1962 ParserErrorCode.EXPECTED_TOKEN, charOffset, text.length, [text]);
1959 } else { 1963 } else {
1960 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN, 1964 errorReporter?.reportErrorForOffset(ParserErrorCode.UNEXPECTED_TOKEN,
1961 charOffset, text.length, [text]); 1965 charOffset, text.length, [text]);
1962 } 1966 }
1963 return; 1967 return;
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2076 } else if (identical('var', s)) { 2080 } else if (identical('var', s)) {
2077 finalConstOrVarKeyword = token; 2081 finalConstOrVarKeyword = token;
2078 } else if (identical('covariant', s)) { 2082 } else if (identical('covariant', s)) {
2079 covariantKeyword = token; 2083 covariantKeyword = token;
2080 } else { 2084 } else {
2081 unhandled("$s", "modifier", token.charOffset, null); 2085 unhandled("$s", "modifier", token.charOffset, null);
2082 } 2086 }
2083 } 2087 }
2084 } 2088 }
2085 } 2089 }
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