| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 package com.google.dart.compiler.resolver; | 4 package com.google.dart.compiler.resolver; |
| 5 | 5 |
| 6 import com.google.dart.compiler.ErrorCode; | 6 import com.google.dart.compiler.ErrorCode; |
| 7 import com.google.dart.compiler.ErrorSeverity; | 7 import com.google.dart.compiler.ErrorSeverity; |
| 8 import com.google.dart.compiler.SubSystem; | 8 import com.google.dart.compiler.SubSystem; |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 CANNOT_RESOLVE_METHOD("cannot resolve method %s"), | 38 CANNOT_RESOLVE_METHOD("cannot resolve method %s"), |
| 39 CANNOT_RESOLVE_SUPER_CONSTRUCTOR("cannot resolve method %s"), | 39 CANNOT_RESOLVE_SUPER_CONSTRUCTOR("cannot resolve method %s"), |
| 40 CANNOT_RESOLVE_IMPLICIT_CALL_TO_SUPER_CONSTRUCTOR( | 40 CANNOT_RESOLVE_IMPLICIT_CALL_TO_SUPER_CONSTRUCTOR( |
| 41 "super type %s does not have a default constructor"), | 41 "super type %s does not have a default constructor"), |
| 42 CIRCULAR_REFERENCE( | 42 CIRCULAR_REFERENCE( |
| 43 "Circular reference detected: compile-time constants cannot reference the
mselves."), | 43 "Circular reference detected: compile-time constants cannot reference the
mselves."), |
| 44 CONSTRUCTOR_CANNOT_BE_ABSTRACT("A constructor cannot be asbstract"), | 44 CONSTRUCTOR_CANNOT_BE_ABSTRACT("A constructor cannot be asbstract"), |
| 45 CONSTRUCTOR_CANNOT_BE_STATIC("A constructor cannot be static"), | 45 CONSTRUCTOR_CANNOT_BE_STATIC("A constructor cannot be static"), |
| 46 CONSTRUCTOR_CANNOT_HAVE_RETURN_TYPE("Generative constructors cannot have retur
n type"), | 46 CONSTRUCTOR_CANNOT_HAVE_RETURN_TYPE("Generative constructors cannot have retur
n type"), |
| 47 CONST_AND_NONCONST_CONSTRUCTOR("Cannot reference to non-const constructor."), | 47 CONST_AND_NONCONST_CONSTRUCTOR("Cannot reference to non-const constructor."), |
| 48 CONST_CLASS_WITH_INHERITED_NONFINAL_FIELDS("Const class %s cannot have non-fin
al, inherited field %s from class %s"), | 48 CONST_CLASS_WITH_INHERITED_NONFINAL_FIELDS( |
| 49 "Const class %s cannot have non-final, inherited field %s from class %s"), |
| 49 CONST_CLASS_WITH_NONFINAL_FIELDS("Const class %s cannot have non-final field %
s"), | 50 CONST_CLASS_WITH_NONFINAL_FIELDS("Const class %s cannot have non-final field %
s"), |
| 50 CONST_CONSTRUCTOR_CANNOT_HAVE_BODY("A const constructor cannot have a body"), | 51 CONST_CONSTRUCTOR_CANNOT_HAVE_BODY("A const constructor cannot have a body"), |
| 51 CONST_CONSTRUCTOR_MUST_CALL_CONST_SUPER("const constructor must call const sup
er constructor"), | 52 CONST_CONSTRUCTOR_MUST_CALL_CONST_SUPER("const constructor must call const sup
er constructor"), |
| 52 CONSTANTS_MUST_BE_INITIALIZED("constants must be initialized"), | 53 CONSTANTS_MUST_BE_INITIALIZED("constants must be initialized"), |
| 53 CYCLIC_CLASS("%s causes a cycle in the supertype graph"), | 54 CYCLIC_CLASS("%s causes a cycle in the supertype graph"), |
| 54 DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS( | 55 DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS( |
| 55 "default class must have the same type parameters as declared in the inter
face"), | 56 "default class must have the same type parameters as declared in the inter
face"), |
| 56 DEFAULT_CONSTRUCTOR_UNRESOLVED( | 57 DEFAULT_CONSTRUCTOR_UNRESOLVED("Can not resolve constructor with name '%s' in
default class '%s'"), |
| 57 "Can not resolve constructor with name '%s' in default class '%s'"), | |
| 58 DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS( | 58 DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS( |
| 59 "Constructor '%s' in '%s' has %s required parameters, doesn't match '%s' i
n '%s' with %s"), | 59 "Constructor '%s' in '%s' has %s required parameters, doesn't match '%s' i
n '%s' with %s"), |
| 60 DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS( | 60 DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS( |
| 61 "Constructor '%s' in '%s' has named parameters %s, doesn't match '%s' in '
%s' with %s"), | 61 "Constructor '%s' in '%s' has named parameters %s, doesn't match '%s' in '
%s' with %s"), |
| 62 DEFAULT_MUST_SPECIFY_CLASS("default must indicate a class, not an interface"), | 62 DEFAULT_MUST_SPECIFY_CLASS("default must indicate a class, not an interface"), |
| 63 DID_YOU_MEAN_NEW("%1$s is a %2$s. Did you mean (new %1$s)?"), | 63 DID_YOU_MEAN_NEW("%1$s is a %2$s. Did you mean (new %1$s)?"), |
| 64 DUPLICATED_INTERFACE("%s and %s are duplicated in the supertype graph"), | 64 DUPLICATED_INTERFACE("%s and %s are duplicated in the supertype graph"), |
| 65 DUPLICATE_INITIALIZATION(ErrorSeverity.ERROR, "Duplicate initialization of '%s
'"), | 65 DUPLICATE_INITIALIZATION("Duplicate initialization of '%s'"), |
| 66 DUPLICATE_FUNCTION_EXPRESSION(ErrorSeverity.ERROR, "Duplicate function express
ion '%s'"), | 66 DUPLICATE_FUNCTION_EXPRESSION("Duplicate function expression '%s'"), |
| 67 DUPLICATE_FUNCTION_EXPRESSION_WARNING(ErrorSeverity.WARNING, | 67 DUPLICATE_FUNCTION_EXPRESSION_WARNING(ErrorSeverity.WARNING, |
| 68 "Function expression '%s' is hiding '%s' at %s"), | 68 "Function expression '%s' is hiding '%s' at %s"), |
| 69 DUPLICATE_LOCAL_VARIABLE_ERROR(ErrorSeverity.ERROR, "Duplicate local variable
'%s'"), | 69 DUPLICATE_LOCAL_VARIABLE_ERROR("Duplicate local variable '%s'"), |
| 70 DUPLICATE_LOCAL_VARIABLE_WARNING(ErrorSeverity.WARNING, | 70 DUPLICATE_LOCAL_VARIABLE_WARNING(ErrorSeverity.WARNING, |
| 71 "Local variable '%s' is hiding '%s' at %s"), | 71 "Local variable '%s' is hiding '%s' at %s"), |
| 72 DUPLICATE_MEMBER("Duplicate member '%s'"), | 72 DUPLICATE_MEMBER("Duplicate member '%s'"), |
| 73 DUPLICATE_PARAMETER(ErrorSeverity.ERROR, "Duplicate parameter '%s'"), | 73 DUPLICATE_PARAMETER("Duplicate parameter '%s'"), |
| 74 DUPLICATE_PARAMETER_WARNING(ErrorSeverity.WARNING, "Parameter '%s' is hiding '
%s' at %s"), | 74 DUPLICATE_PARAMETER_WARNING(ErrorSeverity.WARNING, "Parameter '%s' is hiding '
%s' at %s"), |
| 75 DUPLICATE_TOP_LEVEL_DEFINITION("duplicate top-level definition '%s'"), | 75 DUPLICATE_TOP_LEVEL_DEFINITION("duplicate top-level definition '%s'"), |
| 76 DUPLICATE_TYPE_VARIABLE(ErrorSeverity.ERROR, "Duplicate type variable '%s'"), | 76 DUPLICATE_TYPE_VARIABLE("Duplicate type variable '%s'"), |
| 77 DUPLICATE_TYPE_VARIABLE_WARNING(ErrorSeverity.WARNING, "Type variable '%s' is
hiding '%s' at %s"), | 77 DUPLICATE_TYPE_VARIABLE_WARNING(ErrorSeverity.WARNING, "Type variable '%s' is
hiding '%s' at %s"), |
| 78 EXPECTED_AN_INSTANCE_FIELD_IN_SUPER_CLASS( | 78 EXPECTED_AN_INSTANCE_FIELD_IN_SUPER_CLASS( |
| 79 "expected an instance field in the super class, but got %s"), | 79 "expected an instance field in the super class, but got %s"), |
| 80 EXPECTED_CONSTANT_EXPRESSION("Expected constant expression"), | 80 EXPECTED_CONSTANT_EXPRESSION("Expected constant expression"), |
| 81 EXPECTED_CONSTANT_EXPRESSION_BOOLEAN("Expected constant expression of type boo
l, got %s"), | 81 EXPECTED_CONSTANT_EXPRESSION_BOOLEAN("Expected constant expression of type boo
l, got %s"), |
| 82 EXPECTED_CONSTANT_EXPRESSION_INT("Expected constant expression of type int, go
t %s"), | 82 EXPECTED_CONSTANT_EXPRESSION_INT("Expected constant expression of type int, go
t %s"), |
| 83 EXPECTED_CONSTANT_EXPRESSION_NUMBER("Expected constant expression of type num,
got %s"), | 83 EXPECTED_CONSTANT_EXPRESSION_NUMBER("Expected constant expression of type num,
got %s"), |
| 84 EXPECTED_CONSTANT_EXPRESSION_STRING_NUMBER_BOOL( | 84 EXPECTED_CONSTANT_EXPRESSION_STRING_NUMBER_BOOL( |
| 85 "Expected constant expression of type String, num or bool, got %s"), | 85 "Expected constant expression of type String, num or bool, got %s"), |
| 86 EXPECTED_FIELD_NOT_CLASS("%s is a class, expected a local field"), | 86 EXPECTED_FIELD_NOT_CLASS("%s is a class, expected a local field"), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 THIS_IN_STATIC_METHOD("Cannot use 'this' in a static method"), | 136 THIS_IN_STATIC_METHOD("Cannot use 'this' in a static method"), |
| 137 THIS_IN_INITIALIZER_AS_EXPRESSION("Cannot reference 'this' as expression in in
itializer list"), | 137 THIS_IN_INITIALIZER_AS_EXPRESSION("Cannot reference 'this' as expression in in
itializer list"), |
| 138 THIS_ON_TOP_LEVEL("Cannot use 'this' in a top-level element"), | 138 THIS_ON_TOP_LEVEL("Cannot use 'this' in a top-level element"), |
| 139 THIS_OUTSIDE_OF_METHOD("Cannot use 'this' outside of a method"), | 139 THIS_OUTSIDE_OF_METHOD("Cannot use 'this' outside of a method"), |
| 140 THIS_IN_FACTORY_CONSTRUCTOR("Cannot use 'this' in a factory constructor"), | 140 THIS_IN_FACTORY_CONSTRUCTOR("Cannot use 'this' in a factory constructor"), |
| 141 TOO_MANY_QUALIFIERS_FOR_METHOD("Too many qualifiers for method or constructor"
), | 141 TOO_MANY_QUALIFIERS_FOR_METHOD("Too many qualifiers for method or constructor"
), |
| 142 TYPE_ARGS_ONLY_ON_CONSTRUCTORS("Type arguments are only allowed on constructor
methods"), | 142 TYPE_ARGS_ONLY_ON_CONSTRUCTORS("Type arguments are only allowed on constructor
methods"), |
| 143 TYPE_NOT_ASSIGNMENT_COMPATIBLE("%s is not assignable to %s"), | 143 TYPE_NOT_ASSIGNMENT_COMPATIBLE("%s is not assignable to %s"), |
| 144 TYPE_VARIABLE_DOES_NOT_MATCH("Type variable %s does not match %s in default cl
ass %s."), | 144 TYPE_VARIABLE_DOES_NOT_MATCH("Type variable %s does not match %s in default cl
ass %s."), |
| 145 TYPE_PARAMETERS_MUST_MATCH_EXACTLY( | 145 TYPE_PARAMETERS_MUST_MATCH_EXACTLY( |
| 146 "Type parameters in default declaration must match referenced class exactly
"), | 146 "Type parameters in default declaration must match referenced class exactl
y"), |
| 147 TYPE_VARIABLE_IN_STATIC_CONTEXT("cannot access type variable %s in static cont
ext"), | 147 TYPE_VARIABLE_IN_STATIC_CONTEXT("cannot access type variable %s in static cont
ext"), |
| 148 WRONG_NUMBER_OF_TYPE_ARGUMENTS("%s: wrong number of type arguments. Expected
%d"); | 148 WRONG_NUMBER_OF_TYPE_ARGUMENTS("%s: wrong number of type arguments. Expected
%d"); |
| 149 private final ErrorSeverity severity; | 149 private final ErrorSeverity severity; |
| 150 private final String message; | 150 private final String message; |
| 151 | 151 |
| 152 /** | 152 /** |
| 153 * Initialize a newly created error code to have the given message and ERROR s
everity. | 153 * Initialize a newly created error code to have the given message and ERROR s
everity. |
| 154 */ | 154 */ |
| 155 private ResolverErrorCode(String message) { | 155 private ResolverErrorCode(String message) { |
| 156 this(ErrorSeverity.ERROR, message); | 156 this(ErrorSeverity.ERROR, message); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 171 | 171 |
| 172 @Override | 172 @Override |
| 173 public ErrorSeverity getErrorSeverity() { | 173 public ErrorSeverity getErrorSeverity() { |
| 174 return severity; | 174 return severity; |
| 175 } | 175 } |
| 176 | 176 |
| 177 @Override | 177 @Override |
| 178 public SubSystem getSubSystem() { | 178 public SubSystem getSubSystem() { |
| 179 return SubSystem.RESOLVER; | 179 return SubSystem.RESOLVER; |
| 180 } | 180 } |
| 181 |
| 182 @Override |
| 183 public boolean needsRecompilation() { |
| 184 return true; |
| 185 } |
| 181 } | 186 } |
| OLD | NEW |