| OLD | NEW |
| 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.parser; | 5 library analyzer.src.generated.parser; |
| 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'; |
| 11 import 'package:analyzer/dart/ast/token.dart'; | 11 import 'package:analyzer/dart/ast/token.dart'; |
| 12 import 'package:analyzer/error/error.dart'; | 12 import 'package:analyzer/error/error.dart'; |
| 13 import 'package:analyzer/error/listener.dart'; | 13 import 'package:analyzer/error/listener.dart'; |
| 14 import 'package:analyzer/src/dart/ast/ast.dart'; | 14 import 'package:analyzer/src/dart/ast/ast.dart'; |
| 15 import 'package:analyzer/src/dart/ast/token.dart'; | 15 import 'package:analyzer/src/dart/ast/token.dart'; |
| 16 import 'package:analyzer/src/dart/error/syntactic_errors.dart'; |
| 16 import 'package:analyzer/src/dart/scanner/reader.dart'; | 17 import 'package:analyzer/src/dart/scanner/reader.dart'; |
| 17 import 'package:analyzer/src/dart/scanner/scanner.dart'; | 18 import 'package:analyzer/src/dart/scanner/scanner.dart'; |
| 18 import 'package:analyzer/src/error/codes.dart'; | 19 import 'package:analyzer/src/error/codes.dart'; |
| 19 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine; | 20 import 'package:analyzer/src/generated/engine.dart' show AnalysisEngine; |
| 20 import 'package:analyzer/src/generated/java_core.dart'; | 21 import 'package:analyzer/src/generated/java_core.dart'; |
| 21 import 'package:analyzer/src/generated/java_engine.dart'; | 22 import 'package:analyzer/src/generated/java_engine.dart'; |
| 22 import 'package:analyzer/src/generated/source.dart'; | 23 import 'package:analyzer/src/generated/source.dart'; |
| 23 import 'package:analyzer/src/generated/utilities_dart.dart'; | 24 import 'package:analyzer/src/generated/utilities_dart.dart'; |
| 24 | 25 |
| 25 export 'package:analyzer/src/dart/ast/utilities.dart' show ResolutionCopier; | 26 export 'package:analyzer/src/dart/ast/utilities.dart' show ResolutionCopier; |
| 27 export 'package:analyzer/src/dart/error/syntactic_errors.dart'; |
| 26 | 28 |
| 27 /** | 29 /** |
| 28 * A simple data-holder for a method that needs to return multiple values. | 30 * A simple data-holder for a method that needs to return multiple values. |
| 29 */ | 31 */ |
| 30 class CommentAndMetadata { | 32 class CommentAndMetadata { |
| 31 /** | 33 /** |
| 32 * The documentation comment that was parsed, or `null` if none was given. | 34 * The documentation comment that was parsed, or `null` if none was given. |
| 33 */ | 35 */ |
| 34 final Comment comment; | 36 final Comment comment; |
| 35 | 37 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 63 */ | 65 */ |
| 64 final TypeName type; | 66 final TypeName type; |
| 65 | 67 |
| 66 /** | 68 /** |
| 67 * Initialize a newly created holder with the given [keyword] and [type]. | 69 * Initialize a newly created holder with the given [keyword] and [type]. |
| 68 */ | 70 */ |
| 69 FinalConstVarOrType(this.keyword, this.type); | 71 FinalConstVarOrType(this.keyword, this.type); |
| 70 } | 72 } |
| 71 | 73 |
| 72 /** | 74 /** |
| 73 * Wrapper around [Function] which should be called with "target" and | |
| 74 * "arguments". | |
| 75 */ | |
| 76 class MethodTrampoline { | |
| 77 int parameterCount; | |
| 78 Function trampoline; | |
| 79 MethodTrampoline(this.parameterCount, this.trampoline); | |
| 80 Object invoke(target, List arguments) { | |
| 81 if (arguments.length != parameterCount) { | |
| 82 throw new ArgumentError("${arguments.length} != $parameterCount"); | |
| 83 } | |
| 84 switch (parameterCount) { | |
| 85 case 0: | |
| 86 return trampoline(target); | |
| 87 case 1: | |
| 88 return trampoline(target, arguments[0]); | |
| 89 case 2: | |
| 90 return trampoline(target, arguments[0], arguments[1]); | |
| 91 case 3: | |
| 92 return trampoline(target, arguments[0], arguments[1], arguments[2]); | |
| 93 case 4: | |
| 94 return trampoline( | |
| 95 target, arguments[0], arguments[1], arguments[2], arguments[3]); | |
| 96 default: | |
| 97 throw new ArgumentError("Not implemented for > 4 arguments"); | |
| 98 } | |
| 99 } | |
| 100 } | |
| 101 | |
| 102 /** | |
| 103 * A simple data-holder for a method that needs to return multiple values. | 75 * A simple data-holder for a method that needs to return multiple values. |
| 104 */ | 76 */ |
| 105 class Modifiers { | 77 class Modifiers { |
| 106 /** | 78 /** |
| 107 * The token representing the keyword 'abstract', or `null` if the keyword was | 79 * The token representing the keyword 'abstract', or `null` if the keyword was |
| 108 * not found. | 80 * not found. |
| 109 */ | 81 */ |
| 110 Token abstractKeyword; | 82 Token abstractKeyword; |
| 111 | 83 |
| 112 /** | 84 /** |
| (...skipping 5256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5369 _currentToken = _currentToken.next; | 5341 _currentToken = _currentToken.next; |
| 5370 } | 5342 } |
| 5371 | 5343 |
| 5372 /** | 5344 /** |
| 5373 * Append the character equivalent of the given [codePoint] to the given | 5345 * Append the character equivalent of the given [codePoint] to the given |
| 5374 * [builder]. Use the [startIndex] and [endIndex] to report an error, and | 5346 * [builder]. Use the [startIndex] and [endIndex] to report an error, and |
| 5375 * don't append anything to the builder, if the code point is invalid. The | 5347 * don't append anything to the builder, if the code point is invalid. The |
| 5376 * [escapeSequence] is the escape sequence that was parsed to produce the | 5348 * [escapeSequence] is the escape sequence that was parsed to produce the |
| 5377 * code point (used for error reporting). | 5349 * code point (used for error reporting). |
| 5378 */ | 5350 */ |
| 5379 void _appendCodePoint(StringBuffer buffer, String source, | 5351 void _appendCodePoint(StringBuffer buffer, String source, int codePoint, |
| 5380 int codePoint, int startIndex, int endIndex) { | 5352 int startIndex, int endIndex) { |
| 5381 if (codePoint < 0 || codePoint > Character.MAX_CODE_POINT) { | 5353 if (codePoint < 0 || codePoint > Character.MAX_CODE_POINT) { |
| 5382 String escapeSequence = source.substring(startIndex, endIndex + 1); | 5354 String escapeSequence = source.substring(startIndex, endIndex + 1); |
| 5383 _reportErrorForCurrentToken( | 5355 _reportErrorForCurrentToken( |
| 5384 ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]); | 5356 ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]); |
| 5385 return; | 5357 return; |
| 5386 } | 5358 } |
| 5387 if (codePoint < Character.MAX_VALUE) { | 5359 if (codePoint < Character.MAX_VALUE) { |
| 5388 buffer.writeCharCode(codePoint); | 5360 buffer.writeCharCode(codePoint); |
| 5389 } else { | 5361 } else { |
| 5390 buffer.write(Character.toChars(codePoint)); | 5362 buffer.write(Character.toChars(codePoint)); |
| (...skipping 2736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8127 */ | 8099 */ |
| 8128 Parser_SyntheticKeywordToken(Keyword keyword, int offset) | 8100 Parser_SyntheticKeywordToken(Keyword keyword, int offset) |
| 8129 : super(keyword, offset); | 8101 : super(keyword, offset); |
| 8130 | 8102 |
| 8131 @override | 8103 @override |
| 8132 int get length => 0; | 8104 int get length => 0; |
| 8133 | 8105 |
| 8134 @override | 8106 @override |
| 8135 Token copy() => new Parser_SyntheticKeywordToken(keyword, offset); | 8107 Token copy() => new Parser_SyntheticKeywordToken(keyword, offset); |
| 8136 } | 8108 } |
| 8137 | |
| 8138 /** | |
| 8139 * The error codes used for errors detected by the parser. The convention for | |
| 8140 * this class is for the name of the error code to indicate the problem that | |
| 8141 * caused the error to be generated and for the error message to explain what | |
| 8142 * is wrong and, when appropriate, how the problem can be corrected. | |
| 8143 */ | |
| 8144 class ParserErrorCode extends ErrorCode { | |
| 8145 static const ParserErrorCode ABSTRACT_CLASS_MEMBER = const ParserErrorCode( | |
| 8146 'ABSTRACT_CLASS_MEMBER', | |
| 8147 "Members of classes cannot be declared to be 'abstract'"); | |
| 8148 | |
| 8149 static const ParserErrorCode ABSTRACT_ENUM = const ParserErrorCode( | |
| 8150 'ABSTRACT_ENUM', "Enums cannot be declared to be 'abstract'"); | |
| 8151 | |
| 8152 static const ParserErrorCode ABSTRACT_STATIC_METHOD = const ParserErrorCode( | |
| 8153 'ABSTRACT_STATIC_METHOD', | |
| 8154 "Static methods cannot be declared to be 'abstract'"); | |
| 8155 | |
| 8156 static const ParserErrorCode ABSTRACT_TOP_LEVEL_FUNCTION = | |
| 8157 const ParserErrorCode('ABSTRACT_TOP_LEVEL_FUNCTION', | |
| 8158 "Top-level functions cannot be declared to be 'abstract'"); | |
| 8159 | |
| 8160 static const ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = | |
| 8161 const ParserErrorCode('ABSTRACT_TOP_LEVEL_VARIABLE', | |
| 8162 "Top-level variables cannot be declared to be 'abstract'"); | |
| 8163 | |
| 8164 static const ParserErrorCode ABSTRACT_TYPEDEF = const ParserErrorCode( | |
| 8165 'ABSTRACT_TYPEDEF', "Type aliases cannot be declared to be 'abstract'"); | |
| 8166 | |
| 8167 static const ParserErrorCode ANNOTATION_ON_ENUM_CONSTANT = | |
| 8168 const ParserErrorCode('ANNOTATION_ON_ENUM_CONSTANT', | |
| 8169 "Enum constants cannot have annotations"); | |
| 8170 | |
| 8171 /** | |
| 8172 * 16.32 Identifier Reference: It is a compile-time error if any of the | |
| 8173 * identifiers async, await, or yield is used as an identifier in a function | |
| 8174 * body marked with either async, async*, or sync*. | |
| 8175 */ | |
| 8176 static const ParserErrorCode ASYNC_KEYWORD_USED_AS_IDENTIFIER = | |
| 8177 const ParserErrorCode('ASYNC_KEYWORD_USED_AS_IDENTIFIER', | |
| 8178 "The keywords 'async', 'await', and 'yield' may not be used as identif
iers in an asynchronous or generator function."); | |
| 8179 | |
| 8180 /** | |
| 8181 * Some environments, such as Fletch, do not support async. | |
| 8182 */ | |
| 8183 static const ParserErrorCode ASYNC_NOT_SUPPORTED = const ParserErrorCode( | |
| 8184 'ASYNC_NOT_SUPPORTED', | |
| 8185 "Async and sync are not supported in this environment."); | |
| 8186 | |
| 8187 static const ParserErrorCode BREAK_OUTSIDE_OF_LOOP = const ParserErrorCode( | |
| 8188 'BREAK_OUTSIDE_OF_LOOP', | |
| 8189 "A break statement cannot be used outside of a loop or switch statement"); | |
| 8190 | |
| 8191 static const ParserErrorCode CLASS_IN_CLASS = const ParserErrorCode( | |
| 8192 'CLASS_IN_CLASS', | |
| 8193 "Classes can't be declared inside other classes.", | |
| 8194 "Try moving the class to the top-level."); | |
| 8195 | |
| 8196 static const ParserErrorCode COLON_IN_PLACE_OF_IN = const ParserErrorCode( | |
| 8197 'COLON_IN_PLACE_OF_IN', "For-in loops use 'in' rather than a colon"); | |
| 8198 | |
| 8199 static const ParserErrorCode CONST_AND_FINAL = const ParserErrorCode( | |
| 8200 'CONST_AND_FINAL', | |
| 8201 "Members can't be declared to be both 'const' and 'final'.", | |
| 8202 "Try removing either the 'const' or 'final' keyword."); | |
| 8203 | |
| 8204 static const ParserErrorCode CONST_AND_VAR = const ParserErrorCode( | |
| 8205 'CONST_AND_VAR', | |
| 8206 "Members can't be declared to be both 'const' and 'var'.", | |
| 8207 "Try removing either the 'const' or 'var' keyword."); | |
| 8208 | |
| 8209 static const ParserErrorCode CONST_CLASS = const ParserErrorCode( | |
| 8210 'CONST_CLASS', | |
| 8211 "Classes can't be declared to be 'const'.", | |
| 8212 "Try removing the 'const' keyword or moving to the class' constructor(s)."
); | |
| 8213 | |
| 8214 static const ParserErrorCode CONST_CONSTRUCTOR_WITH_BODY = | |
| 8215 const ParserErrorCode( | |
| 8216 'CONST_CONSTRUCTOR_WITH_BODY', | |
| 8217 "Const constructor can't have a body.", | |
| 8218 "Try removing the 'const' keyword or the body."); | |
| 8219 | |
| 8220 static const ParserErrorCode CONST_ENUM = const ParserErrorCode( | |
| 8221 'CONST_ENUM', | |
| 8222 "Enums can't be declared to be 'const'.", | |
| 8223 "Try removing the 'const' keyword."); | |
| 8224 | |
| 8225 static const ParserErrorCode CONST_FACTORY = const ParserErrorCode( | |
| 8226 'CONST_FACTORY', | |
| 8227 "Only redirecting factory constructors can be declared to be 'const'.", | |
| 8228 "Try removing the 'const' keyword or replacing the body with '=' followed
by a valid target."); | |
| 8229 | |
| 8230 static const ParserErrorCode CONST_METHOD = const ParserErrorCode( | |
| 8231 'CONST_METHOD', | |
| 8232 "Getters, setters and methods can't be declared to be 'const'.", | |
| 8233 "Try removing the 'const' keyword."); | |
| 8234 | |
| 8235 static const ParserErrorCode CONST_TYPEDEF = const ParserErrorCode( | |
| 8236 'CONST_TYPEDEF', | |
| 8237 "Type aliases can't be declared to be 'const'.", | |
| 8238 "Try removing the 'const' keyword."); | |
| 8239 | |
| 8240 static const ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = | |
| 8241 const ParserErrorCode( | |
| 8242 'CONSTRUCTOR_WITH_RETURN_TYPE', | |
| 8243 "Constructors can't have a return type.", | |
| 8244 "Try removing the return type."); | |
| 8245 | |
| 8246 static const ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = const ParserErrorCode( | |
| 8247 'CONTINUE_OUTSIDE_OF_LOOP', | |
| 8248 "A continue statement cannot be used outside of a loop or switch statement
"); | |
| 8249 | |
| 8250 static const ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = | |
| 8251 const ParserErrorCode('CONTINUE_WITHOUT_LABEL_IN_CASE', | |
| 8252 "A continue statement in a switch statement must have a label as a tar
get"); | |
| 8253 | |
| 8254 static const ParserErrorCode DEPRECATED_CLASS_TYPE_ALIAS = | |
| 8255 const ParserErrorCode('DEPRECATED_CLASS_TYPE_ALIAS', | |
| 8256 "The 'typedef' mixin application was replaced with 'class'"); | |
| 8257 | |
| 8258 static const ParserErrorCode DIRECTIVE_AFTER_DECLARATION = | |
| 8259 const ParserErrorCode('DIRECTIVE_AFTER_DECLARATION', | |
| 8260 "Directives must appear before any declarations"); | |
| 8261 | |
| 8262 static const ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = | |
| 8263 const ParserErrorCode('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', | |
| 8264 "The label {0} was already used in this switch statement"); | |
| 8265 | |
| 8266 static const ParserErrorCode DUPLICATED_MODIFIER = const ParserErrorCode( | |
| 8267 'DUPLICATED_MODIFIER', "The modifier '{0}' was already specified."); | |
| 8268 | |
| 8269 static const ParserErrorCode EMPTY_ENUM_BODY = const ParserErrorCode( | |
| 8270 'EMPTY_ENUM_BODY', "An enum must declare at least one constant name"); | |
| 8271 | |
| 8272 static const ParserErrorCode ENUM_IN_CLASS = const ParserErrorCode( | |
| 8273 'ENUM_IN_CLASS', "Enums cannot be declared inside classes"); | |
| 8274 | |
| 8275 static const ParserErrorCode EQUALITY_CANNOT_BE_EQUALITY_OPERAND = | |
| 8276 const ParserErrorCode('EQUALITY_CANNOT_BE_EQUALITY_OPERAND', | |
| 8277 "Equality expression cannot be operand of another equality expression.
"); | |
| 8278 | |
| 8279 static const ParserErrorCode EXPECTED_CASE_OR_DEFAULT = const ParserErrorCode( | |
| 8280 'EXPECTED_CASE_OR_DEFAULT', "Expected 'case' or 'default'"); | |
| 8281 | |
| 8282 static const ParserErrorCode EXPECTED_CLASS_MEMBER = | |
| 8283 const ParserErrorCode('EXPECTED_CLASS_MEMBER', "Expected a class member"); | |
| 8284 | |
| 8285 static const ParserErrorCode EXPECTED_EXECUTABLE = const ParserErrorCode( | |
| 8286 'EXPECTED_EXECUTABLE', | |
| 8287 "Expected a method, getter, setter or operator declaration"); | |
| 8288 | |
| 8289 static const ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = | |
| 8290 const ParserErrorCode( | |
| 8291 'EXPECTED_LIST_OR_MAP_LITERAL', "Expected a list or map literal"); | |
| 8292 | |
| 8293 static const ParserErrorCode EXPECTED_STRING_LITERAL = const ParserErrorCode( | |
| 8294 'EXPECTED_STRING_LITERAL', "Expected a string literal"); | |
| 8295 | |
| 8296 static const ParserErrorCode EXPECTED_TOKEN = | |
| 8297 const ParserErrorCode('EXPECTED_TOKEN', "Expected to find '{0}'"); | |
| 8298 | |
| 8299 static const ParserErrorCode EXPECTED_TYPE_NAME = | |
| 8300 const ParserErrorCode('EXPECTED_TYPE_NAME', "Expected a type name"); | |
| 8301 | |
| 8302 static const ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = | |
| 8303 const ParserErrorCode('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', | |
| 8304 "Export directives must preceed part directives"); | |
| 8305 | |
| 8306 static const ParserErrorCode EXTERNAL_AFTER_CONST = const ParserErrorCode( | |
| 8307 'EXTERNAL_AFTER_CONST', | |
| 8308 "The modifier 'external' should be before the modifier 'const'"); | |
| 8309 | |
| 8310 static const ParserErrorCode EXTERNAL_AFTER_FACTORY = const ParserErrorCode( | |
| 8311 'EXTERNAL_AFTER_FACTORY', | |
| 8312 "The modifier 'external' should be before the modifier 'factory'"); | |
| 8313 | |
| 8314 static const ParserErrorCode EXTERNAL_AFTER_STATIC = const ParserErrorCode( | |
| 8315 'EXTERNAL_AFTER_STATIC', | |
| 8316 "The modifier 'external' should be before the modifier 'static'"); | |
| 8317 | |
| 8318 static const ParserErrorCode EXTERNAL_CLASS = const ParserErrorCode( | |
| 8319 'EXTERNAL_CLASS', "Classes cannot be declared to be 'external'"); | |
| 8320 | |
| 8321 static const ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = | |
| 8322 const ParserErrorCode('EXTERNAL_CONSTRUCTOR_WITH_BODY', | |
| 8323 "External constructors cannot have a body"); | |
| 8324 | |
| 8325 static const ParserErrorCode EXTERNAL_ENUM = const ParserErrorCode( | |
| 8326 'EXTERNAL_ENUM', "Enums cannot be declared to be 'external'"); | |
| 8327 | |
| 8328 static const ParserErrorCode EXTERNAL_FIELD = const ParserErrorCode( | |
| 8329 'EXTERNAL_FIELD', "Fields cannot be declared to be 'external'"); | |
| 8330 | |
| 8331 static const ParserErrorCode EXTERNAL_GETTER_WITH_BODY = | |
| 8332 const ParserErrorCode( | |
| 8333 'EXTERNAL_GETTER_WITH_BODY', "External getters cannot have a body"); | |
| 8334 | |
| 8335 static const ParserErrorCode EXTERNAL_METHOD_WITH_BODY = | |
| 8336 const ParserErrorCode( | |
| 8337 'EXTERNAL_METHOD_WITH_BODY', "External methods cannot have a body"); | |
| 8338 | |
| 8339 static const ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = | |
| 8340 const ParserErrorCode('EXTERNAL_OPERATOR_WITH_BODY', | |
| 8341 "External operators cannot have a body"); | |
| 8342 | |
| 8343 static const ParserErrorCode EXTERNAL_SETTER_WITH_BODY = | |
| 8344 const ParserErrorCode( | |
| 8345 'EXTERNAL_SETTER_WITH_BODY', "External setters cannot have a body"); | |
| 8346 | |
| 8347 static const ParserErrorCode EXTERNAL_TYPEDEF = const ParserErrorCode( | |
| 8348 'EXTERNAL_TYPEDEF', "Type aliases cannot be declared to be 'external'"); | |
| 8349 | |
| 8350 static const ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = | |
| 8351 const ParserErrorCode('FACTORY_TOP_LEVEL_DECLARATION', | |
| 8352 "Top-level declarations cannot be declared to be 'factory'"); | |
| 8353 | |
| 8354 static const ParserErrorCode FACTORY_WITH_INITIALIZERS = | |
| 8355 const ParserErrorCode( | |
| 8356 'FACTORY_WITH_INITIALIZERS', | |
| 8357 "A 'factory' constructor cannot have initializers", | |
| 8358 "Either remove the 'factory' keyword to make this a generative " | |
| 8359 "constructor or remove the initializers."); | |
| 8360 | |
| 8361 static const ParserErrorCode FACTORY_WITHOUT_BODY = const ParserErrorCode( | |
| 8362 'FACTORY_WITHOUT_BODY', | |
| 8363 "A non-redirecting 'factory' constructor must have a body"); | |
| 8364 | |
| 8365 static const ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = | |
| 8366 const ParserErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', | |
| 8367 "Field initializers can only be used in a constructor"); | |
| 8368 | |
| 8369 static const ParserErrorCode FINAL_AND_VAR = const ParserErrorCode( | |
| 8370 'FINAL_AND_VAR', | |
| 8371 "Members cannot be declared to be both 'final' and 'var'"); | |
| 8372 | |
| 8373 static const ParserErrorCode FINAL_CLASS = const ParserErrorCode( | |
| 8374 'FINAL_CLASS', "Classes cannot be declared to be 'final'"); | |
| 8375 | |
| 8376 static const ParserErrorCode FINAL_CONSTRUCTOR = const ParserErrorCode( | |
| 8377 'FINAL_CONSTRUCTOR', "A constructor cannot be declared to be 'final'"); | |
| 8378 | |
| 8379 static const ParserErrorCode FINAL_ENUM = const ParserErrorCode( | |
| 8380 'FINAL_ENUM', "Enums cannot be declared to be 'final'"); | |
| 8381 | |
| 8382 static const ParserErrorCode FINAL_METHOD = const ParserErrorCode( | |
| 8383 'FINAL_METHOD', | |
| 8384 "Getters, setters and methods cannot be declared to be 'final'"); | |
| 8385 | |
| 8386 static const ParserErrorCode FINAL_TYPEDEF = const ParserErrorCode( | |
| 8387 'FINAL_TYPEDEF', "Type aliases cannot be declared to be 'final'"); | |
| 8388 | |
| 8389 static const ParserErrorCode FUNCTION_TYPED_PARAMETER_VAR = const ParserErrorC
ode( | |
| 8390 'FUNCTION_TYPED_PARAMETER_VAR', | |
| 8391 "Function typed parameters cannot specify 'const', 'final' or 'var' instea
d of return type"); | |
| 8392 | |
| 8393 static const ParserErrorCode GETTER_IN_FUNCTION = const ParserErrorCode( | |
| 8394 'GETTER_IN_FUNCTION', | |
| 8395 "Getters cannot be defined within methods or functions"); | |
| 8396 | |
| 8397 static const ParserErrorCode GETTER_WITH_PARAMETERS = const ParserErrorCode( | |
| 8398 'GETTER_WITH_PARAMETERS', | |
| 8399 "Getter should be declared without a parameter list"); | |
| 8400 | |
| 8401 static const ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = | |
| 8402 const ParserErrorCode('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', | |
| 8403 "Illegal assignment to non-assignable expression"); | |
| 8404 | |
| 8405 static const ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = | |
| 8406 const ParserErrorCode('IMPLEMENTS_BEFORE_EXTENDS', | |
| 8407 "The extends clause must be before the implements clause"); | |
| 8408 | |
| 8409 static const ParserErrorCode IMPLEMENTS_BEFORE_WITH = const ParserErrorCode( | |
| 8410 'IMPLEMENTS_BEFORE_WITH', | |
| 8411 "The with clause must be before the implements clause"); | |
| 8412 | |
| 8413 static const ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = | |
| 8414 const ParserErrorCode('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', | |
| 8415 "Import directives must preceed part directives"); | |
| 8416 | |
| 8417 static const ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = | |
| 8418 const ParserErrorCode('INITIALIZED_VARIABLE_IN_FOR_EACH', | |
| 8419 "The loop variable in a for-each loop cannot be initialized"); | |
| 8420 | |
| 8421 static const ParserErrorCode INVALID_AWAIT_IN_FOR = const ParserErrorCode( | |
| 8422 'INVALID_AWAIT_IN_FOR', | |
| 8423 "The modifier 'await' is not allowed for a normal 'for' statement", | |
| 8424 "Remove the keyword or use a for-each statement."); | |
| 8425 | |
| 8426 static const ParserErrorCode INVALID_CODE_POINT = const ParserErrorCode( | |
| 8427 'INVALID_CODE_POINT', | |
| 8428 "The escape sequence '{0}' is not a valid code point"); | |
| 8429 | |
| 8430 static const ParserErrorCode INVALID_COMMENT_REFERENCE = const ParserErrorCode
( | |
| 8431 'INVALID_COMMENT_REFERENCE', | |
| 8432 "Comment references should contain a possibly prefixed identifier and can
start with 'new', but should not contain anything else"); | |
| 8433 | |
| 8434 static const ParserErrorCode INVALID_HEX_ESCAPE = const ParserErrorCode( | |
| 8435 'INVALID_HEX_ESCAPE', | |
| 8436 "An escape sequence starting with '\\x' must be followed by 2 hexidecimal
digits"); | |
| 8437 | |
| 8438 static const ParserErrorCode INVALID_LITERAL_IN_CONFIGURATION = | |
| 8439 const ParserErrorCode('INVALID_LITERAL_IN_CONFIGURATION', | |
| 8440 "The literal in a configuration cannot contain interpolation"); | |
| 8441 | |
| 8442 static const ParserErrorCode INVALID_OPERATOR = const ParserErrorCode( | |
| 8443 'INVALID_OPERATOR', "The string '{0}' is not a valid operator"); | |
| 8444 | |
| 8445 static const ParserErrorCode INVALID_OPERATOR_FOR_SUPER = | |
| 8446 const ParserErrorCode('INVALID_OPERATOR_FOR_SUPER', | |
| 8447 "The operator '{0}' cannot be used with 'super'"); | |
| 8448 | |
| 8449 static const ParserErrorCode INVALID_STAR_AFTER_ASYNC = const ParserErrorCode( | |
| 8450 'INVALID_STAR_AFTER_ASYNC', | |
| 8451 "The modifier 'async*' is not allowed for an expression function body", | |
| 8452 "Convert the body to a block."); | |
| 8453 | |
| 8454 static const ParserErrorCode INVALID_SYNC = const ParserErrorCode( | |
| 8455 'INVALID_SYNC', | |
| 8456 "The modifier 'sync' is not allowed for an exrpression function body", | |
| 8457 "Convert the body to a block."); | |
| 8458 | |
| 8459 static const ParserErrorCode INVALID_UNICODE_ESCAPE = const ParserErrorCode( | |
| 8460 'INVALID_UNICODE_ESCAPE', | |
| 8461 "An escape sequence starting with '\\u' must be followed by 4 hexidecimal
digits or from 1 to 6 digits between '{' and '}'"); | |
| 8462 | |
| 8463 static const ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = | |
| 8464 const ParserErrorCode('LIBRARY_DIRECTIVE_NOT_FIRST', | |
| 8465 "The library directive must appear before all other directives"); | |
| 8466 | |
| 8467 static const ParserErrorCode LOCAL_FUNCTION_DECLARATION_MODIFIER = | |
| 8468 const ParserErrorCode('LOCAL_FUNCTION_DECLARATION_MODIFIER', | |
| 8469 "Local function declarations cannot specify any modifier"); | |
| 8470 | |
| 8471 static const ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = | |
| 8472 const ParserErrorCode('MISSING_ASSIGNABLE_SELECTOR', | |
| 8473 "Missing selector such as \".<identifier>\" or \"[0]\""); | |
| 8474 | |
| 8475 static const ParserErrorCode MISSING_ASSIGNMENT_IN_INITIALIZER = | |
| 8476 const ParserErrorCode('MISSING_ASSIGNMENT_IN_INITIALIZER', | |
| 8477 "Expected an assignment after the field name"); | |
| 8478 | |
| 8479 static const ParserErrorCode MISSING_CATCH_OR_FINALLY = const ParserErrorCode( | |
| 8480 'MISSING_CATCH_OR_FINALLY', | |
| 8481 "A try statement must have either a catch or finally clause"); | |
| 8482 | |
| 8483 static const ParserErrorCode MISSING_CLASS_BODY = const ParserErrorCode( | |
| 8484 'MISSING_CLASS_BODY', | |
| 8485 "A class definition must have a body, even if it is empty"); | |
| 8486 | |
| 8487 static const ParserErrorCode MISSING_CLOSING_PARENTHESIS = | |
| 8488 const ParserErrorCode( | |
| 8489 'MISSING_CLOSING_PARENTHESIS', "The closing parenthesis is missing"); | |
| 8490 | |
| 8491 static const ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = | |
| 8492 const ParserErrorCode('MISSING_CONST_FINAL_VAR_OR_TYPE', | |
| 8493 "Variables must be declared using the keywords 'const', 'final', 'var'
or a type name"); | |
| 8494 | |
| 8495 static const ParserErrorCode MISSING_ENUM_BODY = const ParserErrorCode( | |
| 8496 'MISSING_ENUM_BODY', | |
| 8497 "An enum definition must have a body with at least one constant name"); | |
| 8498 | |
| 8499 static const ParserErrorCode MISSING_EXPRESSION_IN_INITIALIZER = | |
| 8500 const ParserErrorCode('MISSING_EXPRESSION_IN_INITIALIZER', | |
| 8501 "Expected an expression after the assignment operator"); | |
| 8502 | |
| 8503 static const ParserErrorCode MISSING_EXPRESSION_IN_THROW = | |
| 8504 const ParserErrorCode('MISSING_EXPRESSION_IN_THROW', | |
| 8505 "Missing expression after 'throw'.", "Did you mean 'rethrow'?"); | |
| 8506 | |
| 8507 static const ParserErrorCode MISSING_FUNCTION_BODY = const ParserErrorCode( | |
| 8508 'MISSING_FUNCTION_BODY', "A function body must be provided"); | |
| 8509 | |
| 8510 static const ParserErrorCode MISSING_FUNCTION_PARAMETERS = | |
| 8511 const ParserErrorCode('MISSING_FUNCTION_PARAMETERS', | |
| 8512 "Functions must have an explicit list of parameters"); | |
| 8513 | |
| 8514 static const ParserErrorCode MISSING_METHOD_PARAMETERS = | |
| 8515 const ParserErrorCode('MISSING_METHOD_PARAMETERS', | |
| 8516 "Methods must have an explicit list of parameters"); | |
| 8517 | |
| 8518 static const ParserErrorCode MISSING_GET = const ParserErrorCode( | |
| 8519 'MISSING_GET', | |
| 8520 "Getters must have the keyword 'get' before the getter name"); | |
| 8521 | |
| 8522 static const ParserErrorCode MISSING_IDENTIFIER = | |
| 8523 const ParserErrorCode('MISSING_IDENTIFIER', "Expected an identifier"); | |
| 8524 | |
| 8525 static const ParserErrorCode MISSING_INITIALIZER = | |
| 8526 const ParserErrorCode('MISSING_INITIALIZER', "Expected an initializer"); | |
| 8527 | |
| 8528 static const ParserErrorCode MISSING_KEYWORD_OPERATOR = const ParserErrorCode( | |
| 8529 'MISSING_KEYWORD_OPERATOR', | |
| 8530 "Operator declarations must be preceeded by the keyword 'operator'"); | |
| 8531 | |
| 8532 static const ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = | |
| 8533 const ParserErrorCode('MISSING_NAME_IN_LIBRARY_DIRECTIVE', | |
| 8534 "Library directives must include a library name"); | |
| 8535 | |
| 8536 static const ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = | |
| 8537 const ParserErrorCode('MISSING_NAME_IN_PART_OF_DIRECTIVE', | |
| 8538 "Library directives must include a library name"); | |
| 8539 | |
| 8540 static const ParserErrorCode MISSING_PREFIX_IN_DEFERRED_IMPORT = | |
| 8541 const ParserErrorCode('MISSING_PREFIX_IN_DEFERRED_IMPORT', | |
| 8542 "Deferred imports must have a prefix"); | |
| 8543 | |
| 8544 static const ParserErrorCode MISSING_STAR_AFTER_SYNC = const ParserErrorCode( | |
| 8545 'MISSING_STAR_AFTER_SYNC', | |
| 8546 "The modifier 'sync' must be followed by a star ('*')", | |
| 8547 "Remove the modifier or add a star."); | |
| 8548 | |
| 8549 static const ParserErrorCode MISSING_STATEMENT = | |
| 8550 const ParserErrorCode('MISSING_STATEMENT', "Expected a statement"); | |
| 8551 | |
| 8552 static const ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = | |
| 8553 const ParserErrorCode('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', | |
| 8554 "There is no '{0}' to close the parameter group"); | |
| 8555 | |
| 8556 static const ParserErrorCode MISSING_TYPEDEF_PARAMETERS = | |
| 8557 const ParserErrorCode('MISSING_TYPEDEF_PARAMETERS', | |
| 8558 "Type aliases for functions must have an explicit list of parameters")
; | |
| 8559 | |
| 8560 static const ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = const ParserErrorC
ode( | |
| 8561 'MISSING_VARIABLE_IN_FOR_EACH', | |
| 8562 "A loop variable must be declared in a for-each loop before the 'in', but
none were found"); | |
| 8563 | |
| 8564 static const ParserErrorCode MIXED_PARAMETER_GROUPS = const ParserErrorCode( | |
| 8565 'MIXED_PARAMETER_GROUPS', | |
| 8566 "Cannot have both positional and named parameters in a single parameter li
st"); | |
| 8567 | |
| 8568 static const ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = const ParserErrorCode( | |
| 8569 'MULTIPLE_EXTENDS_CLAUSES', | |
| 8570 "Each class definition can have at most one extends clause"); | |
| 8571 | |
| 8572 static const ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = | |
| 8573 const ParserErrorCode('MULTIPLE_IMPLEMENTS_CLAUSES', | |
| 8574 "Each class definition can have at most one implements clause"); | |
| 8575 | |
| 8576 static const ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = | |
| 8577 const ParserErrorCode('MULTIPLE_LIBRARY_DIRECTIVES', | |
| 8578 "Only one library directive may be declared in a file"); | |
| 8579 | |
| 8580 static const ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = | |
| 8581 const ParserErrorCode('MULTIPLE_NAMED_PARAMETER_GROUPS', | |
| 8582 "Cannot have multiple groups of named parameters in a single parameter
list"); | |
| 8583 | |
| 8584 static const ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = | |
| 8585 const ParserErrorCode('MULTIPLE_PART_OF_DIRECTIVES', | |
| 8586 "Only one part-of directive may be declared in a file"); | |
| 8587 | |
| 8588 static const ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = | |
| 8589 const ParserErrorCode('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', | |
| 8590 "Cannot have multiple groups of positional parameters in a single para
meter list"); | |
| 8591 | |
| 8592 static const ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = | |
| 8593 const ParserErrorCode('MULTIPLE_VARIABLES_IN_FOR_EACH', | |
| 8594 "A single loop variable must be declared in a for-each loop before the
'in', but {0} were found"); | |
| 8595 | |
| 8596 static const ParserErrorCode MULTIPLE_WITH_CLAUSES = const ParserErrorCode( | |
| 8597 'MULTIPLE_WITH_CLAUSES', | |
| 8598 "Each class definition can have at most one with clause"); | |
| 8599 | |
| 8600 static const ParserErrorCode NAMED_FUNCTION_EXPRESSION = | |
| 8601 const ParserErrorCode( | |
| 8602 'NAMED_FUNCTION_EXPRESSION', "Function expressions cannot be named"); | |
| 8603 | |
| 8604 static const ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = | |
| 8605 const ParserErrorCode('NAMED_PARAMETER_OUTSIDE_GROUP', | |
| 8606 "Named parameters must be enclosed in curly braces ('{' and '}')"); | |
| 8607 | |
| 8608 static const ParserErrorCode NATIVE_CLAUSE_IN_NON_SDK_CODE = | |
| 8609 const ParserErrorCode('NATIVE_CLAUSE_IN_NON_SDK_CODE', | |
| 8610 "Native clause can only be used in the SDK and code that is loaded thr
ough native extensions"); | |
| 8611 | |
| 8612 static const ParserErrorCode NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE = | |
| 8613 const ParserErrorCode('NATIVE_FUNCTION_BODY_IN_NON_SDK_CODE', | |
| 8614 "Native functions can only be declared in the SDK and code that is loa
ded through native extensions"); | |
| 8615 | |
| 8616 static const ParserErrorCode NON_CONSTRUCTOR_FACTORY = const ParserErrorCode( | |
| 8617 'NON_CONSTRUCTOR_FACTORY', | |
| 8618 "Only constructors can be declared to be a 'factory'"); | |
| 8619 | |
| 8620 static const ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = | |
| 8621 const ParserErrorCode('NON_IDENTIFIER_LIBRARY_NAME', | |
| 8622 "The name of a library must be an identifier"); | |
| 8623 | |
| 8624 static const ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = | |
| 8625 const ParserErrorCode('NON_PART_OF_DIRECTIVE_IN_PART', | |
| 8626 "The part-of directive must be the only directive in a part"); | |
| 8627 | |
| 8628 static const ParserErrorCode NON_STRING_LITERAL_AS_URI = | |
| 8629 const ParserErrorCode( | |
| 8630 'NON_STRING_LITERAL_AS_URI', | |
| 8631 "The URI must be a string literal", | |
| 8632 "Enclose the URI in either single or double quotes."); | |
| 8633 | |
| 8634 static const ParserErrorCode NON_USER_DEFINABLE_OPERATOR = | |
| 8635 const ParserErrorCode('NON_USER_DEFINABLE_OPERATOR', | |
| 8636 "The operator '{0}' is not user definable"); | |
| 8637 | |
| 8638 static const ParserErrorCode NORMAL_BEFORE_OPTIONAL_PARAMETERS = | |
| 8639 const ParserErrorCode('NORMAL_BEFORE_OPTIONAL_PARAMETERS', | |
| 8640 "Normal parameters must occur before optional parameters"); | |
| 8641 | |
| 8642 static const ParserErrorCode NULLABLE_TYPE_IN_EXTENDS = const ParserErrorCode( | |
| 8643 'NULLABLE_TYPE_IN_EXTENDS', | |
| 8644 "A nullable type cannot be used in an extends clause", | |
| 8645 "Remove the '?' from the type name"); | |
| 8646 | |
| 8647 static const ParserErrorCode NULLABLE_TYPE_IN_IMPLEMENTS = | |
| 8648 const ParserErrorCode( | |
| 8649 'NULLABLE_TYPE_IN_IMPLEMENTS', | |
| 8650 "A nullable type cannot be used in an implements clause", | |
| 8651 "Remove the '?' from the type name"); | |
| 8652 | |
| 8653 static const ParserErrorCode NULLABLE_TYPE_IN_WITH = const ParserErrorCode( | |
| 8654 'NULLABLE_TYPE_IN_WITH', | |
| 8655 "A nullable type cannot be used in a with clause", | |
| 8656 "Remove the '?' from the type name"); | |
| 8657 | |
| 8658 static const ParserErrorCode NULLABLE_TYPE_PARAMETER = const ParserErrorCode( | |
| 8659 'NULLABLE_TYPE_PARAMETER', | |
| 8660 "Type parameters cannot be nullable", | |
| 8661 "Remove the '?' from the type name"); | |
| 8662 | |
| 8663 static const ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = | |
| 8664 const ParserErrorCode('POSITIONAL_AFTER_NAMED_ARGUMENT', | |
| 8665 "Positional arguments must occur before named arguments"); | |
| 8666 | |
| 8667 static const ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = | |
| 8668 const ParserErrorCode('POSITIONAL_PARAMETER_OUTSIDE_GROUP', | |
| 8669 "Positional parameters must be enclosed in square brackets ('[' and ']
')"); | |
| 8670 | |
| 8671 static const ParserErrorCode REDIRECTING_CONSTRUCTOR_WITH_BODY = | |
| 8672 const ParserErrorCode('REDIRECTING_CONSTRUCTOR_WITH_BODY', | |
| 8673 "Redirecting constructors cannot have a body"); | |
| 8674 | |
| 8675 static const ParserErrorCode REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR = | |
| 8676 const ParserErrorCode('REDIRECTION_IN_NON_FACTORY_CONSTRUCTOR', | |
| 8677 "Only factory constructor can specify '=' redirection."); | |
| 8678 | |
| 8679 static const ParserErrorCode SETTER_IN_FUNCTION = const ParserErrorCode( | |
| 8680 'SETTER_IN_FUNCTION', | |
| 8681 "Setters cannot be defined within methods or functions"); | |
| 8682 | |
| 8683 static const ParserErrorCode STATIC_AFTER_CONST = const ParserErrorCode( | |
| 8684 'STATIC_AFTER_CONST', | |
| 8685 "The modifier 'static' should be before the modifier 'const'"); | |
| 8686 | |
| 8687 static const ParserErrorCode STATIC_AFTER_FINAL = const ParserErrorCode( | |
| 8688 'STATIC_AFTER_FINAL', | |
| 8689 "The modifier 'static' should be before the modifier 'final'"); | |
| 8690 | |
| 8691 static const ParserErrorCode STATIC_AFTER_VAR = const ParserErrorCode( | |
| 8692 'STATIC_AFTER_VAR', | |
| 8693 "The modifier 'static' should be before the modifier 'var'"); | |
| 8694 | |
| 8695 static const ParserErrorCode STATIC_CONSTRUCTOR = const ParserErrorCode( | |
| 8696 'STATIC_CONSTRUCTOR', "Constructors cannot be static"); | |
| 8697 | |
| 8698 static const ParserErrorCode STATIC_GETTER_WITHOUT_BODY = | |
| 8699 const ParserErrorCode( | |
| 8700 'STATIC_GETTER_WITHOUT_BODY', "A 'static' getter must have a body"); | |
| 8701 | |
| 8702 static const ParserErrorCode STATIC_OPERATOR = | |
| 8703 const ParserErrorCode('STATIC_OPERATOR', "Operators cannot be static"); | |
| 8704 | |
| 8705 static const ParserErrorCode STATIC_SETTER_WITHOUT_BODY = | |
| 8706 const ParserErrorCode( | |
| 8707 'STATIC_SETTER_WITHOUT_BODY', "A 'static' setter must have a body"); | |
| 8708 | |
| 8709 static const ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = | |
| 8710 const ParserErrorCode('STATIC_TOP_LEVEL_DECLARATION', | |
| 8711 "Top-level declarations cannot be declared to be 'static'"); | |
| 8712 | |
| 8713 static const ParserErrorCode SWITCH_HAS_CASE_AFTER_DEFAULT_CASE = | |
| 8714 const ParserErrorCode('SWITCH_HAS_CASE_AFTER_DEFAULT_CASE', | |
| 8715 "The 'default' case should be the last case in a switch statement"); | |
| 8716 | |
| 8717 static const ParserErrorCode SWITCH_HAS_MULTIPLE_DEFAULT_CASES = | |
| 8718 const ParserErrorCode('SWITCH_HAS_MULTIPLE_DEFAULT_CASES', | |
| 8719 "The 'default' case can only be declared once"); | |
| 8720 | |
| 8721 static const ParserErrorCode TOP_LEVEL_OPERATOR = const ParserErrorCode( | |
| 8722 'TOP_LEVEL_OPERATOR', "Operators must be declared within a class"); | |
| 8723 | |
| 8724 static const ParserErrorCode TYPEDEF_IN_CLASS = const ParserErrorCode( | |
| 8725 'TYPEDEF_IN_CLASS', | |
| 8726 "Function type aliases cannot be declared inside classes"); | |
| 8727 | |
| 8728 static const ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = | |
| 8729 const ParserErrorCode('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', | |
| 8730 "There is no '{0}' to open a parameter group"); | |
| 8731 | |
| 8732 static const ParserErrorCode UNEXPECTED_TOKEN = | |
| 8733 const ParserErrorCode('UNEXPECTED_TOKEN', "Unexpected token '{0}'"); | |
| 8734 | |
| 8735 static const ParserErrorCode WITH_BEFORE_EXTENDS = const ParserErrorCode( | |
| 8736 'WITH_BEFORE_EXTENDS', | |
| 8737 "The extends clause must be before the with clause"); | |
| 8738 | |
| 8739 static const ParserErrorCode WITH_WITHOUT_EXTENDS = const ParserErrorCode( | |
| 8740 'WITH_WITHOUT_EXTENDS', | |
| 8741 "The with clause cannot be used without an extends clause"); | |
| 8742 | |
| 8743 static const ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = | |
| 8744 const ParserErrorCode('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', | |
| 8745 "The default value of a named parameter should be preceeded by ':'"); | |
| 8746 | |
| 8747 static const ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = | |
| 8748 const ParserErrorCode('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', | |
| 8749 "The default value of a positional parameter should be preceeded by '=
'"); | |
| 8750 | |
| 8751 static const ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = | |
| 8752 const ParserErrorCode('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', | |
| 8753 "Expected '{0}' to close parameter group"); | |
| 8754 | |
| 8755 static const ParserErrorCode VAR_AND_TYPE = const ParserErrorCode( | |
| 8756 'VAR_AND_TYPE', | |
| 8757 "Variables cannot be declared using both 'var' and a type name; remove the
'var'"); | |
| 8758 | |
| 8759 static const ParserErrorCode VAR_AS_TYPE_NAME = const ParserErrorCode( | |
| 8760 'VAR_AS_TYPE_NAME', "The keyword 'var' cannot be used as a type name"); | |
| 8761 | |
| 8762 static const ParserErrorCode VAR_CLASS = const ParserErrorCode( | |
| 8763 'VAR_CLASS', "Classes cannot be declared to be 'var'"); | |
| 8764 | |
| 8765 static const ParserErrorCode VAR_ENUM = | |
| 8766 const ParserErrorCode('VAR_ENUM', "Enums cannot be declared to be 'var'"); | |
| 8767 | |
| 8768 static const ParserErrorCode VAR_RETURN_TYPE = const ParserErrorCode( | |
| 8769 'VAR_RETURN_TYPE', "The return type cannot be 'var'"); | |
| 8770 | |
| 8771 static const ParserErrorCode VAR_TYPEDEF = const ParserErrorCode( | |
| 8772 'VAR_TYPEDEF', "Type aliases cannot be declared to be 'var'"); | |
| 8773 | |
| 8774 static const ParserErrorCode VOID_PARAMETER = const ParserErrorCode( | |
| 8775 'VOID_PARAMETER', "Parameters cannot have a type of 'void'"); | |
| 8776 | |
| 8777 static const ParserErrorCode VOID_VARIABLE = const ParserErrorCode( | |
| 8778 'VOID_VARIABLE', "Variables cannot have a type of 'void'"); | |
| 8779 | |
| 8780 /** | |
| 8781 * Initialize a newly created error code to have the given [name]. The message | |
| 8782 * associated with the error will be created from the given [message] | |
| 8783 * template. The correction associated with the error will be created from the | |
| 8784 * given [correction] template. | |
| 8785 */ | |
| 8786 const ParserErrorCode(String name, String message, [String correction]) | |
| 8787 : super(name, message, correction); | |
| 8788 | |
| 8789 @override | |
| 8790 ErrorSeverity get errorSeverity => ErrorSeverity.ERROR; | |
| 8791 | |
| 8792 @override | |
| 8793 ErrorType get type => ErrorType.SYNTACTIC_ERROR; | |
| 8794 } | |
| OLD | NEW |