Use limited JavaStringBuilder implementation instead of Dart StringBuffer.

StringBuffer.clear() is deprecated and will be removed.

R=pquitslund@google.com
BUG=

Review URL: https://codereview.chromium.org//12543003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@19565 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
scheglov@google.com 2013-03-06 17:12:47 +00:00
parent e8ade81cf7
commit be50bddc3e
12 changed files with 580 additions and 495 deletions

View file

@ -6798,15 +6798,15 @@ class LibraryIdentifier extends Identifier {
Element get element => null;
Token get endToken => _components.endToken;
String get name {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
bool needsPeriod = false;
for (SimpleIdentifier identifier in _components) {
if (needsPeriod) {
builder.write(".");
builder.append(".");
} else {
needsPeriod = true;
}
builder.write(identifier.name);
builder.append(identifier.name);
}
return builder.toString();
}
@ -10849,13 +10849,13 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> {
*/
static Object NOT_A_CONSTANT = new Object();
Object visitAdjacentStrings(AdjacentStrings node) {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
for (StringLiteral string in node.strings) {
Object value = string.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
builder.write(value);
builder.append(value);
}
return builder.toString();
}
@ -11054,13 +11054,13 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> {
Object visitSimpleIdentifier(SimpleIdentifier node) => getConstantValue(null);
Object visitSimpleStringLiteral(SimpleStringLiteral node) => node.value;
Object visitStringInterpolation(StringInterpolation node) {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
for (InterpolationElement element in node.elements) {
Object value = element.accept(this);
if (identical(value, NOT_A_CONSTANT)) {
return value;
}
builder.write(value);
builder.append(value);
}
return builder.toString();
}

View file

@ -1416,23 +1416,23 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
safelyVisitChildren(_methods, visitor);
safelyVisitChildren(_typeVariables, visitor);
}
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
String name11 = name;
if (name11 == null) {
builder.write("{unnamed class}");
builder.append("{unnamed class}");
} else {
builder.write(name11);
builder.append(name11);
}
int variableCount = _typeVariables.length;
if (variableCount > 0) {
builder.write("<");
builder.append("<");
for (int i = 0; i < variableCount; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
}
builder.write(">");
builder.append(">");
}
}
void collectAllSupertypes(Collection<InterfaceType> list) {
@ -1641,11 +1641,11 @@ class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
safelyVisitChildren(_types, visitor);
safelyVisitChildren(_variables, visitor);
}
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
if (_source == null) {
builder.write("{compilation unit}");
builder.append("{compilation unit}");
} else {
builder.write(_source.fullName);
builder.append(_source.fullName);
}
}
}
@ -1676,12 +1676,12 @@ class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
void set factory(bool isFactory) {
setModifier(Modifier.FACTORY, isFactory);
}
void appendTo(StringBuffer builder) {
builder.write(enclosingElement.name);
void appendTo(JavaStringBuilder builder) {
builder.append(enclosingElement.name);
String name12 = name;
if (name12 != null && !name12.isEmpty) {
builder.write(".");
builder.write(name12);
builder.append(".");
builder.append(name12);
}
super.appendTo(builder);
}
@ -1829,7 +1829,7 @@ abstract class ElementImpl implements Element {
setModifier(Modifier.SYNTHETIC, isSynthetic);
}
String toString() {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
appendTo(builder);
return builder.toString();
}
@ -1839,13 +1839,13 @@ abstract class ElementImpl implements Element {
* Append a textual representation of this type to the given builder.
* @param builder the builder to which the text is to be appended
*/
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
if (_name == null) {
builder.write("<unnamed ");
builder.write(runtimeType.toString());
builder.write(">");
builder.append("<unnamed ");
builder.append(runtimeType.toString());
builder.append(">");
} else {
builder.write(_name);
builder.append(_name);
}
}
/**
@ -1954,11 +1954,11 @@ class ElementLocationImpl implements ElementLocation {
*/
List<String> get components => _components;
String get encoding {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
int length2 = _components.length;
for (int i = 0; i < length2; i++) {
if (i > 0) {
builder.writeCharCode(_SEPARATOR_CHAR);
builder.appendChar(_SEPARATOR_CHAR);
}
encode(builder, _components[i]);
}
@ -1973,22 +1973,22 @@ class ElementLocationImpl implements ElementLocation {
*/
List<String> decode(String encoding) {
List<String> components = new List<String>();
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
int index = 0;
int length3 = encoding.length;
while (index < length3) {
int currentChar = encoding.codeUnitAt(index);
if (currentChar == _SEPARATOR_CHAR) {
if (index + 1 < length3 && encoding.codeUnitAt(index + 1) == _SEPARATOR_CHAR) {
builder.writeCharCode(_SEPARATOR_CHAR);
builder.appendChar(_SEPARATOR_CHAR);
index += 2;
} else {
components.add(builder.toString());
builder.clear();
builder.length = 0;
index++;
}
} else {
builder.writeCharCode(currentChar);
builder.appendChar(currentChar);
index++;
}
}
@ -2002,14 +2002,14 @@ class ElementLocationImpl implements ElementLocation {
* @param builder the builder to which the encoded component is to be appended
* @param component the component to be appended to the builder
*/
void encode(StringBuffer builder, String component) {
void encode(JavaStringBuilder builder, String component) {
int length4 = component.length;
for (int i = 0; i < length4; i++) {
int currentChar = component.codeUnitAt(i);
if (currentChar == _SEPARATOR_CHAR) {
builder.writeCharCode(_SEPARATOR_CHAR);
builder.appendChar(_SEPARATOR_CHAR);
}
builder.writeCharCode(currentChar);
builder.appendChar(currentChar);
}
}
}
@ -2143,19 +2143,19 @@ abstract class ExecutableElementImpl extends ElementImpl implements ExecutableEl
safelyVisitChildren(_localVariables, visitor);
safelyVisitChildren(_parameters, visitor);
}
void appendTo(StringBuffer builder) {
builder.write("(");
void appendTo(JavaStringBuilder builder) {
builder.append("(");
int parameterCount = _parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_parameters[i] as ParameterElementImpl)).appendTo(builder);
}
builder.write(")");
builder.append(")");
if (_type != null) {
builder.write(" -> ");
builder.write(_type.returnType);
builder.append(" -> ");
builder.append(_type.returnType);
}
}
}
@ -2197,8 +2197,8 @@ class ExportElementImpl extends ElementImpl implements ExportElement {
void set exportedLibrary(LibraryElement exportedLibrary2) {
this._exportedLibrary = exportedLibrary2;
}
void appendTo(StringBuffer builder) {
builder.write("export ");
void appendTo(JavaStringBuilder builder) {
builder.append("export ");
((_exportedLibrary as LibraryElementImpl)).appendTo(builder);
}
}
@ -2296,10 +2296,10 @@ class FunctionElementImpl extends ExecutableElementImpl implements FunctionEleme
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
String name13 = name;
if (name13 != null) {
builder.write(name13);
builder.append(name13);
}
super.appendTo(builder);
}
@ -2328,14 +2328,14 @@ class HideCombinatorImpl implements HideCombinator {
this._hiddenNames = hiddenNames2;
}
String toString() {
StringBuffer builder = new StringBuffer();
builder.write("show ");
JavaStringBuilder builder = new JavaStringBuilder();
builder.append("show ");
int count = _hiddenNames.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
builder.write(_hiddenNames[i]);
builder.append(_hiddenNames[i]);
}
return builder.toString();
}
@ -2394,11 +2394,11 @@ class HtmlElementImpl extends ElementImpl implements HtmlElement {
super.visitChildren(visitor);
safelyVisitChildren(_libraries, visitor);
}
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
if (_source == null) {
builder.write("{HTML file}");
builder.append("{HTML file}");
} else {
builder.write(_source.fullName);
builder.append(_source.fullName);
}
}
}
@ -2457,8 +2457,8 @@ class ImportElementImpl extends ElementImpl implements ImportElement {
super.visitChildren(visitor);
safelyVisitChild(_prefix, visitor);
}
void appendTo(StringBuffer builder) {
builder.write("import ");
void appendTo(JavaStringBuilder builder) {
builder.append("import ");
((_importedLibrary as LibraryElementImpl)).appendTo(builder);
}
}
@ -2718,10 +2718,10 @@ class LocalVariableElementImpl extends VariableElementImpl implements LocalVaria
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
void appendTo(StringBuffer builder) {
builder.write(type);
builder.write(" ");
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append(type);
builder.append(" ");
builder.append(name);
}
}
/**
@ -2771,10 +2771,10 @@ class MethodElementImpl extends ExecutableElementImpl implements MethodElement {
void set static(bool isStatic) {
setModifier(Modifier.STATIC, isStatic);
}
void appendTo(StringBuffer builder) {
builder.write(enclosingElement.name);
builder.write(".");
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append(enclosingElement.name);
builder.append(".");
builder.append(name);
super.appendTo(builder);
}
}
@ -2850,16 +2850,16 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
}
bool isSynthetic() => true;
String toString() {
StringBuffer builder = new StringBuffer();
builder.write("[");
JavaStringBuilder builder = new JavaStringBuilder();
builder.append("[");
int count = _conflictingElements.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_conflictingElements[i] as ElementImpl)).appendTo(builder);
}
builder.write("]");
builder.append("]");
return builder.toString();
}
void visitChildren(ElementVisitor<Object> visitor) {
@ -2956,13 +2956,13 @@ class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
_visibleRangeOffset = offset;
_visibleRangeLength = length;
}
void appendTo(StringBuffer builder) {
builder.write(type);
builder.write(" ");
builder.write(name);
builder.write(" (");
builder.write(kind);
builder.write(")");
void appendTo(JavaStringBuilder builder) {
builder.append(type);
builder.append(" ");
builder.append(name);
builder.append(" (");
builder.append(kind);
builder.append(")");
}
}
/**
@ -2997,8 +2997,8 @@ class PrefixElementImpl extends ElementImpl implements PrefixElement {
}
this._importedLibraries = importedLibraries2;
}
void appendTo(StringBuffer builder) {
builder.write("as ");
void appendTo(JavaStringBuilder builder) {
builder.append("as ");
super.appendTo(builder);
}
}
@ -3068,9 +3068,9 @@ class PropertyAccessorElementImpl extends ExecutableElementImpl implements Prope
void set variable(PropertyInducingElement variable3) {
this._variable = variable3;
}
void appendTo(StringBuffer builder) {
builder.write(isGetter() ? "get " : "set ");
builder.write(variable.name);
void appendTo(JavaStringBuilder builder) {
builder.append(isGetter() ? "get " : "set ");
builder.append(variable.name);
super.appendTo(builder);
}
}
@ -3150,14 +3150,14 @@ class ShowCombinatorImpl implements ShowCombinator {
this._shownNames = shownNames2;
}
String toString() {
StringBuffer builder = new StringBuffer();
builder.write("show ");
JavaStringBuilder builder = new JavaStringBuilder();
builder.append("show ");
int count = _shownNames.length;
for (int i = 0; i < count; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
builder.write(_shownNames[i]);
builder.append(_shownNames[i]);
}
return builder.toString();
}
@ -3271,32 +3271,32 @@ class TypeAliasElementImpl extends ElementImpl implements TypeAliasElement {
safelyVisitChildren(_parameters, visitor);
safelyVisitChildren(_typeVariables, visitor);
}
void appendTo(StringBuffer builder) {
builder.write("typedef ");
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append("typedef ");
builder.append(name);
int variableCount = _typeVariables.length;
if (variableCount > 0) {
builder.write("<");
builder.append("<");
for (int i = 0; i < variableCount; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_typeVariables[i] as TypeVariableElementImpl)).appendTo(builder);
}
builder.write(">");
builder.append(">");
}
builder.write("(");
builder.append("(");
int parameterCount = _parameters.length;
for (int i = 0; i < parameterCount; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_parameters[i] as ParameterElementImpl)).appendTo(builder);
}
builder.write(")");
builder.append(")");
if (_type != null) {
builder.write(" -> ");
builder.write(_type.returnType);
builder.append(" -> ");
builder.append(_type.returnType);
}
}
}
@ -3341,11 +3341,11 @@ class TypeVariableElementImpl extends ElementImpl implements TypeVariableElement
void set type(TypeVariableType type9) {
this._type = type9;
}
void appendTo(StringBuffer builder) {
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append(name);
if (_bound != null) {
builder.write(" extends ");
builder.write(_bound);
builder.append(" extends ");
builder.append(_bound);
}
}
}
@ -3425,10 +3425,10 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen
super.visitChildren(visitor);
safelyVisitChild(_initializer, visitor);
}
void appendTo(StringBuffer builder) {
builder.write(type);
builder.write(" ");
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append(type);
builder.append(" ");
builder.append(name);
}
}
/**
@ -3709,13 +3709,13 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
newType._namedParameterTypes = substitute3(_namedParameterTypes, argumentTypes, parameterTypes);
return newType;
}
void appendTo(StringBuffer builder) {
builder.write("(");
void appendTo(JavaStringBuilder builder) {
builder.append("(");
bool needsComma = false;
if (_normalParameterTypes.length > 0) {
for (Type2 type in _normalParameterTypes) {
if (needsComma) {
builder.write(", ");
builder.append(", ");
} else {
needsComma = true;
}
@ -3724,43 +3724,43 @@ class FunctionTypeImpl extends TypeImpl implements FunctionType {
}
if (_optionalParameterTypes.length > 0) {
if (needsComma) {
builder.write(", ");
builder.append(", ");
needsComma = false;
}
builder.write("[");
builder.append("[");
for (Type2 type in _optionalParameterTypes) {
if (needsComma) {
builder.write(", ");
builder.append(", ");
} else {
needsComma = true;
}
((type as TypeImpl)).appendTo(builder);
}
builder.write("]");
builder.append("]");
needsComma = true;
}
if (_namedParameterTypes.length > 0) {
if (needsComma) {
builder.write(", ");
builder.append(", ");
needsComma = false;
}
builder.write("{");
builder.append("{");
for (MapEntry<String, Type2> entry in getMapEntrySet(_namedParameterTypes)) {
if (needsComma) {
builder.write(", ");
builder.append(", ");
} else {
needsComma = true;
}
builder.write(entry.getKey());
builder.write(": ");
builder.append(entry.getKey());
builder.append(": ");
((entry.getValue() as TypeImpl)).appendTo(builder);
}
builder.write("}");
builder.append("}");
needsComma = true;
}
builder.write(") -> ");
builder.append(") -> ");
if (_returnType == null) {
builder.write("null");
builder.append("null");
} else {
((_returnType as TypeImpl)).appendTo(builder);
}
@ -4065,18 +4065,18 @@ class InterfaceTypeImpl extends TypeImpl implements InterfaceType {
newType.typeArguments = TypeImpl.substitute(_typeArguments, argumentTypes, parameterTypes);
return newType;
}
void appendTo(StringBuffer builder) {
builder.write(name);
void appendTo(JavaStringBuilder builder) {
builder.append(name);
int argumentCount = _typeArguments.length;
if (argumentCount > 0) {
builder.write("<");
builder.append("<");
for (int i = 0; i < argumentCount; i++) {
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
((_typeArguments[i] as TypeImpl)).appendTo(builder);
}
builder.write(">");
builder.append(">");
}
}
}
@ -4136,7 +4136,7 @@ abstract class TypeImpl implements Type2 {
bool isSupertypeOf(Type2 type) => type.isSubtypeOf(this);
bool isVoid() => false;
String toString() {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
appendTo(builder);
return builder.toString();
}
@ -4144,11 +4144,11 @@ abstract class TypeImpl implements Type2 {
* Append a textual representation of this type to the given builder.
* @param builder the builder to which the text is to be appended
*/
void appendTo(StringBuffer builder) {
void appendTo(JavaStringBuilder builder) {
if (_name == null) {
builder.write("<unnamed type>");
builder.append("<unnamed type>");
} else {
builder.write(_name);
builder.append(_name);
}
}
}

View file

@ -195,14 +195,14 @@ class AnalysisError {
this._source = source4;
}
String toString() {
StringBuffer builder = new StringBuffer();
builder.write((_source != null) ? _source.fullName : "<unknown source>");
builder.write("(");
builder.write(_offset);
builder.write("..");
builder.write(_offset + _length - 1);
builder.write("): ");
builder.write(_message);
JavaStringBuilder builder = new JavaStringBuilder();
builder.append((_source != null) ? _source.fullName : "<unknown source>");
builder.append("(");
builder.append(_offset);
builder.append("..");
builder.append(_offset + _length - 1);
builder.append("): ");
builder.append(_message);
return builder.toString();
}
}
@ -312,49 +312,59 @@ class CompileTimeErrorCode implements ErrorCode {
* 12.30 Identifier Reference: It is a compile-time error to use a built-in identifier other than
* dynamic as a type annotation.
*/
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', 3, "");
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE', 3, "The built-in identifier '%s' cannot be as a type");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, "");
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 4, "The built-in identifier '%s' cannot be used as a type name");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', 5, "The built-in identifier '%s' cannot be used as a type alias name");
/**
* 12.30 Identifier Reference: It is a compile-time error if a built-in identifier is used as the
* declared name of a class, type parameter or type alias.
*/
static final CompileTimeErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME = new CompileTimeErrorCode('BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME', 6, "The built-in identifier '%s' cannot be used as a type variable name");
/**
* 13.9 Switch: It is a compile-time error if the class <i>C</i> implements the operator
* <i>==</i>.
*/
static final CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = new CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 5, "");
static final CompileTimeErrorCode CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS = new CompileTimeErrorCode('CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS', 7, "");
/**
* 12.1 Constants: It is a compile-time error if evaluation of a compile-time constant would raise
* an exception.
*/
static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 6, "");
static final CompileTimeErrorCode COMPILE_TIME_CONSTANT_RAISES_EXCEPTION = new CompileTimeErrorCode('COMPILE_TIME_CONSTANT_RAISES_EXCEPTION', 8, "");
/**
* 7.6 Constructors: A constructor name always begins with the name of its immediately enclosing
* class, and may optionally be followed by a dot and an identifier <i>id</i>. It is a
* compile-time error if <i>id</i> is the name of a member declared in the immediately enclosing
* class.
*/
static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER', 7, "");
static final CompileTimeErrorCode CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER = new CompileTimeErrorCode('CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER', 9, "");
/**
* 7.6.3 Constant Constructors: It is a compile-time error if a constant constructor is declared
* by a class that has a non-final instance variable.
*/
static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 8, "");
static final CompileTimeErrorCode CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD = new CompileTimeErrorCode('CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD', 10, "");
/**
* 6.2 Formal Parameters: It is a compile-time error if a formal parameter is declared as a
* constant variable.
*/
static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 9, "");
static final CompileTimeErrorCode CONST_FORMAL_PARAMETER = new CompileTimeErrorCode('CONST_FORMAL_PARAMETER', 11, "");
/**
* 5 Variables: A constant variable must be initialized to a compile-time constant or a
* compile-time error occurs.
*/
static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 10, "");
static final CompileTimeErrorCode CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE = new CompileTimeErrorCode('CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE', 12, "");
/**
* 12.11.2 Const: It is a compile-time error if evaluation of a constant object results in an
* uncaught exception being thrown.
*/
static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 11, "");
static final CompileTimeErrorCode CONST_EVAL_THROWS_EXCEPTION = new CompileTimeErrorCode('CONST_EVAL_THROWS_EXCEPTION', 13, "");
/**
* 12.11.2 Const: If <i>T</i> is a parameterized type <i>S&lt;U<sub>1</sub>, &hellip;,
* U<sub>m</sub>&gt;</i>, let <i>R = S</i>; It is a compile time error if <i>S</i> is not a
@ -363,19 +373,19 @@ class CompileTimeErrorCode implements ErrorCode {
* @param argumentCount the number of type arguments provided
* @param parameterCount the number of type parameters that were declared
*/
static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 12, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
static final CompileTimeErrorCode CONST_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_INVALID_TYPE_PARAMETERS', 14, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 12.11.2 Const: If <i>e</i> is of the form <i>const T(a<sub>1</sub>, &hellip;, a<sub>n</sub>,
* x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;, x<sub>n+k</sub>: a<sub>n+k</sub>)</i> it is a
* compile-time error if the type <i>T</i> does not declare a constant constructor with the same
* name as the declaration of <i>T</i>.
*/
static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 13, "");
static final CompileTimeErrorCode CONST_WITH_NON_CONST = new CompileTimeErrorCode('CONST_WITH_NON_CONST', 15, "");
/**
* 12.11.2 Const: In all of the above cases, it is a compile-time error if <i>a<sub>i</sub>, 1
* &lt;= i &lt;= n + k</i>, is not a compile-time constant expression.
*/
static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 14, "");
static final CompileTimeErrorCode CONST_WITH_NON_CONSTANT_ARGUMENT = new CompileTimeErrorCode('CONST_WITH_NON_CONSTANT_ARGUMENT', 16, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> is not a class accessible in the current
* scope, optionally followed by type arguments.
@ -385,52 +395,52 @@ class CompileTimeErrorCode implements ErrorCode {
* compile-time error if <i>T</i> is not a class accessible in the current scope, optionally
* followed by type arguments.
*/
static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 15, "");
static final CompileTimeErrorCode CONST_WITH_NON_TYPE = new CompileTimeErrorCode('CONST_WITH_NON_TYPE', 17, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T</i> includes any type parameters.
*/
static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 16, "");
static final CompileTimeErrorCode CONST_WITH_TYPE_PARAMETERS = new CompileTimeErrorCode('CONST_WITH_TYPE_PARAMETERS', 18, "");
/**
* 12.11.2 Const: It is a compile-time error if <i>T.id</i> is not the name of a constant
* constructor declared by the type <i>T</i>.
*/
static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 17, "");
static final CompileTimeErrorCode CONST_WITH_UNDEFINED_CONSTRUCTOR = new CompileTimeErrorCode('CONST_WITH_UNDEFINED_CONSTRUCTOR', 19, "");
/**
* 15.3.1 Typedef: It is a compile-time error if any default values are specified in the signature
* of a function type alias.
*/
static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 18, "");
static final CompileTimeErrorCode DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS', 20, "");
/**
* 3.1 Scoping: It is a compile-time error if there is more than one entity with the same name
* declared in the same scope.
* @param duplicateName the name of the duplicate entity
*/
static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 19, "The name '%s' is already defined");
static final CompileTimeErrorCode DUPLICATE_DEFINITION = new CompileTimeErrorCode('DUPLICATE_DEFINITION', 21, "The name '%s' is already defined");
/**
* 7 Classes: It is a compile-time error if a class declares two members of the same name.
*/
static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 20, "");
static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME', 22, "");
/**
* 7 Classes: It is a compile-time error if a class has an instance member and a static member
* with the same name.
*/
static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 21, "");
static final CompileTimeErrorCode DUPLICATE_MEMBER_NAME_INSTANCE_STATIC = new CompileTimeErrorCode('DUPLICATE_MEMBER_NAME_INSTANCE_STATIC', 23, "");
/**
* 12.14.2 Binding Actuals to Formals: It is a compile-time error if <i>q<sub>i</sub> =
* q<sub>j</sub></i> for any <i>i != j</i> [where <i>q<sub>i</sub></i> is the label for a named
* argument].
*/
static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 22, "");
static final CompileTimeErrorCode DUPLICATE_NAMED_ARGUMENT = new CompileTimeErrorCode('DUPLICATE_NAMED_ARGUMENT', 24, "");
/**
* 14.2 Exports: It is a compile-time error if the compilation unit found at the specified URI is
* not a library declaration.
*/
static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 23, "");
static final CompileTimeErrorCode EXPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('EXPORT_OF_NON_LIBRARY', 25, "");
/**
* 7.9 Superclasses: It is a compile-time error if the extends clause of a class <i>C</i> includes
* a type expression that does not denote a class available in the lexical scope of <i>C</i>.
*/
static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 24, "");
static final CompileTimeErrorCode EXTENDS_NON_CLASS = new CompileTimeErrorCode('EXTENDS_NON_CLASS', 26, "");
/**
* 12.2 Null: It is a compile-time error for a class to attempt to extend or implement Null.
* <p>
@ -445,152 +455,152 @@ class CompileTimeErrorCode implements ErrorCode {
* <p>
* 12.5 Strings: It is a compile-time error for a class to attempt to extend or implement String.
*/
static final CompileTimeErrorCode EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS', 25, "");
static final CompileTimeErrorCode EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS = new CompileTimeErrorCode('EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS', 27, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if more than one initializer corresponding to a given instance variable appears in
* <i>k</i>Äôs list.
*/
static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 26, "");
static final CompileTimeErrorCode FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS = new CompileTimeErrorCode('FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS', 28, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>Äôs initializer list contains an initializer for a final variable <i>f</i>
* whose declaration includes an initialization expression.
*/
static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 27, "");
static final CompileTimeErrorCode FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION', 29, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile time
* error if <i>k</i>Äôs initializer list contains an initializer for a variable that is initialized
* by means of an initializing formal of <i>k</i>.
*/
static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 28, "");
static final CompileTimeErrorCode FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER = new CompileTimeErrorCode('FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER', 30, "");
/**
* 7.6.1 Generative Constructors: It is a compile-time error if an initializing formal is used by
* a function other than a non-redirecting generative constructor.
*/
static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 29, "");
static final CompileTimeErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new CompileTimeErrorCode('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 31, "");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has been initialized
* at its point of declaration is also initialized in a constructor.
*/
static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 30, "");
static final CompileTimeErrorCode FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR = new CompileTimeErrorCode('FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR', 32, "");
/**
* 5 Variables: It is a compile-time error if a final instance variable that has is initialized by
* means of an initializing formal of a constructor is also initialized elsewhere in the same
* constructor.
*/
static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 31, "");
static final CompileTimeErrorCode FINAL_INITIALIZED_MULTIPLE_TIMES = new CompileTimeErrorCode('FINAL_INITIALIZED_MULTIPLE_TIMES', 33, "");
/**
* 5 Variables: It is a compile-time error if a library, static or local variable <i>v</i> is
* final and <i>v</i> is not initialized at its point of declaration.
*/
static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeErrorCode('FINAL_NOT_INITIALIZED', 32, "");
static final CompileTimeErrorCode FINAL_NOT_INITIALIZED = new CompileTimeErrorCode('FINAL_NOT_INITIALIZED', 34, "");
/**
* 7.2 Getters: It is a compile-time error if a class has both a getter and a method with the same
* name.
*/
static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 33, "");
static final CompileTimeErrorCode GETTER_AND_METHOD_WITH_SAME_NAME = new CompileTimeErrorCode('GETTER_AND_METHOD_WITH_SAME_NAME', 35, "");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class includes
* type dynamic.
*/
static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('IMPLEMENTS_DYNAMIC', 34, "");
static final CompileTimeErrorCode IMPLEMENTS_DYNAMIC = new CompileTimeErrorCode('IMPLEMENTS_DYNAMIC', 36, "");
/**
* 7.10 Superinterfaces: It is a compile-time error if the implements clause of a class <i>C</i>
* includes a type expression that does not denote a class available in the lexical scope of
* <i>C</i>.
*/
static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 35, "");
static final CompileTimeErrorCode IMPLEMENTS_NON_CLASS = new CompileTimeErrorCode('IMPLEMENTS_NON_CLASS', 37, "");
/**
* 7.10 Superinterfaces: It is a compile-time error if a type <i>T</i> appears more than once in
* the implements clause of a class.
*/
static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 36, "");
static final CompileTimeErrorCode IMPLEMENTS_REPEATED = new CompileTimeErrorCode('IMPLEMENTS_REPEATED', 38, "");
/**
* 7.10 Superinterfaces: It is a compile-time error if the interface of a class <i>C</i> is a
* superinterface of itself.
*/
static final CompileTimeErrorCode IMPLEMENTS_SELF = new CompileTimeErrorCode('IMPLEMENTS_SELF', 37, "");
static final CompileTimeErrorCode IMPLEMENTS_SELF = new CompileTimeErrorCode('IMPLEMENTS_SELF', 39, "");
/**
* 14.1 Imports: It is a compile-time error to import two different libraries with the same name.
*/
static final CompileTimeErrorCode IMPORT_DUPLICATED_LIBRARY_NAME = new CompileTimeErrorCode('IMPORT_DUPLICATED_LIBRARY_NAME', 38, "");
static final CompileTimeErrorCode IMPORT_DUPLICATED_LIBRARY_NAME = new CompileTimeErrorCode('IMPORT_DUPLICATED_LIBRARY_NAME', 40, "");
/**
* 14.1 Imports: It is a compile-time error if the compilation unit found at the specified URI is
* not a library declaration.
*/
static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 39, "");
static final CompileTimeErrorCode IMPORT_OF_NON_LIBRARY = new CompileTimeErrorCode('IMPORT_OF_NON_LIBRARY', 41, "");
/**
* 13.9 Switch: It is a compile-time error if values of the expressions <i>e<sub>k</sub></i> are
* not instances of the same class <i>C</i>, for all <i>1 &lt;= k &lt;= n</i>.
*/
static final CompileTimeErrorCode INCONSITENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode('INCONSITENT_CASE_EXPRESSION_TYPES', 40, "");
static final CompileTimeErrorCode INCONSITENT_CASE_EXPRESSION_TYPES = new CompileTimeErrorCode('INCONSITENT_CASE_EXPRESSION_TYPES', 42, "");
/**
* 7.6.1 Generative Constructors: An initializing formal has the form <i>this.id</i>. It is a
* compile-time error if <i>id</i> is not the name of an instance variable of the immediately
* enclosing class.
*/
static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 41, "");
static final CompileTimeErrorCode INITIALIZER_FOR_NON_EXISTANT_FIELD = new CompileTimeErrorCode('INITIALIZER_FOR_NON_EXISTANT_FIELD', 43, "");
/**
* 7.6 Constructors: It is a compile-time error if the name of a constructor is not a constructor
* name.
*/
static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('INVALID_CONSTRUCTOR_NAME', 42, "");
static final CompileTimeErrorCode INVALID_CONSTRUCTOR_NAME = new CompileTimeErrorCode('INVALID_CONSTRUCTOR_NAME', 44, "");
/**
* 7.6.2 Factories: It is a compile-time error if <i>M</i> is not the name of the immediately
* enclosing class.
*/
static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 43, "");
static final CompileTimeErrorCode INVALID_FACTORY_NAME_NOT_A_CLASS = new CompileTimeErrorCode('INVALID_FACTORY_NAME_NOT_A_CLASS', 45, "");
/**
* 7.1 Instance Methods: It is a static warning if an instance method <i>m1</i> overrides an
* instance member <i>m2</i>, the signature of <i>m2</i> explicitly specifies a default value for
* a formal parameter <i>p</i> and the signature of <i>m1</i> specifies a different default value
* for <i>p</i>.
*/
static final CompileTimeErrorCode INVALID_OVERRIDE_DEFAULT_VALUE = new CompileTimeErrorCode('INVALID_OVERRIDE_DEFAULT_VALUE', 44, "");
static final CompileTimeErrorCode INVALID_OVERRIDE_DEFAULT_VALUE = new CompileTimeErrorCode('INVALID_OVERRIDE_DEFAULT_VALUE', 46, "");
/**
* 7.1: It is a compile-time error if an instance method <i>m1</i> overrides an instance member
* <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by <i>m2</i>.
*/
static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErrorCode('INVALID_OVERRIDE_NAMED', 45, "");
static final CompileTimeErrorCode INVALID_OVERRIDE_NAMED = new CompileTimeErrorCode('INVALID_OVERRIDE_NAMED', 47, "");
/**
* 7.1 Instance Methods: It is a compile-time error if an instance method m1 overrides an instance
* member <i>m2</i> and <i>m1</i> has fewer optional positional parameters than <i>m2</i>.
*/
static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTimeErrorCode('INVALID_OVERRIDE_POSITIONAL', 46, "");
static final CompileTimeErrorCode INVALID_OVERRIDE_POSITIONAL = new CompileTimeErrorCode('INVALID_OVERRIDE_POSITIONAL', 48, "");
/**
* 7.1 Instance Methods: It is a compile-time error if an instance method <i>m1</i> overrides an
* instance member <i>m2</i> and <i>m1</i> has a different number of required parameters than
* <i>m2</i>.
*/
static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeErrorCode('INVALID_OVERRIDE_REQUIRED', 47, "");
static final CompileTimeErrorCode INVALID_OVERRIDE_REQUIRED = new CompileTimeErrorCode('INVALID_OVERRIDE_REQUIRED', 49, "");
/**
* 12.10 This: It is a compile-time error if this appears in a top-level function or variable
* initializer, in a factory constructor, or in a static method or variable initializer, or in the
* initializer of an instance variable.
*/
static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', 48, "");
static final CompileTimeErrorCode INVALID_REFERENCE_TO_THIS = new CompileTimeErrorCode('INVALID_REFERENCE_TO_THIS', 50, "");
/**
* 12.7 Maps: It is a compile-time error if the first type argument to a map literal is not
* String.
*/
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 49, "");
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_FOR_KEY = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_FOR_KEY', 51, "");
/**
* 12.6 Lists: It is a compile time error if the type argument of a constant list literal includes
* a type parameter.
*/
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 50, "");
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_LIST = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_LIST', 52, "");
/**
* 12.7 Maps: It is a compile time error if the type arguments of a constant map literal include a
* type parameter.
*/
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 51, "");
static final CompileTimeErrorCode INVALID_TYPE_ARGUMENT_IN_CONST_MAP = new CompileTimeErrorCode('INVALID_TYPE_ARGUMENT_IN_CONST_MAP', 53, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
* error if <i>k</i>'s initializer list contains an initializer for a variable that is not an
* instance variable declared in the immediately surrounding class.
*/
static final CompileTimeErrorCode INVALID_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('INVALID_VARIABLE_IN_INITIALIZER', 52, "");
static final CompileTimeErrorCode INVALID_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('INVALID_VARIABLE_IN_INITIALIZER', 54, "");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
* the innermost function in which <i>s<sub>b</sub></i> occurs.
@ -599,7 +609,7 @@ class CompileTimeErrorCode implements ErrorCode {
* <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub>c</sub></i> occurs.
* @param labelName the name of the unresolvable label
*/
static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 53, "Cannot reference label '%s' declared in an outer method or function");
static final CompileTimeErrorCode LABEL_IN_OUTER_SCOPE = new CompileTimeErrorCode('LABEL_IN_OUTER_SCOPE', 55, "Cannot reference label '%s' declared in an outer method or function");
/**
* 13.13 Break: It is a compile-time error if no such statement <i>s<sub>E</sub></i> exists within
* the innermost function in which <i>s<sub>b</sub></i> occurs.
@ -608,46 +618,46 @@ class CompileTimeErrorCode implements ErrorCode {
* <i>s<sub>E</sub></i> exists within the innermost function in which <i>s<sub>c</sub></i> occurs.
* @param labelName the name of the unresolvable label
*/
static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 54, "Cannot reference undefined label '%s'");
static final CompileTimeErrorCode LABEL_UNDEFINED = new CompileTimeErrorCode('LABEL_UNDEFINED', 56, "Cannot reference undefined label '%s'");
/**
* 7 Classes: It is a compile time error if a class <i>C</i> declares a member with the same name
* as <i>C</i>.
*/
static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', 55, "");
static final CompileTimeErrorCode MEMBER_WITH_CLASS_NAME = new CompileTimeErrorCode('MEMBER_WITH_CLASS_NAME', 57, "");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin explicitly declares a
* constructor.
*/
static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 56, "");
static final CompileTimeErrorCode MIXIN_DECLARES_CONSTRUCTOR = new CompileTimeErrorCode('MIXIN_DECLARES_CONSTRUCTOR', 58, "");
/**
* 9 Mixins: It is a compile-time error if a mixin is derived from a class whose superclass is not
* Object.
*/
static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 57, "");
static final CompileTimeErrorCode MIXIN_INHERITS_FROM_NOT_OBJECT = new CompileTimeErrorCode('MIXIN_INHERITS_FROM_NOT_OBJECT', 59, "");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>M</i> does not denote a class or mixin
* available in the immediately enclosing scope.
*/
static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 58, "");
static final CompileTimeErrorCode MIXIN_OF_NON_CLASS = new CompileTimeErrorCode('MIXIN_OF_NON_CLASS', 60, "");
/**
* 9.1 Mixin Application: If <i>M</i> is a class, it is a compile time error if a well formed
* mixin cannot be derived from <i>M</i>.
*/
static final CompileTimeErrorCode MIXIN_OF_NON_MIXIN = new CompileTimeErrorCode('MIXIN_OF_NON_MIXIN', 59, "");
static final CompileTimeErrorCode MIXIN_OF_NON_MIXIN = new CompileTimeErrorCode('MIXIN_OF_NON_MIXIN', 61, "");
/**
* 9 Mixins: It is a compile-time error if a declared or derived mixin refers to super.
*/
static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', 60, "");
static final CompileTimeErrorCode MIXIN_REFERENCES_SUPER = new CompileTimeErrorCode('MIXIN_REFERENCES_SUPER', 62, "");
/**
* 9.1 Mixin Application: It is a compile-time error if <i>S</i> does not denote a class available
* in the immediately enclosing scope.
*/
static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 61, "");
static final CompileTimeErrorCode MIXIN_WITH_NON_CLASS_SUPERCLASS = new CompileTimeErrorCode('MIXIN_WITH_NON_CLASS_SUPERCLASS', 63, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Then <i>k</i> may
* include at most one superinitializer in its initializer list or a compile time error occurs.
*/
static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 62, "");
static final CompileTimeErrorCode MULTIPLE_SUPER_INITIALIZERS = new CompileTimeErrorCode('MULTIPLE_SUPER_INITIALIZERS', 64, "");
/**
* 12.11.1 New: It is a compile time error if <i>S</i> is not a generic type with <i>m</i> type
* parameters.
@ -655,12 +665,12 @@ class CompileTimeErrorCode implements ErrorCode {
* @param argumentCount the number of type arguments provided
* @param parameterCount the number of type parameters that were declared
*/
static final CompileTimeErrorCode NEW_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 63, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
static final CompileTimeErrorCode NEW_WITH_INVALID_TYPE_PARAMETERS = new CompileTimeErrorCode('NEW_WITH_INVALID_TYPE_PARAMETERS', 65, "The type '%s' is declared with %d type parameters, but %d type arguments were given");
/**
* 13.2 Expression Statements: It is a compile-time error if a non-constant map literal that has
* no explicit type arguments appears in a place where a statement is expected.
*/
static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 64, "");
static final CompileTimeErrorCode NON_CONST_MAP_AS_EXPRESSION_STATEMENT = new CompileTimeErrorCode('NON_CONST_MAP_AS_EXPRESSION_STATEMENT', 66, "");
/**
* 13.9 Switch: Given a switch statement of the form <i>switch (e) { label<sub>11</sub> &hellip;
* label<sub>1j1</sub> case e<sub>1</sub>: s<sub>1</sub> &hellip; label<sub>n1</sub> &hellip;
@ -670,116 +680,116 @@ class CompileTimeErrorCode implements ErrorCode {
* s<sub>n</sub>}</i>, it is a compile-time error if the expressions <i>e<sub>k</sub></i> are not
* compile-time constants, for all <i>1 &lt;= k &lt;= n</i>.
*/
static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 65, "");
static final CompileTimeErrorCode NON_CONSTANT_CASE_EXPRESSION = new CompileTimeErrorCode('NON_CONSTANT_CASE_EXPRESSION', 67, "");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the default value of an optional
* parameter is not a compile-time constant.
*/
static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 66, "");
static final CompileTimeErrorCode NON_CONSTANT_DEFAULT_VALUE = new CompileTimeErrorCode('NON_CONSTANT_DEFAULT_VALUE', 68, "");
/**
* 12.6 Lists: It is a compile time error if an element of a constant list literal is not a
* compile-time constant.
*/
static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 67, "");
static final CompileTimeErrorCode NON_CONSTANT_LIST_ELEMENT = new CompileTimeErrorCode('NON_CONSTANT_LIST_ELEMENT', 69, "");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 68, "");
static final CompileTimeErrorCode NON_CONSTANT_MAP_KEY = new CompileTimeErrorCode('NON_CONSTANT_MAP_KEY', 70, "");
/**
* 12.7 Maps: It is a compile time error if either a key or a value of an entry in a constant map
* literal is not a compile-time constant.
*/
static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 69, "");
static final CompileTimeErrorCode NON_CONSTANT_MAP_VALUE = new CompileTimeErrorCode('NON_CONSTANT_MAP_VALUE', 71, "");
/**
* 7.6.3 Constant Constructors: Any expression that appears within the initializer list of a
* constant constructor must be a potentially constant expression, or a compile-time error occurs.
*/
static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 70, "");
static final CompileTimeErrorCode NON_CONSTANT_VALUE_IN_INITIALIZER = new CompileTimeErrorCode('NON_CONSTANT_VALUE_IN_INITIALIZER', 72, "");
/**
* 7.9 Superclasses: It is a compile-time error to specify an extends clause for class Object.
*/
static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 71, "");
static final CompileTimeErrorCode OBJECT_CANNOT_EXTEND_ANOTHER_CLASS = new CompileTimeErrorCode('OBJECT_CANNOT_EXTEND_ANOTHER_CLASS', 73, "");
/**
* 7.1.1 Operators: It is a compile-time error to declare an optional parameter in an operator.
*/
static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 72, "");
static final CompileTimeErrorCode OPTIONAL_PARAMETER_IN_OPERATOR = new CompileTimeErrorCode('OPTIONAL_PARAMETER_IN_OPERATOR', 74, "");
/**
* 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> overrides an
* interface member <i>m2</i> and <i>m1</i> does not declare all the named parameters declared by
* <i>m2</i> in the same order.
*/
static final CompileTimeErrorCode OVERRIDE_MISSING_NAMED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_NAMED_PARAMETERS', 73, "");
static final CompileTimeErrorCode OVERRIDE_MISSING_NAMED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_NAMED_PARAMETERS', 75, "");
/**
* 8 Interfaces: It is a compile-time error if an interface member <i>m1</i> overrides an
* interface member <i>m2</i> and <i>m1</i> has a different number of required parameters than
* <i>m2</i>.
*/
static final CompileTimeErrorCode OVERRIDE_MISSING_REQUIRED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_REQUIRED_PARAMETERS', 74, "");
static final CompileTimeErrorCode OVERRIDE_MISSING_REQUIRED_PARAMETERS = new CompileTimeErrorCode('OVERRIDE_MISSING_REQUIRED_PARAMETERS', 76, "");
/**
* 14.3 Parts: It is a compile time error if the contents of the URI are not a valid part
* declaration.
*/
static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 75, "");
static final CompileTimeErrorCode PART_OF_NON_PART = new CompileTimeErrorCode('PART_OF_NON_PART', 77, "");
/**
* 14.1 Imports: It is a compile-time error if the current library declares a top-level member
* named <i>p</i>.
*/
static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 76, "");
static final CompileTimeErrorCode PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER = new CompileTimeErrorCode('PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER', 78, "");
/**
* 6.2.2 Optional Formals: It is a compile-time error if the name of a named optional parameter
* begins with an Äò_Äô character.
*/
static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 77, "");
static final CompileTimeErrorCode PRIVATE_OPTIONAL_PARAMETER = new CompileTimeErrorCode('PRIVATE_OPTIONAL_PARAMETER', 79, "");
/**
* 12.1 Constants: It is a compile-time error if the value of a compile-time constant expression
* depends on itself.
*/
static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 78, "");
static final CompileTimeErrorCode RECURSIVE_COMPILE_TIME_CONSTANT = new CompileTimeErrorCode('RECURSIVE_COMPILE_TIME_CONSTANT', 80, "");
/**
* 7.6.2 Factories: It is a compile-time error if a redirecting factory constructor redirects to
* itself, either directly or indirectly via a sequence of redirections.
*/
static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 79, "");
static final CompileTimeErrorCode RECURSIVE_FACTORY_REDIRECT = new CompileTimeErrorCode('RECURSIVE_FACTORY_REDIRECT', 81, "");
/**
* 15.3.1 Typedef: It is a compile-time error if a typedef refers to itself via a chain of
* references that does not include a class type.
*/
static final CompileTimeErrorCode RECURSIVE_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('RECURSIVE_FUNCTION_TYPE_ALIAS', 80, "");
static final CompileTimeErrorCode RECURSIVE_FUNCTION_TYPE_ALIAS = new CompileTimeErrorCode('RECURSIVE_FUNCTION_TYPE_ALIAS', 82, "");
/**
* 8.1 Superinterfaces: It is a compile-time error if an interface is a superinterface of itself.
*/
static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 81, "");
static final CompileTimeErrorCode RECURSIVE_INTERFACE_INHERITANCE = new CompileTimeErrorCode('RECURSIVE_INTERFACE_INHERITANCE', 83, "");
/**
* 7.6.2 Factories: It is a compile-time error if <i>k</i> is prefixed with the const modifier but
* <i>kÄô</i> is not a constant constructor.
*/
static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 82, "");
static final CompileTimeErrorCode REDIRECT_TO_NON_CONST_CONSTRUCTOR = new CompileTimeErrorCode('REDIRECT_TO_NON_CONST_CONSTRUCTOR', 84, "");
/**
* 13.3 Local Variable Declaration: It is a compile-time error if <i>e</i> refers to the name
* <i>v</i> or the name <i>v=</i>.
*/
static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 83, "");
static final CompileTimeErrorCode REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER = new CompileTimeErrorCode('REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER', 85, "");
/**
* 16.1.1 Reserved Words: A reserved word may not be used as an identifier; it is a compile-time
* error if a reserved word is used where an identifier is expected.
*/
static final CompileTimeErrorCode RESERVED_WORD_AS_IDENTIFIER = new CompileTimeErrorCode('RESERVED_WORD_AS_IDENTIFIER', 84, "");
static final CompileTimeErrorCode RESERVED_WORD_AS_IDENTIFIER = new CompileTimeErrorCode('RESERVED_WORD_AS_IDENTIFIER', 86, "");
/**
* 13.11 Return: It is a compile-time error if a return statement of the form <i>return e;</i>
* appears in a generative constructor.
*/
static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 85, "");
static final CompileTimeErrorCode RETURN_IN_GENERATIVE_CONSTRUCTOR = new CompileTimeErrorCode('RETURN_IN_GENERATIVE_CONSTRUCTOR', 87, "");
/**
* 6.1 Function Declarations: It is a compile-time error to preface a function declaration with
* the built-in identifier static.
*/
static final CompileTimeErrorCode STATIC_TOP_LEVEL_FUNCTION = new CompileTimeErrorCode('STATIC_TOP_LEVEL_FUNCTION', 86, "");
static final CompileTimeErrorCode STATIC_TOP_LEVEL_FUNCTION = new CompileTimeErrorCode('STATIC_TOP_LEVEL_FUNCTION', 88, "");
/**
* 5 Variables: It is a compile-time error to preface a top level variable declaration with the
* built-in identifier static.
*/
static final CompileTimeErrorCode STATIC_TOP_LEVEL_VARIABLE = new CompileTimeErrorCode('STATIC_TOP_LEVEL_VARIABLE', 87, "");
static final CompileTimeErrorCode STATIC_TOP_LEVEL_VARIABLE = new CompileTimeErrorCode('STATIC_TOP_LEVEL_VARIABLE', 89, "");
/**
* 12.15.4 Super Invocation: A super method invocation <i>i</i> has the form
* <i>super.m(a<sub>1</sub>, &hellip;, a<sub>n</sub>, x<sub>n+1</sub>: a<sub>n+1</sub>, &hellip;
@ -788,17 +798,17 @@ class CompileTimeErrorCode implements ErrorCode {
* initializer list, in class Object, in a factory constructor, or in a static method or variable
* initializer.
*/
static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 88, "");
static final CompileTimeErrorCode SUPER_IN_INVALID_CONTEXT = new CompileTimeErrorCode('SUPER_IN_INVALID_CONTEXT', 90, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. It is a compile-time
* error if a generative constructor of class Object includes a superinitializer.
*/
static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 89, "");
static final CompileTimeErrorCode SUPER_INITIALIZER_IN_OBJECT = new CompileTimeErrorCode('SUPER_INITIALIZER_IN_OBJECT', 91, "");
/**
* 12.8 Throw: It is a compile-time error if an expression of the form throw; is not enclosed
* within a on-catch clause.
*/
static final CompileTimeErrorCode THROW_WITHOUT_VALUE_OUTSIDE_ON = new CompileTimeErrorCode('THROW_WITHOUT_VALUE_OUTSIDE_ON', 90, "");
static final CompileTimeErrorCode THROW_WITHOUT_VALUE_OUTSIDE_ON = new CompileTimeErrorCode('THROW_WITHOUT_VALUE_OUTSIDE_ON', 92, "");
/**
* 12.11 Instance Creation: It is a compile-time error if a constructor of a non-generic type
* invoked by a new expression or a constant object expression is passed any type arguments.
@ -807,14 +817,14 @@ class CompileTimeErrorCode implements ErrorCode {
* <i>G&lt;T<sub>1</sub>, &hellip;, T<sub>n</sub>&gt;</i> and <i>G</i> is not a generic type with
* <i>n</i> type parameters.
*/
static final CompileTimeErrorCode TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS = new CompileTimeErrorCode('TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS', 91, "");
static final CompileTimeErrorCode TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS = new CompileTimeErrorCode('TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS', 93, "");
/**
* 7.6.1 Generative Constructors: Let <i>C</i> be the class in which the superinitializer appears
* and let <i>S</i> be the superclass of <i>C</i>. Let <i>k</i> be a generative constructor. It is
* a compile-time error if class <i>S</i> does not declare a generative constructor named <i>S</i>
* (respectively <i>S.id</i>)
*/
static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 92, "");
static final CompileTimeErrorCode UNDEFINED_CONSTRUCTOR_IN_INITIALIZER = new CompileTimeErrorCode('UNDEFINED_CONSTRUCTOR_IN_INITIALIZER', 94, "");
/**
* 7.6.1 Generative Constructors: Let <i>k</i> be a generative constructor. Each final instance
* variable <i>f</i> declared in the immediately enclosing class must have an initializer in
@ -826,7 +836,7 @@ class CompileTimeErrorCode implements ErrorCode {
* </ol>
* or a compile-time error occurs.
*/
static final CompileTimeErrorCode UNINITIALIZED_FINAL_FIELD = new CompileTimeErrorCode('UNINITIALIZED_FINAL_FIELD', 93, "");
static final CompileTimeErrorCode UNINITIALIZED_FINAL_FIELD = new CompileTimeErrorCode('UNINITIALIZED_FINAL_FIELD', 95, "");
/**
* 14.1 Imports: It is a compile-time error if <i>x</i> is not a compile-time constant, or if
* <i>x</i> involves string interpolation.
@ -837,7 +847,7 @@ class CompileTimeErrorCode implements ErrorCode {
* 14.5 URIs: It is a compile-time error if the string literal <i>x</i> that describes a URI is
* not a compile-time constant, or if <i>x</i> involves string interpolation.
*/
static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 94, "URIs cannot use string interpolation");
static final CompileTimeErrorCode URI_WITH_INTERPOLATION = new CompileTimeErrorCode('URI_WITH_INTERPOLATION', 96, "URIs cannot use string interpolation");
/**
* 7.1.1 Operators: It is a compile-time error if the arity of the user-declared operator []= is
* not 2. It is a compile time error if the arity of a user-declared operator with one of the
@ -845,12 +855,12 @@ class CompileTimeErrorCode implements ErrorCode {
* It is a compile time error if the arity of the user-declared operator - is not 0 or 1. It is a
* compile time error if the arity of the user-declared operator ~ is not 0.
*/
static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 95, "");
static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR', 97, "");
/**
* 7.3 Setters: It is a compile-time error if a setterÄôs formal parameter list does not include
* exactly one required formal parameter <i>p</i>.
*/
static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 96, "");
static final CompileTimeErrorCode WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER = new CompileTimeErrorCode('WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER', 98, "");
/**
* 12.11 Instance Creation: It is a compile-time error if a constructor of a generic type with
* <i>n</i> type parameters invoked by a new expression or a constant object expression is passed
@ -860,8 +870,8 @@ class CompileTimeErrorCode implements ErrorCode {
* <i>G&lt;T<sub>1</sub>, &hellip;, T<sub>n</sub>&gt;</i> and <i>G</i> is not a generic type with
* <i>n</i> type parameters.
*/
static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 97, "");
static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FINAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLEMENTS_SELF, IMPORT_DUPLICATED_LIBRARY_NAME, IMPORT_OF_NON_LIBRARY, INCONSITENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_VARIABLE_IN_INITIALIZER, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_OF_NON_MIXIN, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, OVERRIDE_MISSING_NAMED_PARAMETERS, OVERRIDE_MISSING_REQUIRED_PARAMETERS, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_INITIALIZER_IN_OBJECT, THROW_WITHOUT_VALUE_OUTSIDE_ON, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNINITIALIZED_FINAL_FIELD, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
static final CompileTimeErrorCode WRONG_NUMBER_OF_TYPE_ARGUMENTS = new CompileTimeErrorCode('WRONG_NUMBER_OF_TYPE_ARGUMENTS', 99, "");
static final List<CompileTimeErrorCode> values = [AMBIGUOUS_EXPORT, AMBIGUOUS_IMPORT, ARGUMENT_DEFINITION_TEST_NON_PARAMETER, BUILT_IN_IDENTIFIER_AS_TYPE, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CASE_EXPRESSION_TYPE_IMPLEMENTS_EQUALS, COMPILE_TIME_CONSTANT_RAISES_EXCEPTION, CONFLICTING_CONSTRUCTOR_NAME_AND_MEMBER, CONST_CONSTRUCTOR_WITH_NON_FINAL_FIELD, CONST_FORMAL_PARAMETER, CONST_INITIALIZED_WITH_NON_CONSTANT_VALUE, CONST_EVAL_THROWS_EXCEPTION, CONST_WITH_INVALID_TYPE_PARAMETERS, CONST_WITH_NON_CONST, CONST_WITH_NON_CONSTANT_ARGUMENT, CONST_WITH_NON_TYPE, CONST_WITH_TYPE_PARAMETERS, CONST_WITH_UNDEFINED_CONSTRUCTOR, DEFAULT_VALUE_IN_FUNCTION_TYPE_ALIAS, DUPLICATE_DEFINITION, DUPLICATE_MEMBER_NAME, DUPLICATE_MEMBER_NAME_INSTANCE_STATIC, DUPLICATE_NAMED_ARGUMENT, EXPORT_OF_NON_LIBRARY, EXTENDS_NON_CLASS, EXTENDS_OR_IMPLEMENTS_DISALLOWED_CLASS, FIELD_INITIALIZED_BY_MULTIPLE_INITIALIZERS, FIELD_INITIALIZED_IN_INITIALIZER_AND_DECLARATION, FIELD_INITIALIZED_IN_PARAMETER_AND_INITIALIZER, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_INITIALIZED_IN_DECLARATION_AND_CONSTRUCTOR, FINAL_INITIALIZED_MULTIPLE_TIMES, FINAL_NOT_INITIALIZED, GETTER_AND_METHOD_WITH_SAME_NAME, IMPLEMENTS_DYNAMIC, IMPLEMENTS_NON_CLASS, IMPLEMENTS_REPEATED, IMPLEMENTS_SELF, IMPORT_DUPLICATED_LIBRARY_NAME, IMPORT_OF_NON_LIBRARY, INCONSITENT_CASE_EXPRESSION_TYPES, INITIALIZER_FOR_NON_EXISTANT_FIELD, INVALID_CONSTRUCTOR_NAME, INVALID_FACTORY_NAME_NOT_A_CLASS, INVALID_OVERRIDE_DEFAULT_VALUE, INVALID_OVERRIDE_NAMED, INVALID_OVERRIDE_POSITIONAL, INVALID_OVERRIDE_REQUIRED, INVALID_REFERENCE_TO_THIS, INVALID_TYPE_ARGUMENT_FOR_KEY, INVALID_TYPE_ARGUMENT_IN_CONST_LIST, INVALID_TYPE_ARGUMENT_IN_CONST_MAP, INVALID_VARIABLE_IN_INITIALIZER, LABEL_IN_OUTER_SCOPE, LABEL_UNDEFINED, MEMBER_WITH_CLASS_NAME, MIXIN_DECLARES_CONSTRUCTOR, MIXIN_INHERITS_FROM_NOT_OBJECT, MIXIN_OF_NON_CLASS, MIXIN_OF_NON_MIXIN, MIXIN_REFERENCES_SUPER, MIXIN_WITH_NON_CLASS_SUPERCLASS, MULTIPLE_SUPER_INITIALIZERS, NEW_WITH_INVALID_TYPE_PARAMETERS, NON_CONST_MAP_AS_EXPRESSION_STATEMENT, NON_CONSTANT_CASE_EXPRESSION, NON_CONSTANT_DEFAULT_VALUE, NON_CONSTANT_LIST_ELEMENT, NON_CONSTANT_MAP_KEY, NON_CONSTANT_MAP_VALUE, NON_CONSTANT_VALUE_IN_INITIALIZER, OBJECT_CANNOT_EXTEND_ANOTHER_CLASS, OPTIONAL_PARAMETER_IN_OPERATOR, OVERRIDE_MISSING_NAMED_PARAMETERS, OVERRIDE_MISSING_REQUIRED_PARAMETERS, PART_OF_NON_PART, PREFIX_COLLIDES_WITH_TOP_LEVEL_MEMBER, PRIVATE_OPTIONAL_PARAMETER, RECURSIVE_COMPILE_TIME_CONSTANT, RECURSIVE_FACTORY_REDIRECT, RECURSIVE_FUNCTION_TYPE_ALIAS, RECURSIVE_INTERFACE_INHERITANCE, REDIRECT_TO_NON_CONST_CONSTRUCTOR, REFERENCE_TO_DECLARED_VARIABLE_IN_INITIALIZER, RESERVED_WORD_AS_IDENTIFIER, RETURN_IN_GENERATIVE_CONSTRUCTOR, STATIC_TOP_LEVEL_FUNCTION, STATIC_TOP_LEVEL_VARIABLE, SUPER_IN_INVALID_CONTEXT, SUPER_INITIALIZER_IN_OBJECT, THROW_WITHOUT_VALUE_OUTSIDE_ON, TYPE_ARGUMENTS_FOR_NON_GENERIC_CLASS, UNDEFINED_CONSTRUCTOR_IN_INITIALIZER, UNINITIALIZED_FINAL_FIELD, URI_WITH_INTERPOLATION, WRONG_NUMBER_OF_PARAMETERS_FOR_OPERATOR, WRONG_NUMBER_OF_PARAMETERS_FOR_SETTER, WRONG_NUMBER_OF_TYPE_ARGUMENTS];
final String __name;
final int __ordinal;
/**

View file

@ -1110,9 +1110,9 @@ class XmlTagNode extends XmlNode {
if (identical(token, _contentEnd)) {
return content;
}
StringBuffer buffer = new StringBuffer();
JavaStringBuilder buffer = new JavaStringBuilder();
while (token != _contentEnd) {
buffer.write(token.lexeme);
buffer.append(token.lexeme);
token = token.next;
}
return buffer.toString();

View file

@ -217,6 +217,12 @@ class IllegalArgumentException implements Exception {
String toString() => "IllegalStateException: $message";
}
class StringIndexOutOfBoundsException implements Exception {
final int index;
const StringIndexOutOfBoundsException(this.index);
String toString() => "StringIndexOutOfBoundsException: $index";
}
class IllegalStateException implements Exception {
final String message;
const IllegalStateException([this.message = ""]);
@ -390,3 +396,31 @@ void javaMapPutAll(Map target, Map source) {
bool javaStringEqualsIgnoreCase(String a, String b) {
return a.toLowerCase() == b.toLowerCase();
}
class JavaStringBuilder {
StringBuffer sb = new StringBuffer();
String toString() => sb.toString();
void append(x) {
sb.write(x);
}
void appendChar(int c) {
sb.writeCharCode(c);
}
int get length => sb.length;
void set length(int newLength) {
if (newLength < 0) {
throw new StringIndexOutOfBoundsException(newLength);
}
if (sb.length < newLength) {
while (sb.length < newLength) {
sb.writeCharCode(0);
}
} else if (sb.length > newLength) {
var s = sb.toString().substring(0, newLength);
sb = new StringBuffer(s);
}
}
void clear() {
sb = new StringBuffer();
}
}

View file

@ -207,7 +207,7 @@ class Modifiers {
this._varKeyword = varKeyword2;
}
String toString() {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
bool needsSpace = appendKeyword(builder, false, _abstractKeyword);
needsSpace = appendKeyword(builder, needsSpace, _constKeyword);
needsSpace = appendKeyword(builder, needsSpace, _externalKeyword);
@ -225,12 +225,12 @@ class Modifiers {
* @param keyword the keyword to be appended
* @return {@code true} if subsequent keywords need to be prefixed with a space
*/
bool appendKeyword(StringBuffer builder, bool needsSpace, Token keyword) {
bool appendKeyword(JavaStringBuilder builder, bool needsSpace, Token keyword) {
if (keyword != null) {
if (needsSpace) {
builder.writeCharCode(0x20);
builder.appendChar(0x20);
}
builder.write(keyword.lexeme);
builder.append(keyword.lexeme);
return true;
}
return needsSpace;
@ -332,15 +332,15 @@ class Parser {
* @param startIndex the index of the first character representing the scalar value
* @param endIndex the index of the last character representing the scalar value
*/
void appendScalarValue(StringBuffer builder, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
void appendScalarValue(JavaStringBuilder builder, String escapeSequence, int scalarValue, int startIndex, int endIndex) {
if (scalarValue < 0 || scalarValue > Character.MAX_CODE_POINT || (scalarValue >= 0xD800 && scalarValue <= 0xDFFF)) {
reportError4(ParserErrorCode.INVALID_CODE_POINT, [escapeSequence]);
return;
}
if (scalarValue < Character.MAX_VALUE) {
builder.writeCharCode((scalarValue as int));
builder.appendChar((scalarValue as int));
} else {
builder.write(Character.toChars(scalarValue));
builder.append(Character.toChars(scalarValue));
}
}
/**
@ -370,7 +370,7 @@ class Parser {
} else if (end > 1 && (lexeme.endsWith("\"") || lexeme.endsWith("'"))) {
end -= 1;
}
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
int index = start;
while (index < end) {
index = translateCharacter(builder, lexeme, index);
@ -1082,7 +1082,7 @@ class Parser {
*/
ClassDeclaration parseClassDeclaration(CommentAndMetadata commentAndMetadata, Token abstractKeyword) {
Token keyword = expect(Keyword.CLASS);
SimpleIdentifier name = parseSimpleIdentifier2(ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
SimpleIdentifier name = parseSimpleIdentifier();
String className = name.name;
TypeParameterList typeParameters = null;
if (matches5(TokenType.LT)) {
@ -2360,7 +2360,7 @@ class Parser {
if (hasReturnTypeInTypeAlias()) {
returnType = parseReturnType();
}
SimpleIdentifier name = parseSimpleIdentifier2(ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
SimpleIdentifier name = parseSimpleIdentifier();
TypeParameterList typeParameters = null;
if (matches5(TokenType.LT)) {
typeParameters = parseTypeParameterList();
@ -3365,26 +3365,6 @@ class Parser {
reportError4(ParserErrorCode.MISSING_IDENTIFIER, []);
return createSyntheticIdentifier();
}
/**
* Parse a simple identifier and validate that it is not a built-in identifier.
* <pre>
* identifier ::=
* IDENTIFIER
* </pre>
* @param errorCode the error code to be used to report a built-in identifier if one is found
* @return the simple identifier that was parsed
*/
SimpleIdentifier parseSimpleIdentifier2(ParserErrorCode errorCode) {
if (matchesIdentifier()) {
Token token = andAdvance;
if (identical(token.type, TokenType.KEYWORD)) {
reportError5(errorCode, token, [token.lexeme]);
}
return new SimpleIdentifier.full(token);
}
reportError4(ParserErrorCode.MISSING_IDENTIFIER, []);
return createSyntheticIdentifier();
}
/**
* Parse a statement.
* <pre>
@ -3732,7 +3712,7 @@ class Parser {
*/
TypeParameter parseTypeParameter() {
CommentAndMetadata commentAndMetadata = parseCommentAndMetadata();
SimpleIdentifier name = parseSimpleIdentifier2(ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME);
SimpleIdentifier name = parseSimpleIdentifier();
if (matches(Keyword.EXTENDS)) {
Token keyword = andAdvance;
TypeName bound = parseTypeName();
@ -4314,10 +4294,10 @@ class Parser {
* @param index the index of the character to be translated
* @return the index of the next character to be translated
*/
int translateCharacter(StringBuffer builder, String lexeme, int index) {
int translateCharacter(JavaStringBuilder builder, String lexeme, int index) {
int currentChar = lexeme.codeUnitAt(index);
if (currentChar != 0x5C) {
builder.writeCharCode(currentChar);
builder.appendChar(currentChar);
return index + 1;
}
int length8 = lexeme.length;
@ -4327,17 +4307,17 @@ class Parser {
}
currentChar = lexeme.codeUnitAt(currentIndex);
if (currentChar == 0x6E) {
builder.writeCharCode(0xA);
builder.appendChar(0xA);
} else if (currentChar == 0x72) {
builder.writeCharCode(0xD);
builder.appendChar(0xD);
} else if (currentChar == 0x66) {
builder.writeCharCode(0xC);
builder.appendChar(0xC);
} else if (currentChar == 0x62) {
builder.writeCharCode(0x8);
builder.appendChar(0x8);
} else if (currentChar == 0x74) {
builder.writeCharCode(0x9);
builder.appendChar(0x9);
} else if (currentChar == 0x76) {
builder.writeCharCode(0xB);
builder.appendChar(0xB);
} else if (currentChar == 0x78) {
if (currentIndex + 2 >= length8) {
reportError4(ParserErrorCode.INVALID_HEX_ESCAPE, []);
@ -4348,7 +4328,7 @@ class Parser {
if (!isHexDigit(firstDigit) || !isHexDigit(secondDigit)) {
reportError4(ParserErrorCode.INVALID_HEX_ESCAPE, []);
} else {
builder.writeCharCode((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) as int));
builder.appendChar((((Character.digit(firstDigit, 16) << 4) + Character.digit(secondDigit, 16)) as int));
}
return currentIndex + 3;
} else if (currentChar == 0x75) {
@ -4407,7 +4387,7 @@ class Parser {
return currentIndex + 4;
}
} else {
builder.writeCharCode(currentChar);
builder.appendChar(currentChar);
}
return currentIndex + 1;
}
@ -4671,103 +4651,100 @@ class ParserErrorCode implements ErrorCode {
static final ParserErrorCode ABSTRACT_TOP_LEVEL_VARIABLE = new ParserErrorCode.con2('ABSTRACT_TOP_LEVEL_VARIABLE', 3, "Top-level variables cannot be declared to be 'abstract'");
static final ParserErrorCode ABSTRACT_TYPEDEF = new ParserErrorCode.con2('ABSTRACT_TYPEDEF', 4, "Type aliases cannot be declared to be 'abstract'");
static final ParserErrorCode BREAK_OUTSIDE_OF_LOOP = new ParserErrorCode.con2('BREAK_OUTSIDE_OF_LOOP', 5, "A break statement cannot be used outside of a loop or switch statement");
static final ParserErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_NAME = new ParserErrorCode.con2('BUILT_IN_IDENTIFIER_AS_TYPE_NAME', 6, "The built-in identifier '%s' cannot be used as a type name");
static final ParserErrorCode BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME = new ParserErrorCode.con2('BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME', 7, "The built-in identifier '%s' cannot be used as a type alias name");
static final ParserErrorCode BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME = new ParserErrorCode.con2('BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME', 8, "The built-in identifier '%s' cannot be used as a type variable name");
static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con2('CONST_AND_FINAL', 9, "Members cannot be declared to be both 'const' and 'final'");
static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con2('CONST_AND_VAR', 10, "Members cannot be declared to be both 'const' and 'var'");
static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con2('CONST_CLASS', 11, "Classes cannot be declared to be 'const'");
static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con2('CONST_METHOD', 12, "Getters, setters and methods cannot be declared to be 'const'");
static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con2('CONST_TYPEDEF', 13, "Type aliases cannot be declared to be 'const'");
static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCode.con2('CONSTRUCTOR_WITH_RETURN_TYPE', 14, "Constructors cannot have a return type");
static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.con2('CONTINUE_OUTSIDE_OF_LOOP', 15, "A continue statement cannot be used outside of a loop or switch statement");
static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorCode.con2('CONTINUE_WITHOUT_LABEL_IN_CASE', 16, "A continue statement in a switch statement must have a label as a target");
static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode.con2('DIRECTIVE_AFTER_DECLARATION', 17, "Directives must appear before any declarations");
static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserErrorCode.con2('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 18, "The label %s was already used in this switch statement");
static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con2('DUPLICATED_MODIFIER', 19, "The modifier '%s' was already specified.");
static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.con2('EXPECTED_CASE_OR_DEFAULT', 20, "Expected 'case' or 'default'");
static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con2('EXPECTED_LIST_OR_MAP_LITERAL', 21, "Expected a list or map literal");
static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con2('EXPECTED_STRING_LITERAL', 22, "Expected a string literal");
static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECTED_TOKEN', 23, "Expected to find: %s");
static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 24, "Export directives must preceed part directives");
static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2('EXTERNAL_AFTER_CONST', 25, "The modifier 'external' should be before the modifier 'const'");
static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2('EXTERNAL_AFTER_FACTORY', 26, "The modifier 'external' should be before the modifier 'factory'");
static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2('EXTERNAL_AFTER_STATIC', 27, "The modifier 'external' should be before the modifier 'static'");
static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERNAL_CLASS', 28, "Classes cannot be declared to be 'external'");
static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 29, "External constructors cannot have a body");
static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERNAL_FIELD', 30, "Fields cannot be declared to be 'external'");
static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_GETTER_WITH_BODY', 31, "External getters cannot have a body");
static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_METHOD_WITH_BODY', 32, "External methods cannot have a body");
static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_OPERATOR_WITH_BODY', 33, "External operators cannot have a body");
static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_SETTER_WITH_BODY', 34, "External setters cannot have a body");
static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTERNAL_TYPEDEF', 35, "Type aliases cannot be declared to be 'external'");
static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('FACTORY_TOP_LEVEL_DECLARATION', 36, "Top-level declarations cannot be declared to be 'factory'");
static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 37, "Field initializers can only be used in a constructor");
static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_AND_VAR', 38, "Members cannot be declared to be both 'final' and 'var'");
static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLASS', 39, "Classes cannot be declared to be 'final'");
static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FINAL_CONSTRUCTOR', 40, "A constructor cannot be declared to be 'final'");
static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_METHOD', 41, "Getters, setters and methods cannot be declared to be 'final'");
static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_TYPEDEF', 42, "Type aliases cannot be declared to be 'final'");
static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2('GETTER_WITH_PARAMETERS', 43, "Getter should be declared without a parameter list");
static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 44, "Illegal assignment to non-assignable expression");
static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_EXTENDS', 45, "The extends clause must be before the implements clause");
static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_WITH', 46, "The with clause must be before the implements clause");
static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 47, "Import directives must preceed part directives");
static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 48, "The loop variable in a for-each loop cannot be initialized");
static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('INVALID_CODE_POINT', 49, "The escape sequence '%s' is not a valid code point");
static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con2('INVALID_COMMENT_REFERENCE', 50, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('INVALID_HEX_ESCAPE', 51, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con2('INVALID_OPERATOR_FOR_SUPER', 52, "The operator '%s' cannot be used with 'super'");
static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2('INVALID_UNICODE_ESCAPE', 53, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con2('LIBRARY_DIRECTIVE_NOT_FIRST', 54, "The library directive must appear before all other directives");
static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con2('MISSING_ASSIGNABLE_SELECTOR', 55, "Missing selector such as \".<identifier>\" or \"[0]\"");
static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con2('MISSING_CATCH_OR_FINALLY', 56, "A try statement must have either a catch or finally clause");
static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MISSING_CLASS_BODY', 57, "A class definition must have a body, even if it is empty");
static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 58, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2('MISSING_FUNCTION_BODY', 59, "A function body must be provided");
static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con2('MISSING_FUNCTION_PARAMETERS', 60, "Functions must have an explicit list of parameters");
static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MISSING_IDENTIFIER', 61, "Expected an identifier");
static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 62, "Library directives must include a library name");
static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 63, "Library directives must include a library name");
static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 64, "There is no '%s' to close the parameter group");
static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con2('MISSING_TYPEDEF_PARAMETERS', 65, "Type aliases for functions must have an explicit list of parameters");
static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('MISSING_VARIABLE_IN_FOR_EACH', 66, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2('MIXED_PARAMETER_GROUPS', 67, "Cannot have both positional and named parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_EXTENDS_CLAUSES', 68, "Each class definition can have at most one extends clause");
static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_IMPLEMENTS_CLAUSES', 69, "Each class definition can have at most one implements clause");
static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_LIBRARY_DIRECTIVES', 70, "Only one library directive may be declared in a file");
static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 71, "Cannot have multiple groups of named parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_PART_OF_DIRECTIVES', 72, "Only one part-of directive may be declared in a file");
static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 73, "Cannot have multiple groups of positional parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 74, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2('MULTIPLE_WITH_CLAUSES', 75, "Each class definition can have at most one with clause");
static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 76, "Named parameters must be enclosed in curly braces ('{' and '}')");
static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con2('NON_CONSTRUCTOR_FACTORY', 77, "Only constructors can be declared to be a 'factory'");
static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 78, "The name of a library must be an identifier");
static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con2('NON_PART_OF_DIRECTIVE_IN_PART', 79, "The part-of directive must be the only directive in a part");
static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con2('NON_USER_DEFINABLE_OPERATOR', 80, "The operator '%s' is not user definable");
static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 81, "Positional arguments must occur before named arguments");
static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 82, "Positional parameters must be enclosed in square brackets ('[' and ']')");
static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 83, "The modifier 'static' should be before the modifier 'const'");
static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 84, "The modifier 'static' should be before the modifier 'final'");
static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 85, "The modifier 'static' should be before the modifier 'var'");
static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 86, "Constructors cannot be static");
static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 87, "Operators cannot be static");
static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 88, "Top-level declarations cannot be declared to be 'static'");
static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 89, "There is no '%s' to open a parameter group");
static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 90, "Unexpected token '%s'");
static final ParserErrorCode USE_OF_UNARY_PLUS_OPERATOR = new ParserErrorCode.con2('USE_OF_UNARY_PLUS_OPERATOR', 91, "There is no unary plus operator in Dart");
static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 92, "The extends clause must be before the with clause");
static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 93, "The with clause cannot be used without an extends clause");
static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 94, "The default value of a named parameter should be preceeded by ':'");
static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 95, "The default value of a positional parameter should be preceeded by '='");
static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 96, "Expected '%s' to close parameter group");
static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 97, "Classes cannot be declared to be 'var'");
static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 98, "The return type cannot be 'var'");
static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 99, "Type aliases cannot be declared to be 'var'");
static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 100, "Parameters cannot have a type of 'void'");
static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 101, "Variables cannot have a type of 'void'");
static final List<ParserErrorCode> values = [ABSTRACT_CLASS_MEMBER, ABSTRACT_STATIC_METHOD, ABSTRACT_TOP_LEVEL_FUNCTION, ABSTRACT_TOP_LEVEL_VARIABLE, ABSTRACT_TYPEDEF, BREAK_OUTSIDE_OF_LOOP, BUILT_IN_IDENTIFIER_AS_TYPE_NAME, BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME, BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME, CONST_AND_FINAL, CONST_AND_VAR, CONST_CLASS, CONST_METHOD, CONST_TYPEDEF, CONSTRUCTOR_WITH_RETURN_TYPE, CONTINUE_OUTSIDE_OF_LOOP, CONTINUE_WITHOUT_LABEL_IN_CASE, DIRECTIVE_AFTER_DECLARATION, DUPLICATE_LABEL_IN_SWITCH_STATEMENT, DUPLICATED_MODIFIER, EXPECTED_CASE_OR_DEFAULT, EXPECTED_LIST_OR_MAP_LITERAL, EXPECTED_STRING_LITERAL, EXPECTED_TOKEN, EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, EXTERNAL_AFTER_CONST, EXTERNAL_AFTER_FACTORY, EXTERNAL_AFTER_STATIC, EXTERNAL_CLASS, EXTERNAL_CONSTRUCTOR_WITH_BODY, EXTERNAL_FIELD, EXTERNAL_GETTER_WITH_BODY, EXTERNAL_METHOD_WITH_BODY, EXTERNAL_OPERATOR_WITH_BODY, EXTERNAL_SETTER_WITH_BODY, EXTERNAL_TYPEDEF, FACTORY_TOP_LEVEL_DECLARATION, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_AND_VAR, FINAL_CLASS, FINAL_CONSTRUCTOR, FINAL_METHOD, FINAL_TYPEDEF, GETTER_WITH_PARAMETERS, ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, IMPLEMENTS_BEFORE_EXTENDS, IMPLEMENTS_BEFORE_WITH, IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, INITIALIZED_VARIABLE_IN_FOR_EACH, INVALID_CODE_POINT, INVALID_COMMENT_REFERENCE, INVALID_HEX_ESCAPE, INVALID_OPERATOR_FOR_SUPER, INVALID_UNICODE_ESCAPE, LIBRARY_DIRECTIVE_NOT_FIRST, MISSING_ASSIGNABLE_SELECTOR, MISSING_CATCH_OR_FINALLY, MISSING_CLASS_BODY, MISSING_CONST_FINAL_VAR_OR_TYPE, MISSING_FUNCTION_BODY, MISSING_FUNCTION_PARAMETERS, MISSING_IDENTIFIER, MISSING_NAME_IN_LIBRARY_DIRECTIVE, MISSING_NAME_IN_PART_OF_DIRECTIVE, MISSING_TERMINATOR_FOR_PARAMETER_GROUP, MISSING_TYPEDEF_PARAMETERS, MISSING_VARIABLE_IN_FOR_EACH, MIXED_PARAMETER_GROUPS, MULTIPLE_EXTENDS_CLAUSES, MULTIPLE_IMPLEMENTS_CLAUSES, MULTIPLE_LIBRARY_DIRECTIVES, MULTIPLE_NAMED_PARAMETER_GROUPS, MULTIPLE_PART_OF_DIRECTIVES, MULTIPLE_POSITIONAL_PARAMETER_GROUPS, MULTIPLE_VARIABLES_IN_FOR_EACH, MULTIPLE_WITH_CLAUSES, NAMED_PARAMETER_OUTSIDE_GROUP, NON_CONSTRUCTOR_FACTORY, NON_IDENTIFIER_LIBRARY_NAME, NON_PART_OF_DIRECTIVE_IN_PART, NON_USER_DEFINABLE_OPERATOR, POSITIONAL_AFTER_NAMED_ARGUMENT, POSITIONAL_PARAMETER_OUTSIDE_GROUP, STATIC_AFTER_CONST, STATIC_AFTER_FINAL, STATIC_AFTER_VAR, STATIC_CONSTRUCTOR, STATIC_OPERATOR, STATIC_TOP_LEVEL_DECLARATION, UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, UNEXPECTED_TOKEN, USE_OF_UNARY_PLUS_OPERATOR, WITH_BEFORE_EXTENDS, WITH_WITHOUT_EXTENDS, WRONG_SEPARATOR_FOR_NAMED_PARAMETER, WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, WRONG_TERMINATOR_FOR_PARAMETER_GROUP, VAR_CLASS, VAR_RETURN_TYPE, VAR_TYPEDEF, VOID_PARAMETER, VOID_VARIABLE];
static final ParserErrorCode CONST_AND_FINAL = new ParserErrorCode.con2('CONST_AND_FINAL', 6, "Members cannot be declared to be both 'const' and 'final'");
static final ParserErrorCode CONST_AND_VAR = new ParserErrorCode.con2('CONST_AND_VAR', 7, "Members cannot be declared to be both 'const' and 'var'");
static final ParserErrorCode CONST_CLASS = new ParserErrorCode.con2('CONST_CLASS', 8, "Classes cannot be declared to be 'const'");
static final ParserErrorCode CONST_METHOD = new ParserErrorCode.con2('CONST_METHOD', 9, "Getters, setters and methods cannot be declared to be 'const'");
static final ParserErrorCode CONST_TYPEDEF = new ParserErrorCode.con2('CONST_TYPEDEF', 10, "Type aliases cannot be declared to be 'const'");
static final ParserErrorCode CONSTRUCTOR_WITH_RETURN_TYPE = new ParserErrorCode.con2('CONSTRUCTOR_WITH_RETURN_TYPE', 11, "Constructors cannot have a return type");
static final ParserErrorCode CONTINUE_OUTSIDE_OF_LOOP = new ParserErrorCode.con2('CONTINUE_OUTSIDE_OF_LOOP', 12, "A continue statement cannot be used outside of a loop or switch statement");
static final ParserErrorCode CONTINUE_WITHOUT_LABEL_IN_CASE = new ParserErrorCode.con2('CONTINUE_WITHOUT_LABEL_IN_CASE', 13, "A continue statement in a switch statement must have a label as a target");
static final ParserErrorCode DIRECTIVE_AFTER_DECLARATION = new ParserErrorCode.con2('DIRECTIVE_AFTER_DECLARATION', 14, "Directives must appear before any declarations");
static final ParserErrorCode DUPLICATE_LABEL_IN_SWITCH_STATEMENT = new ParserErrorCode.con2('DUPLICATE_LABEL_IN_SWITCH_STATEMENT', 15, "The label %s was already used in this switch statement");
static final ParserErrorCode DUPLICATED_MODIFIER = new ParserErrorCode.con2('DUPLICATED_MODIFIER', 16, "The modifier '%s' was already specified.");
static final ParserErrorCode EXPECTED_CASE_OR_DEFAULT = new ParserErrorCode.con2('EXPECTED_CASE_OR_DEFAULT', 17, "Expected 'case' or 'default'");
static final ParserErrorCode EXPECTED_LIST_OR_MAP_LITERAL = new ParserErrorCode.con2('EXPECTED_LIST_OR_MAP_LITERAL', 18, "Expected a list or map literal");
static final ParserErrorCode EXPECTED_STRING_LITERAL = new ParserErrorCode.con2('EXPECTED_STRING_LITERAL', 19, "Expected a string literal");
static final ParserErrorCode EXPECTED_TOKEN = new ParserErrorCode.con2('EXPECTED_TOKEN', 20, "Expected to find: %s");
static final ParserErrorCode EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 21, "Export directives must preceed part directives");
static final ParserErrorCode EXTERNAL_AFTER_CONST = new ParserErrorCode.con2('EXTERNAL_AFTER_CONST', 22, "The modifier 'external' should be before the modifier 'const'");
static final ParserErrorCode EXTERNAL_AFTER_FACTORY = new ParserErrorCode.con2('EXTERNAL_AFTER_FACTORY', 23, "The modifier 'external' should be before the modifier 'factory'");
static final ParserErrorCode EXTERNAL_AFTER_STATIC = new ParserErrorCode.con2('EXTERNAL_AFTER_STATIC', 24, "The modifier 'external' should be before the modifier 'static'");
static final ParserErrorCode EXTERNAL_CLASS = new ParserErrorCode.con2('EXTERNAL_CLASS', 25, "Classes cannot be declared to be 'external'");
static final ParserErrorCode EXTERNAL_CONSTRUCTOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_CONSTRUCTOR_WITH_BODY', 26, "External constructors cannot have a body");
static final ParserErrorCode EXTERNAL_FIELD = new ParserErrorCode.con2('EXTERNAL_FIELD', 27, "Fields cannot be declared to be 'external'");
static final ParserErrorCode EXTERNAL_GETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_GETTER_WITH_BODY', 28, "External getters cannot have a body");
static final ParserErrorCode EXTERNAL_METHOD_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_METHOD_WITH_BODY', 29, "External methods cannot have a body");
static final ParserErrorCode EXTERNAL_OPERATOR_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_OPERATOR_WITH_BODY', 30, "External operators cannot have a body");
static final ParserErrorCode EXTERNAL_SETTER_WITH_BODY = new ParserErrorCode.con2('EXTERNAL_SETTER_WITH_BODY', 31, "External setters cannot have a body");
static final ParserErrorCode EXTERNAL_TYPEDEF = new ParserErrorCode.con2('EXTERNAL_TYPEDEF', 32, "Type aliases cannot be declared to be 'external'");
static final ParserErrorCode FACTORY_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('FACTORY_TOP_LEVEL_DECLARATION', 33, "Top-level declarations cannot be declared to be 'factory'");
static final ParserErrorCode FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR = new ParserErrorCode.con2('FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR', 34, "Field initializers can only be used in a constructor");
static final ParserErrorCode FINAL_AND_VAR = new ParserErrorCode.con2('FINAL_AND_VAR', 35, "Members cannot be declared to be both 'final' and 'var'");
static final ParserErrorCode FINAL_CLASS = new ParserErrorCode.con2('FINAL_CLASS', 36, "Classes cannot be declared to be 'final'");
static final ParserErrorCode FINAL_CONSTRUCTOR = new ParserErrorCode.con2('FINAL_CONSTRUCTOR', 37, "A constructor cannot be declared to be 'final'");
static final ParserErrorCode FINAL_METHOD = new ParserErrorCode.con2('FINAL_METHOD', 38, "Getters, setters and methods cannot be declared to be 'final'");
static final ParserErrorCode FINAL_TYPEDEF = new ParserErrorCode.con2('FINAL_TYPEDEF', 39, "Type aliases cannot be declared to be 'final'");
static final ParserErrorCode GETTER_WITH_PARAMETERS = new ParserErrorCode.con2('GETTER_WITH_PARAMETERS', 40, "Getter should be declared without a parameter list");
static final ParserErrorCode ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE = new ParserErrorCode.con2('ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE', 41, "Illegal assignment to non-assignable expression");
static final ParserErrorCode IMPLEMENTS_BEFORE_EXTENDS = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_EXTENDS', 42, "The extends clause must be before the implements clause");
static final ParserErrorCode IMPLEMENTS_BEFORE_WITH = new ParserErrorCode.con2('IMPLEMENTS_BEFORE_WITH', 43, "The with clause must be before the implements clause");
static final ParserErrorCode IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE = new ParserErrorCode.con2('IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE', 44, "Import directives must preceed part directives");
static final ParserErrorCode INITIALIZED_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('INITIALIZED_VARIABLE_IN_FOR_EACH', 45, "The loop variable in a for-each loop cannot be initialized");
static final ParserErrorCode INVALID_CODE_POINT = new ParserErrorCode.con2('INVALID_CODE_POINT', 46, "The escape sequence '%s' is not a valid code point");
static final ParserErrorCode INVALID_COMMENT_REFERENCE = new ParserErrorCode.con2('INVALID_COMMENT_REFERENCE', 47, "Comment references should contain a possibly prefixed identifier and can start with 'new', but should not contain anything else");
static final ParserErrorCode INVALID_HEX_ESCAPE = new ParserErrorCode.con2('INVALID_HEX_ESCAPE', 48, "An escape sequence starting with '\\x' must be followed by 2 hexidecimal digits");
static final ParserErrorCode INVALID_OPERATOR_FOR_SUPER = new ParserErrorCode.con2('INVALID_OPERATOR_FOR_SUPER', 49, "The operator '%s' cannot be used with 'super'");
static final ParserErrorCode INVALID_UNICODE_ESCAPE = new ParserErrorCode.con2('INVALID_UNICODE_ESCAPE', 50, "An escape sequence starting with '\\u' must be followed by 4 hexidecimal digits or from 1 to 6 digits between '{' and '}'");
static final ParserErrorCode LIBRARY_DIRECTIVE_NOT_FIRST = new ParserErrorCode.con2('LIBRARY_DIRECTIVE_NOT_FIRST', 51, "The library directive must appear before all other directives");
static final ParserErrorCode MISSING_ASSIGNABLE_SELECTOR = new ParserErrorCode.con2('MISSING_ASSIGNABLE_SELECTOR', 52, "Missing selector such as \".<identifier>\" or \"[0]\"");
static final ParserErrorCode MISSING_CATCH_OR_FINALLY = new ParserErrorCode.con2('MISSING_CATCH_OR_FINALLY', 53, "A try statement must have either a catch or finally clause");
static final ParserErrorCode MISSING_CLASS_BODY = new ParserErrorCode.con2('MISSING_CLASS_BODY', 54, "A class definition must have a body, even if it is empty");
static final ParserErrorCode MISSING_CONST_FINAL_VAR_OR_TYPE = new ParserErrorCode.con2('MISSING_CONST_FINAL_VAR_OR_TYPE', 55, "Variables must be declared using the keywords 'const', 'final', 'var' or a type name");
static final ParserErrorCode MISSING_FUNCTION_BODY = new ParserErrorCode.con2('MISSING_FUNCTION_BODY', 56, "A function body must be provided");
static final ParserErrorCode MISSING_FUNCTION_PARAMETERS = new ParserErrorCode.con2('MISSING_FUNCTION_PARAMETERS', 57, "Functions must have an explicit list of parameters");
static final ParserErrorCode MISSING_IDENTIFIER = new ParserErrorCode.con2('MISSING_IDENTIFIER', 58, "Expected an identifier");
static final ParserErrorCode MISSING_NAME_IN_LIBRARY_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_LIBRARY_DIRECTIVE', 59, "Library directives must include a library name");
static final ParserErrorCode MISSING_NAME_IN_PART_OF_DIRECTIVE = new ParserErrorCode.con2('MISSING_NAME_IN_PART_OF_DIRECTIVE', 60, "Library directives must include a library name");
static final ParserErrorCode MISSING_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('MISSING_TERMINATOR_FOR_PARAMETER_GROUP', 61, "There is no '%s' to close the parameter group");
static final ParserErrorCode MISSING_TYPEDEF_PARAMETERS = new ParserErrorCode.con2('MISSING_TYPEDEF_PARAMETERS', 62, "Type aliases for functions must have an explicit list of parameters");
static final ParserErrorCode MISSING_VARIABLE_IN_FOR_EACH = new ParserErrorCode.con2('MISSING_VARIABLE_IN_FOR_EACH', 63, "A loop variable must be declared in a for-each loop before the 'in', but none were found");
static final ParserErrorCode MIXED_PARAMETER_GROUPS = new ParserErrorCode.con2('MIXED_PARAMETER_GROUPS', 64, "Cannot have both positional and named parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_EXTENDS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_EXTENDS_CLAUSES', 65, "Each class definition can have at most one extends clause");
static final ParserErrorCode MULTIPLE_IMPLEMENTS_CLAUSES = new ParserErrorCode.con2('MULTIPLE_IMPLEMENTS_CLAUSES', 66, "Each class definition can have at most one implements clause");
static final ParserErrorCode MULTIPLE_LIBRARY_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_LIBRARY_DIRECTIVES', 67, "Only one library directive may be declared in a file");
static final ParserErrorCode MULTIPLE_NAMED_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_NAMED_PARAMETER_GROUPS', 68, "Cannot have multiple groups of named parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_PART_OF_DIRECTIVES = new ParserErrorCode.con2('MULTIPLE_PART_OF_DIRECTIVES', 69, "Only one part-of directive may be declared in a file");
static final ParserErrorCode MULTIPLE_POSITIONAL_PARAMETER_GROUPS = new ParserErrorCode.con2('MULTIPLE_POSITIONAL_PARAMETER_GROUPS', 70, "Cannot have multiple groups of positional parameters in a single parameter list");
static final ParserErrorCode MULTIPLE_VARIABLES_IN_FOR_EACH = new ParserErrorCode.con2('MULTIPLE_VARIABLES_IN_FOR_EACH', 71, "A single loop variable must be declared in a for-each loop before the 'in', but %s were found");
static final ParserErrorCode MULTIPLE_WITH_CLAUSES = new ParserErrorCode.con2('MULTIPLE_WITH_CLAUSES', 72, "Each class definition can have at most one with clause");
static final ParserErrorCode NAMED_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('NAMED_PARAMETER_OUTSIDE_GROUP', 73, "Named parameters must be enclosed in curly braces ('{' and '}')");
static final ParserErrorCode NON_CONSTRUCTOR_FACTORY = new ParserErrorCode.con2('NON_CONSTRUCTOR_FACTORY', 74, "Only constructors can be declared to be a 'factory'");
static final ParserErrorCode NON_IDENTIFIER_LIBRARY_NAME = new ParserErrorCode.con2('NON_IDENTIFIER_LIBRARY_NAME', 75, "The name of a library must be an identifier");
static final ParserErrorCode NON_PART_OF_DIRECTIVE_IN_PART = new ParserErrorCode.con2('NON_PART_OF_DIRECTIVE_IN_PART', 76, "The part-of directive must be the only directive in a part");
static final ParserErrorCode NON_USER_DEFINABLE_OPERATOR = new ParserErrorCode.con2('NON_USER_DEFINABLE_OPERATOR', 77, "The operator '%s' is not user definable");
static final ParserErrorCode POSITIONAL_AFTER_NAMED_ARGUMENT = new ParserErrorCode.con2('POSITIONAL_AFTER_NAMED_ARGUMENT', 78, "Positional arguments must occur before named arguments");
static final ParserErrorCode POSITIONAL_PARAMETER_OUTSIDE_GROUP = new ParserErrorCode.con2('POSITIONAL_PARAMETER_OUTSIDE_GROUP', 79, "Positional parameters must be enclosed in square brackets ('[' and ']')");
static final ParserErrorCode STATIC_AFTER_CONST = new ParserErrorCode.con2('STATIC_AFTER_CONST', 80, "The modifier 'static' should be before the modifier 'const'");
static final ParserErrorCode STATIC_AFTER_FINAL = new ParserErrorCode.con2('STATIC_AFTER_FINAL', 81, "The modifier 'static' should be before the modifier 'final'");
static final ParserErrorCode STATIC_AFTER_VAR = new ParserErrorCode.con2('STATIC_AFTER_VAR', 82, "The modifier 'static' should be before the modifier 'var'");
static final ParserErrorCode STATIC_CONSTRUCTOR = new ParserErrorCode.con2('STATIC_CONSTRUCTOR', 83, "Constructors cannot be static");
static final ParserErrorCode STATIC_OPERATOR = new ParserErrorCode.con2('STATIC_OPERATOR', 84, "Operators cannot be static");
static final ParserErrorCode STATIC_TOP_LEVEL_DECLARATION = new ParserErrorCode.con2('STATIC_TOP_LEVEL_DECLARATION', 85, "Top-level declarations cannot be declared to be 'static'");
static final ParserErrorCode UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP', 86, "There is no '%s' to open a parameter group");
static final ParserErrorCode UNEXPECTED_TOKEN = new ParserErrorCode.con2('UNEXPECTED_TOKEN', 87, "Unexpected token '%s'");
static final ParserErrorCode USE_OF_UNARY_PLUS_OPERATOR = new ParserErrorCode.con2('USE_OF_UNARY_PLUS_OPERATOR', 88, "There is no unary plus operator in Dart");
static final ParserErrorCode WITH_BEFORE_EXTENDS = new ParserErrorCode.con2('WITH_BEFORE_EXTENDS', 89, "The extends clause must be before the with clause");
static final ParserErrorCode WITH_WITHOUT_EXTENDS = new ParserErrorCode.con2('WITH_WITHOUT_EXTENDS', 90, "The with clause cannot be used without an extends clause");
static final ParserErrorCode WRONG_SEPARATOR_FOR_NAMED_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_NAMED_PARAMETER', 91, "The default value of a named parameter should be preceeded by ':'");
static final ParserErrorCode WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER = new ParserErrorCode.con2('WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER', 92, "The default value of a positional parameter should be preceeded by '='");
static final ParserErrorCode WRONG_TERMINATOR_FOR_PARAMETER_GROUP = new ParserErrorCode.con2('WRONG_TERMINATOR_FOR_PARAMETER_GROUP', 93, "Expected '%s' to close parameter group");
static final ParserErrorCode VAR_CLASS = new ParserErrorCode.con2('VAR_CLASS', 94, "Classes cannot be declared to be 'var'");
static final ParserErrorCode VAR_RETURN_TYPE = new ParserErrorCode.con2('VAR_RETURN_TYPE', 95, "The return type cannot be 'var'");
static final ParserErrorCode VAR_TYPEDEF = new ParserErrorCode.con2('VAR_TYPEDEF', 96, "Type aliases cannot be declared to be 'var'");
static final ParserErrorCode VOID_PARAMETER = new ParserErrorCode.con2('VOID_PARAMETER', 97, "Parameters cannot have a type of 'void'");
static final ParserErrorCode VOID_VARIABLE = new ParserErrorCode.con2('VOID_VARIABLE', 98, "Variables cannot have a type of 'void'");
static final List<ParserErrorCode> values = [ABSTRACT_CLASS_MEMBER, ABSTRACT_STATIC_METHOD, ABSTRACT_TOP_LEVEL_FUNCTION, ABSTRACT_TOP_LEVEL_VARIABLE, ABSTRACT_TYPEDEF, BREAK_OUTSIDE_OF_LOOP, CONST_AND_FINAL, CONST_AND_VAR, CONST_CLASS, CONST_METHOD, CONST_TYPEDEF, CONSTRUCTOR_WITH_RETURN_TYPE, CONTINUE_OUTSIDE_OF_LOOP, CONTINUE_WITHOUT_LABEL_IN_CASE, DIRECTIVE_AFTER_DECLARATION, DUPLICATE_LABEL_IN_SWITCH_STATEMENT, DUPLICATED_MODIFIER, EXPECTED_CASE_OR_DEFAULT, EXPECTED_LIST_OR_MAP_LITERAL, EXPECTED_STRING_LITERAL, EXPECTED_TOKEN, EXPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, EXTERNAL_AFTER_CONST, EXTERNAL_AFTER_FACTORY, EXTERNAL_AFTER_STATIC, EXTERNAL_CLASS, EXTERNAL_CONSTRUCTOR_WITH_BODY, EXTERNAL_FIELD, EXTERNAL_GETTER_WITH_BODY, EXTERNAL_METHOD_WITH_BODY, EXTERNAL_OPERATOR_WITH_BODY, EXTERNAL_SETTER_WITH_BODY, EXTERNAL_TYPEDEF, FACTORY_TOP_LEVEL_DECLARATION, FIELD_INITIALIZER_OUTSIDE_CONSTRUCTOR, FINAL_AND_VAR, FINAL_CLASS, FINAL_CONSTRUCTOR, FINAL_METHOD, FINAL_TYPEDEF, GETTER_WITH_PARAMETERS, ILLEGAL_ASSIGNMENT_TO_NON_ASSIGNABLE, IMPLEMENTS_BEFORE_EXTENDS, IMPLEMENTS_BEFORE_WITH, IMPORT_DIRECTIVE_AFTER_PART_DIRECTIVE, INITIALIZED_VARIABLE_IN_FOR_EACH, INVALID_CODE_POINT, INVALID_COMMENT_REFERENCE, INVALID_HEX_ESCAPE, INVALID_OPERATOR_FOR_SUPER, INVALID_UNICODE_ESCAPE, LIBRARY_DIRECTIVE_NOT_FIRST, MISSING_ASSIGNABLE_SELECTOR, MISSING_CATCH_OR_FINALLY, MISSING_CLASS_BODY, MISSING_CONST_FINAL_VAR_OR_TYPE, MISSING_FUNCTION_BODY, MISSING_FUNCTION_PARAMETERS, MISSING_IDENTIFIER, MISSING_NAME_IN_LIBRARY_DIRECTIVE, MISSING_NAME_IN_PART_OF_DIRECTIVE, MISSING_TERMINATOR_FOR_PARAMETER_GROUP, MISSING_TYPEDEF_PARAMETERS, MISSING_VARIABLE_IN_FOR_EACH, MIXED_PARAMETER_GROUPS, MULTIPLE_EXTENDS_CLAUSES, MULTIPLE_IMPLEMENTS_CLAUSES, MULTIPLE_LIBRARY_DIRECTIVES, MULTIPLE_NAMED_PARAMETER_GROUPS, MULTIPLE_PART_OF_DIRECTIVES, MULTIPLE_POSITIONAL_PARAMETER_GROUPS, MULTIPLE_VARIABLES_IN_FOR_EACH, MULTIPLE_WITH_CLAUSES, NAMED_PARAMETER_OUTSIDE_GROUP, NON_CONSTRUCTOR_FACTORY, NON_IDENTIFIER_LIBRARY_NAME, NON_PART_OF_DIRECTIVE_IN_PART, NON_USER_DEFINABLE_OPERATOR, POSITIONAL_AFTER_NAMED_ARGUMENT, POSITIONAL_PARAMETER_OUTSIDE_GROUP, STATIC_AFTER_CONST, STATIC_AFTER_FINAL, STATIC_AFTER_VAR, STATIC_CONSTRUCTOR, STATIC_OPERATOR, STATIC_TOP_LEVEL_DECLARATION, UNEXPECTED_TERMINATOR_FOR_PARAMETER_GROUP, UNEXPECTED_TOKEN, USE_OF_UNARY_PLUS_OPERATOR, WITH_BEFORE_EXTENDS, WITH_WITHOUT_EXTENDS, WRONG_SEPARATOR_FOR_NAMED_PARAMETER, WRONG_SEPARATOR_FOR_POSITIONAL_PARAMETER, WRONG_TERMINATOR_FOR_PARAMETER_GROUP, VAR_CLASS, VAR_RETURN_TYPE, VAR_TYPEDEF, VOID_PARAMETER, VOID_VARIABLE];
String __name;
int __ordinal = 0;
/**

View file

@ -117,15 +117,7 @@ class ElementBuilder extends RecursiveASTVisitor<Object> {
ClassElementImpl element = new ClassElementImpl(className);
List<TypeVariableElement> typeVariables4 = holder.typeVariables;
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
int typeVariableCount = typeVariables4.length;
List<Type2> typeArguments = new List<Type2>(typeVariableCount);
for (int i = 0; i < typeVariableCount; i++) {
TypeVariableElementImpl typeVariable = typeVariables4[i] as TypeVariableElementImpl;
TypeVariableTypeImpl typeArgument = new TypeVariableTypeImpl(typeVariable);
typeVariable.type = typeArgument;
typeArguments[i] = typeArgument;
}
interfaceType.typeArguments = typeArguments;
interfaceType.typeArguments = createTypeVariableTypes(typeVariables4);
element.type = interfaceType;
List<ConstructorElement> constructors3 = holder.constructors;
if (constructors3.length == 0) {
@ -157,15 +149,7 @@ class ElementBuilder extends RecursiveASTVisitor<Object> {
List<TypeVariableElement> typeVariables5 = holder.typeVariables;
element.typeVariables = typeVariables5;
InterfaceTypeImpl interfaceType = new InterfaceTypeImpl.con1(element);
int typeVariableCount = typeVariables5.length;
List<Type2> typeArguments = new List<Type2>(typeVariableCount);
for (int i = 0; i < typeVariableCount; i++) {
TypeVariableElementImpl typeVariable = typeVariables5[i] as TypeVariableElementImpl;
TypeVariableTypeImpl typeArgument = new TypeVariableTypeImpl(typeVariable);
typeVariable.type = typeArgument;
typeArguments[i] = typeArgument;
}
interfaceType.typeArguments = typeArguments;
interfaceType.typeArguments = createTypeVariableTypes(typeVariables5);
element.type = interfaceType;
_currentHolder.addType(element);
className.element = element;
@ -334,10 +318,12 @@ class ElementBuilder extends RecursiveASTVisitor<Object> {
visitChildren(holder, node);
SimpleIdentifier aliasName = node.name;
List<ParameterElement> parameters10 = holder.parameters;
List<TypeVariableElement> typeVariables6 = holder.typeVariables;
TypeAliasElementImpl element = new TypeAliasElementImpl(aliasName);
element.parameters = parameters10;
element.typeVariables = holder.typeVariables;
element.typeVariables = typeVariables6;
FunctionTypeImpl type = new FunctionTypeImpl.con2(element);
type.typeArguments = createTypeVariableTypes(typeVariables6);
element.type = type;
_currentHolder.addTypeAlias(element);
aliasName.element = element;
@ -530,6 +516,17 @@ class ElementBuilder extends RecursiveASTVisitor<Object> {
}
return super.visitVariableDeclaration(node);
}
List<Type2> createTypeVariableTypes(List<TypeVariableElement> typeVariables) {
int typeVariableCount = typeVariables.length;
List<Type2> typeArguments = new List<Type2>(typeVariableCount);
for (int i = 0; i < typeVariableCount; i++) {
TypeVariableElementImpl typeVariable = typeVariables[i] as TypeVariableElementImpl;
TypeVariableTypeImpl typeArgument = new TypeVariableTypeImpl(typeVariable);
typeVariable.type = typeArgument;
typeArguments[i] = typeArgument;
}
return typeArguments;
}
/**
* Return the body of the function that contains the given parameter, or {@code null} if no
* function body could be found.
@ -869,6 +866,20 @@ class ElementResolver extends SimpleASTVisitor<Object> {
element = _resolver.nameScope.lookup(methodName2, _resolver.definingLibrary);
if (element == null) {
element = lookUpMethod(_resolver.enclosingClass, methodName2.name);
if (element == null) {
PropertyAccessorElement getter = lookUpGetter(_resolver.enclosingClass, methodName2.name);
if (getter != null) {
FunctionType getterType = getter.type;
if (getterType != null) {
Type2 returnType4 = getterType.returnType;
if (!returnType4.isDynamic() && returnType4 is! FunctionType && !returnType4.isDartCoreFunction()) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
}
}
recordResolution(methodName2, getter);
return null;
}
}
}
} else {
Type2 targetType = getType(target);
@ -877,8 +888,8 @@ class ElementResolver extends SimpleASTVisitor<Object> {
if (element == null) {
PropertyAccessorElement accessor = lookUpGetterInType((targetType.element as ClassElement), methodName2.name);
if (accessor != null) {
Type2 returnType4 = accessor.type.returnType;
if (!returnType4.isDynamic() && returnType4 is! FunctionType) {
Type2 returnType5 = accessor.type.returnType;
if (!returnType5.isDynamic() && returnType5 is! FunctionType && !returnType5.isDartCoreFunction()) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
return null;
}
@ -910,8 +921,8 @@ class ElementResolver extends SimpleASTVisitor<Object> {
PropertyAccessorElement getter3 = ((element as PropertyInducingElement)).getter;
FunctionType getterType = getter3.type;
if (getterType != null) {
Type2 returnType5 = getterType.returnType;
if (!returnType5.isDynamic() && returnType5 is! FunctionType) {
Type2 returnType6 = getterType.returnType;
if (!returnType6.isDynamic() && returnType6 is! FunctionType && !returnType6.isDartCoreFunction()) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
}
}
@ -919,7 +930,7 @@ class ElementResolver extends SimpleASTVisitor<Object> {
return null;
} else if (element is VariableElement) {
Type2 variableType = ((element as VariableElement)).type;
if (!variableType.isDynamic() && variableType is! FunctionType) {
if (!variableType.isDynamic() && variableType is! FunctionType && !variableType.isDartCoreFunction()) {
_resolver.reportError(StaticTypeWarningCode.INVOCATION_OF_NON_FUNCTION, methodName2, [methodName2.name]);
}
recordResolution(methodName2, element);
@ -1789,9 +1800,9 @@ class Library {
* @throws IllegalArgumentException if the string is not a constant string without any string
* interpolation
*/
void appendStringValue(StringBuffer builder, StringLiteral literal) {
void appendStringValue(JavaStringBuilder builder, StringLiteral literal) {
if (literal is SimpleStringLiteral) {
builder.write(((literal as SimpleStringLiteral)).value);
builder.append(((literal as SimpleStringLiteral)).value);
} else if (literal is AdjacentStrings) {
for (StringLiteral stringLiteral in ((literal as AdjacentStrings)).strings) {
appendStringValue(builder, stringLiteral);
@ -1819,7 +1830,7 @@ class Library {
* @return the value of the given string literal
*/
String getStringValue(StringLiteral literal) {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
try {
appendStringValue(builder, literal);
} on IllegalArgumentException catch (exception) {
@ -3453,11 +3464,11 @@ class StaticTypeAnalyzer extends SimpleASTVisitor<Object> {
* @return the return type that was computed
*/
Type2 computeReturnType(FunctionDeclaration node) {
TypeName returnType6 = node.returnType;
if (returnType6 == null) {
TypeName returnType7 = node.returnType;
if (returnType7 == null) {
return computeReturnType2(node.functionExpression);
}
return returnType6.type;
return returnType7.type;
}
/**
* Given a function expression, compute the return type of the function. The return type of
@ -3584,7 +3595,7 @@ class StaticTypeAnalyzer extends SimpleASTVisitor<Object> {
* @param returnType the return type of the function, or {@code null} if no type was declared
* @param parameters the elements representing the parameters to the function
*/
void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType9, FormalParameterList parameterList) {
void setTypeInformation(FunctionTypeImpl functionType, Type2 returnType10, FormalParameterList parameterList) {
List<Type2> normalParameterTypes = new List<Type2>();
List<Type2> optionalParameterTypes = new List<Type2>();
LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String, Type2>();
@ -3605,7 +3616,7 @@ class StaticTypeAnalyzer extends SimpleASTVisitor<Object> {
functionType.normalParameterTypes = new List.from(normalParameterTypes);
functionType.optionalParameterTypes = new List.from(optionalParameterTypes);
functionType.namedParameterTypes = namedParameterTypes;
functionType.returnType = returnType9;
functionType.returnType = returnType10;
}
}
/**
@ -4293,7 +4304,7 @@ class TypeResolverVisitor extends ScopedVisitor {
* @param returnType the return type of the function, or {@code null} if no type was declared
* @param parameters the elements representing the parameters to the function
*/
void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType10, List<ParameterElement> parameters) {
void setTypeInformation(FunctionTypeImpl functionType, TypeName returnType11, List<ParameterElement> parameters) {
List<Type2> normalParameterTypes = new List<Type2>();
List<Type2> optionalParameterTypes = new List<Type2>();
LinkedHashMap<String, Type2> namedParameterTypes = new LinkedHashMap<String, Type2>();
@ -4318,10 +4329,10 @@ class TypeResolverVisitor extends ScopedVisitor {
if (!namedParameterTypes.isEmpty) {
functionType.namedParameterTypes = namedParameterTypes;
}
if (returnType10 == null) {
if (returnType11 == null) {
functionType.returnType = _dynamicType;
} else {
functionType.returnType = returnType10.type;
functionType.returnType = returnType11.type;
}
}
}
@ -5167,6 +5178,14 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
}
return super.visitAssignmentExpression(node);
}
Object visitClassDeclaration(ClassDeclaration node) {
checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME);
return super.visitClassDeclaration(node);
}
Object visitClassTypeAlias(ClassTypeAlias node) {
checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
return super.visitClassTypeAlias(node);
}
Object visitConditionalExpression(ConditionalExpression node) {
checkForNonBoolCondition(node.condition);
return super.visitConditionalExpression(node);
@ -5202,6 +5221,10 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
_currentFunction = previousFunction;
}
}
Object visitFunctionTypeAlias(FunctionTypeAlias node) {
checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME);
return super.visitFunctionTypeAlias(node);
}
Object visitIfStatement(IfStatement node) {
checkForNonBoolCondition(node.condition);
return super.visitIfStatement(node);
@ -5265,10 +5288,43 @@ class ErrorVerifier extends RecursiveASTVisitor<Object> {
}
return super.visitReturnStatement(node);
}
Object visitTypeParameter(TypeParameter node) {
checkForBuiltInIdentifierAsName(node.name, CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME);
return super.visitTypeParameter(node);
}
Object visitVariableDeclarationList(VariableDeclarationList node) {
TypeName typeName = node.type;
if (typeName != null) {
Identifier identifier = typeName.name;
if (identifier is SimpleIdentifier) {
SimpleIdentifier simpleIdentifier = identifier as SimpleIdentifier;
Token token13 = simpleIdentifier.token;
if (identical(token13.type, TokenType.KEYWORD)) {
if (((token13 as KeywordToken)).keyword != Keyword.DYNAMIC) {
_errorReporter.reportError(CompileTimeErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, identifier, [identifier.name]);
}
}
}
}
return super.visitVariableDeclarationList(node);
}
Object visitWhileStatement(WhileStatement node) {
checkForNonBoolCondition(node.condition);
return super.visitWhileStatement(node);
}
/**
* This verifies that the passed identifier is not a keyword, and generates the passed error code
* on the identifier if it is a keyword.
* @param identifier the identifier to check to ensure that it is not a keyword
* @param errorCode if the passed identifier is a keyword then this error code is created on the
* identifier, the error code will be one of{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_NAME},{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME} or{@link CompileTimeErrorCode#BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME}
*/
void checkForBuiltInIdentifierAsName(SimpleIdentifier identifier, ErrorCode errorCode) {
Token token14 = identifier.token;
if (identical(token14.type, TokenType.KEYWORD)) {
_errorReporter.reportError(errorCode, identifier, [identifier.name]);
}
}
/**
* Checks to ensure that the expressions that need to be of type bool, are. Otherwise an error is
* reported on the expression.

View file

@ -365,12 +365,12 @@ class SourceRange {
*/
bool startsIn(SourceRange otherRange) => otherRange.contains(_offset);
String toString() {
StringBuffer builder = new StringBuffer();
builder.write("[offset=");
builder.write(_offset);
builder.write(", length=");
builder.write(_length);
builder.write("]");
JavaStringBuilder builder = new JavaStringBuilder();
builder.append("[offset=");
builder.append(_offset);
builder.append(", length=");
builder.append(_length);
builder.append("]");
return builder.toString();
}
}

View file

@ -1147,7 +1147,7 @@ class ElementFactory {
}
static LocalVariableElementImpl localVariableElement(Identifier name) => new LocalVariableElementImpl(name);
static LocalVariableElementImpl localVariableElement2(String name) => new LocalVariableElementImpl(ASTFactory.identifier2(name));
static MethodElementImpl methodElement(String methodName, Type2 returnType11, List<Type2> argumentTypes) {
static MethodElementImpl methodElement(String methodName, Type2 returnType12, List<Type2> argumentTypes) {
MethodElementImpl method = new MethodElementImpl.con1(ASTFactory.identifier2(methodName));
int count = argumentTypes.length;
List<ParameterElement> parameters = new List<ParameterElement>(count);
@ -1159,7 +1159,7 @@ class ElementFactory {
method.parameters = parameters;
FunctionTypeImpl methodType = new FunctionTypeImpl.con1(method);
methodType.normalParameterTypes = argumentTypes;
methodType.returnType = returnType11;
methodType.returnType = returnType12;
method.type = methodType;
return method;
}
@ -1453,8 +1453,8 @@ class FunctionTypeImplTest extends EngineTestCase {
}
void test_getReturnType() {
FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.con1(ASTFactory.identifier2("f")));
Type2 returnType7 = type.returnType;
JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType7);
Type2 returnType8 = type.returnType;
JUnitTestCase.assertEquals(VoidTypeImpl.instance, returnType8);
}
void test_getTypeArguments() {
FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.con1(ASTFactory.identifier2("f")));
@ -1657,8 +1657,8 @@ class FunctionTypeImplTest extends EngineTestCase {
FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.con1(ASTFactory.identifier2("f")));
Type2 expectedType = new InterfaceTypeImpl.con1(new ClassElementImpl(ASTFactory.identifier2("C")));
type.returnType = expectedType;
Type2 returnType8 = type.returnType;
JUnitTestCase.assertEquals(expectedType, returnType8);
Type2 returnType9 = type.returnType;
JUnitTestCase.assertEquals(expectedType, returnType9);
}
void test_setTypeArguments() {
FunctionTypeImpl type = new FunctionTypeImpl.con1(new FunctionElementImpl.con1(ASTFactory.identifier2("f")));

View file

@ -3104,7 +3104,29 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(statement.finallyKeyword);
JUnitTestCase.assertNotNull(statement.finallyClause);
}
void test_parseTypeAlias_noParameters() {
void test_parseTypeAlias_class_implementsC() {
ClassTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef A = Object with B implements C;");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
JUnitTestCase.assertNull(typeAlias.typeParameters);
JUnitTestCase.assertNotNull(typeAlias.withClause);
JUnitTestCase.assertNotNull(typeAlias.implementsClause);
JUnitTestCase.assertNotNull(typeAlias.implementsClause.keyword);
JUnitTestCase.assertEquals(1, typeAlias.implementsClause.interfaces.length);
JUnitTestCase.assertNotNull(typeAlias.semicolon);
}
void test_parseTypeAlias_class_withB() {
ClassTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef A = Object with B;");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
JUnitTestCase.assertNull(typeAlias.typeParameters);
JUnitTestCase.assertNotNull(typeAlias.withClause);
JUnitTestCase.assertNotNull(typeAlias.withClause.withKeyword);
JUnitTestCase.assertEquals(1, typeAlias.withClause.mixinTypes.length);
JUnitTestCase.assertNull(typeAlias.implementsClause);
JUnitTestCase.assertNotNull(typeAlias.semicolon);
}
void test_parseTypeAlias_function_noParameters() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F();");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -3113,7 +3135,7 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(typeAlias.semicolon);
JUnitTestCase.assertNull(typeAlias.typeParameters);
}
void test_parseTypeAlias_noReturnType() {
void test_parseTypeAlias_function_noReturnType() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef F();");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -3122,7 +3144,7 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(typeAlias.semicolon);
JUnitTestCase.assertNull(typeAlias.typeParameters);
}
void test_parseTypeAlias_parameterizedReturnType() {
void test_parseTypeAlias_function_parameterizedReturnType() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef A<B> F();");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -3131,7 +3153,7 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(typeAlias.semicolon);
JUnitTestCase.assertNull(typeAlias.typeParameters);
}
void test_parseTypeAlias_parameters() {
void test_parseTypeAlias_function_parameters() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F(Object value);");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -3140,7 +3162,7 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(typeAlias.semicolon);
JUnitTestCase.assertNull(typeAlias.typeParameters);
}
void test_parseTypeAlias_typeParameters() {
void test_parseTypeAlias_function_typeParameters() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef bool F<E>();");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -3149,7 +3171,7 @@ class SimpleParserTest extends ParserTestCase {
JUnitTestCase.assertNotNull(typeAlias.semicolon);
JUnitTestCase.assertNotNull(typeAlias.typeParameters);
}
void test_parseTypeAlias_voidReturnType() {
void test_parseTypeAlias_function_voidReturnType() {
FunctionTypeAlias typeAlias = ParserTestCase.parse("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef void F();");
JUnitTestCase.assertNotNull(typeAlias.keyword);
JUnitTestCase.assertNotNull(typeAlias.name);
@ -5324,29 +5346,37 @@ class SimpleParserTest extends ParserTestCase {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTryStatement_on_catch_finally);
});
_ut.test('test_parseTypeAlias_noParameters', () {
_ut.test('test_parseTypeAlias_class_implementsC', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_noParameters);
runJUnitTest(__test, __test.test_parseTypeAlias_class_implementsC);
});
_ut.test('test_parseTypeAlias_noReturnType', () {
_ut.test('test_parseTypeAlias_class_withB', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_noReturnType);
runJUnitTest(__test, __test.test_parseTypeAlias_class_withB);
});
_ut.test('test_parseTypeAlias_parameterizedReturnType', () {
_ut.test('test_parseTypeAlias_function_noParameters', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_parameterizedReturnType);
runJUnitTest(__test, __test.test_parseTypeAlias_function_noParameters);
});
_ut.test('test_parseTypeAlias_parameters', () {
_ut.test('test_parseTypeAlias_function_noReturnType', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_parameters);
runJUnitTest(__test, __test.test_parseTypeAlias_function_noReturnType);
});
_ut.test('test_parseTypeAlias_typeParameters', () {
_ut.test('test_parseTypeAlias_function_parameterizedReturnType', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_typeParameters);
runJUnitTest(__test, __test.test_parseTypeAlias_function_parameterizedReturnType);
});
_ut.test('test_parseTypeAlias_voidReturnType', () {
_ut.test('test_parseTypeAlias_function_parameters', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_voidReturnType);
runJUnitTest(__test, __test.test_parseTypeAlias_function_parameters);
});
_ut.test('test_parseTypeAlias_function_typeParameters', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_function_typeParameters);
});
_ut.test('test_parseTypeAlias_function_voidReturnType', () {
final __test = new SimpleParserTest();
runJUnitTest(__test, __test.test_parseTypeAlias_function_voidReturnType);
});
_ut.test('test_parseTypeArgumentList_multiple', () {
final __test = new SimpleParserTest();
@ -6002,11 +6032,11 @@ class ASTValidator extends GeneralizingASTVisitor<Object> {
*/
void assertValid() {
if (!_errors.isEmpty) {
StringBuffer builder = new StringBuffer();
builder.write("Invalid AST structure:");
JavaStringBuilder builder = new JavaStringBuilder();
builder.append("Invalid AST structure:");
for (String message in _errors) {
builder.write("\r\n ");
builder.write(message);
builder.append("\r\n ");
builder.append(message);
}
JUnitTestCase.fail(builder.toString());
}
@ -7068,15 +7098,6 @@ class ErrorParserTest extends ParserTestCase {
void test_breakOutsideOfLoop_functionExpression_withALoop() {
ParserTestCase.parse6("parseStatement", "() {for (; x;) {break;}};", []);
}
void test_builtInIdentifierAsTypeDefName() {
ParserTestCase.parse5("parseTypeAlias", <Object> [emptyCommentAndMetadata()], "typedef as();", [ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPEDEF_NAME]);
}
void test_builtInIdentifierAsTypeName() {
ParserTestCase.parse5("parseClassDeclaration", <Object> [emptyCommentAndMetadata(), null], "class as {}", [ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_NAME]);
}
void test_builtInIdentifierAsTypeVariableName() {
ParserTestCase.parse6("parseTypeParameter", "as", [ParserErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE_VARIABLE_NAME]);
}
void test_constAndFinal() {
ParserTestCase.parse5("parseClassMember", <Object> ["C"], "const final int x;", [ParserErrorCode.CONST_AND_FINAL]);
}
@ -7584,18 +7605,6 @@ class ErrorParserTest extends ParserTestCase {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_breakOutsideOfLoop_functionExpression_withALoop);
});
_ut.test('test_builtInIdentifierAsTypeDefName', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_builtInIdentifierAsTypeDefName);
});
_ut.test('test_builtInIdentifierAsTypeName', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_builtInIdentifierAsTypeName);
});
_ut.test('test_builtInIdentifierAsTypeVariableName', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_builtInIdentifierAsTypeVariableName);
});
_ut.test('test_constAndFinal', () {
final __test = new ErrorParserTest();
runJUnitTest(__test, __test.test_constAndFinal);
@ -8285,7 +8294,6 @@ Map<String, MethodTrampoline> _methodTable_Parser = <String, MethodTrampoline> {
'parseSetter_4': new MethodTrampoline(4, (Parser target, arg0, arg1, arg2, arg3) => target.parseSetter(arg0, arg1, arg2, arg3)),
'parseShiftExpression_0': new MethodTrampoline(0, (Parser target) => target.parseShiftExpression()),
'parseSimpleIdentifier_0': new MethodTrampoline(0, (Parser target) => target.parseSimpleIdentifier()),
'parseSimpleIdentifier_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseSimpleIdentifier2(arg0)),
'parseStatement_0': new MethodTrampoline(0, (Parser target) => target.parseStatement2()),
'parseStatements_0': new MethodTrampoline(0, (Parser target) => target.parseStatements2()),
'parseStringInterpolation_1': new MethodTrampoline(1, (Parser target, arg0) => target.parseStringInterpolation(arg0)),

View file

@ -1427,13 +1427,13 @@ class TokenStreamValidator {
* @param token the first token in the stream of tokens to be validated
*/
void validate(Token token) {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
validateStream(builder, token);
if (builder.length > 0) {
JUnitTestCase.fail(builder.toString());
}
}
void validateStream(StringBuffer builder, Token token) {
void validateStream(JavaStringBuilder builder, Token token) {
if (token == null) {
return;
}
@ -1445,9 +1445,9 @@ class TokenStreamValidator {
TokenType type28 = currentToken.type;
if (identical(type28, TokenType.OPEN_CURLY_BRACKET) || identical(type28, TokenType.OPEN_PAREN) || identical(type28, TokenType.OPEN_SQUARE_BRACKET) || identical(type28, TokenType.STRING_INTERPOLATION_EXPRESSION)) {
if (currentToken is! BeginToken) {
builder.write("\r\nExpected BeginToken, found ");
builder.write(currentToken.runtimeType.toString());
builder.write(" ");
builder.append("\r\nExpected BeginToken, found ");
builder.append(currentToken.runtimeType.toString());
builder.append(" ");
writeToken(builder, currentToken);
}
}
@ -1455,9 +1455,9 @@ class TokenStreamValidator {
int currentLength = currentToken.length;
int currentEnd = currentStart + currentLength - 1;
if (currentStart <= previousEnd) {
builder.write("\r\nInvalid token sequence: ");
builder.append("\r\nInvalid token sequence: ");
writeToken(builder, previousToken);
builder.write(" followed by ");
builder.append(" followed by ");
writeToken(builder, currentToken);
}
previousEnd = currentEnd;
@ -1465,16 +1465,16 @@ class TokenStreamValidator {
currentToken = currentToken.next;
}
}
void writeToken(StringBuffer builder, Token token) {
builder.write("[");
builder.write(token.type);
builder.write(", '");
builder.write(token.lexeme);
builder.write("', ");
builder.write(token.offset);
builder.write(", ");
builder.write(token.length);
builder.write("]");
void writeToken(JavaStringBuilder builder, Token token) {
builder.append("[");
builder.append(token.type);
builder.append(", '");
builder.append(token.lexeme);
builder.append("', ");
builder.append(token.offset);
builder.append(", ");
builder.append(token.length);
builder.append("]");
}
}
abstract class AbstractScannerTest extends JUnitTestCase {

View file

@ -89,7 +89,7 @@ class GatheringErrorListener implements AnalysisErrorListener {
* expected
*/
void assertErrors2(List<ErrorCode> expectedErrorCodes) {
StringBuffer builder = new StringBuffer();
JavaStringBuilder builder = new JavaStringBuilder();
Map<ErrorCode, int> expectedCounts = new Map<ErrorCode, int>();
for (ErrorCode code in expectedErrorCodes) {
int count = expectedCounts[code];
@ -122,15 +122,15 @@ class GatheringErrorListener implements AnalysisErrorListener {
}
if (actualCount != expectedCount) {
if (builder.length == 0) {
builder.write("Expected ");
builder.append("Expected ");
} else {
builder.write("; ");
builder.append("; ");
}
builder.write(expectedCount);
builder.write(" errors of type ");
builder.write(code);
builder.write(", found ");
builder.write(actualCount);
builder.append(expectedCount);
builder.append(" errors of type ");
builder.append(code);
builder.append(", found ");
builder.append(actualCount);
}
}
for (MapEntry<ErrorCode, List<AnalysisError>> entry in getMapEntrySet(errorsByCode)) {
@ -138,23 +138,23 @@ class GatheringErrorListener implements AnalysisErrorListener {
List<AnalysisError> actualErrors = entry.getValue();
int actualCount = actualErrors.length;
if (builder.length == 0) {
builder.write("Expected ");
builder.append("Expected ");
} else {
builder.write("; ");
builder.append("; ");
}
builder.write("0 errors of type ");
builder.write(code);
builder.write(", found ");
builder.write(actualCount);
builder.write(" (");
builder.append("0 errors of type ");
builder.append(code);
builder.append(", found ");
builder.append(actualCount);
builder.append(" (");
for (int i = 0; i < actualErrors.length; i++) {
AnalysisError error = actualErrors[i];
if (i > 0) {
builder.write(", ");
builder.append(", ");
}
builder.write(error.offset);
builder.append(error.offset);
}
builder.write(")");
builder.append(")");
}
if (builder.length > 0) {
JUnitTestCase.fail(builder.toString());