| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 16 matching lines...) Expand all Loading... |
| 27 CANNOT_CALL_FUNCTION_TYPE_ALIAS("Function type aliases cannot be called"), | 27 CANNOT_CALL_FUNCTION_TYPE_ALIAS("Function type aliases cannot be called"), |
| 28 // TODO(zundel): error message needs JUnit test - how to test #imports in juni
t? | 28 // TODO(zundel): error message needs JUnit test - how to test #imports in juni
t? |
| 29 CANNOT_CALL_LIBRARY_PREFIX("Library prefixes cannot be called"), | 29 CANNOT_CALL_LIBRARY_PREFIX("Library prefixes cannot be called"), |
| 30 CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR(ErrorSeverity.WARNING, | 30 CANNOT_DECLARE_NON_FACTORY_CONSTRUCTOR(ErrorSeverity.WARNING, |
| 31 "Cannot declare a non-factory named constructor of another class."), | 31 "Cannot declare a non-factory named constructor of another class."), |
| 32 CANNOT_HIDE_IMPORT_PREFIX("Cannot hide import prefix '%s'"), | 32 CANNOT_HIDE_IMPORT_PREFIX("Cannot hide import prefix '%s'"), |
| 33 CANNOT_INIT_STATIC_FIELD_IN_INITIALIZER("Cannot initialize a static field in a
n initializer list"), | 33 CANNOT_INIT_STATIC_FIELD_IN_INITIALIZER("Cannot initialize a static field in a
n initializer list"), |
| 34 CANNOT_OVERRIDE_INSTANCE_MEMBER("static member cannot override instance member
%s of %s"), | 34 CANNOT_OVERRIDE_INSTANCE_MEMBER("static member cannot override instance member
%s of %s"), |
| 35 CANNOT_OVERRIDE_METHOD_NUM_REQUIRED_PARAMS( | 35 CANNOT_OVERRIDE_METHOD_NUM_REQUIRED_PARAMS( |
| 36 "cannot override method %s from %s, wrong number of required parameters"), | 36 "cannot override method %s from %s, wrong number of required parameters"), |
| 37 CANNOT_OVERRIDE_METHOD_NAMED_PARAMS( | 37 CANNOT_OVERRIDE_METHOD_NAMED_PARAMS("cannot override method %s, named paramete
rs don't match"), |
| 38 "cannot override method %s, named parameters don't match"), | 38 CANNOT_OVERRIDE_METHOD_OPTIONAL_PARAMS("cannot override method %s, optional po
sitional parameters don't match"), |
| 39 CANNOT_RESOLVE_CONSTRUCTOR("cannot resolve constructor %s"), | 39 CANNOT_RESOLVE_CONSTRUCTOR("cannot resolve constructor %s"), |
| 40 CANNOT_RESOLVE_FIELD("cannot resolve field %s"), | 40 CANNOT_RESOLVE_FIELD("cannot resolve field %s"), |
| 41 CANNOT_RESOLVE_LABEL("cannot resolve label %s"), | 41 CANNOT_RESOLVE_LABEL("cannot resolve label %s"), |
| 42 CANNOT_RESOLVE_METHOD("cannot resolve method '%s'"), | 42 CANNOT_RESOLVE_METHOD("cannot resolve method '%s'"), |
| 43 CANNOT_RESOLVE_METHOD_IN_CLASS(ErrorSeverity.WARNING, "cannot resolve method '
%s' in class '%s'"), | 43 CANNOT_RESOLVE_METHOD_IN_CLASS(ErrorSeverity.WARNING, "cannot resolve method '
%s' in class '%s'"), |
| 44 // TODO(zundel): error message needs JUnit test - how to test #imports in juni
t? | 44 // TODO(zundel): error message needs JUnit test - how to test #imports in juni
t? |
| 45 CANNOT_RESOLVE_METHOD_IN_LIBRARY("cannot resolve method '%s' in library '%s'")
, | 45 CANNOT_RESOLVE_METHOD_IN_LIBRARY("cannot resolve method '%s' in library '%s'")
, |
| 46 // TODO(zundel): To exercise this requires simulating a corrupted SDK? | 46 // TODO(zundel): To exercise this requires simulating a corrupted SDK? |
| 47 CANNOT_RESOLVE_SDK_TYPE("cannot resolve SDK type %s"), | 47 CANNOT_RESOLVE_SDK_TYPE("cannot resolve SDK type %s"), |
| 48 CANNOT_RESOLVE_SUPER_CONSTRUCTOR("cannot resolve method '%s'"), | 48 CANNOT_RESOLVE_SUPER_CONSTRUCTOR("cannot resolve method '%s'"), |
| (...skipping 21 matching lines...) Expand all Loading... |
| 70 CONST_MAP_WITH_TYPE_VARIABLE("Const map literals cannot have a type variable a
s a type argument"), | 70 CONST_MAP_WITH_TYPE_VARIABLE("Const map literals cannot have a type variable a
s a type argument"), |
| 71 CONST_WITH_TYPE_VARIABLE("Const constructor cannot be invoked with a type vari
able as a type argument"), | 71 CONST_WITH_TYPE_VARIABLE("Const constructor cannot be invoked with a type vari
able as a type argument"), |
| 72 CONSTANTS_MUST_BE_INITIALIZED("constants must be initialized"), | 72 CONSTANTS_MUST_BE_INITIALIZED("constants must be initialized"), |
| 73 CONTINUE_LABEL_RESOLVES_TO_SWITCH("continue label resolves to switch, must be
loop or switch member"), | 73 CONTINUE_LABEL_RESOLVES_TO_SWITCH("continue label resolves to switch, must be
loop or switch member"), |
| 74 CYCLIC_CLASS("%s causes a cycle in the supertype graph"), | 74 CYCLIC_CLASS("%s causes a cycle in the supertype graph"), |
| 75 DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS( | 75 DEFAULT_CLASS_MUST_HAVE_SAME_TYPE_PARAMS( |
| 76 "default class must have the same type parameters as declared in the inter
face"), | 76 "default class must have the same type parameters as declared in the inter
face"), |
| 77 DEFAULT_CONSTRUCTOR_UNRESOLVED("Cannot resolve constructor with name '%s' in d
efault class '%s'"), | 77 DEFAULT_CONSTRUCTOR_UNRESOLVED("Cannot resolve constructor with name '%s' in d
efault class '%s'"), |
| 78 DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS( | 78 DEFAULT_CONSTRUCTOR_NUMBER_OF_REQUIRED_PARAMETERS( |
| 79 "Constructor '%s' in '%s' has %s required parameters, doesn't match '%s' i
n '%s' with %s"), | 79 "Constructor '%s' in '%s' has %s required parameters, doesn't match '%s' i
n '%s' with %s"), |
| 80 DEFAULT_CONSTRUCTOR_OPTIONAL_POSITIONAL_PARAMETERS( |
| 81 "Constructor '%s' in '%s' has %s optional positional parameters, doesn't m
atch '%s' in '%s' with %s"), |
| 80 DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS( | 82 DEFAULT_CONSTRUCTOR_NAMED_PARAMETERS( |
| 81 "Constructor '%s' in '%s' has named parameters %s, doesn't match '%s' in '
%s' with %s"), | 83 "Constructor '%s' in '%s' has named parameters %s, doesn't match '%s' in '
%s' with %s"), |
| 82 DEFAULT_MUST_SPECIFY_CLASS("default must indicate a class, not an interface"), | 84 DEFAULT_MUST_SPECIFY_CLASS("default must indicate a class, not an interface"), |
| 83 DEPRECATED_MAP_LITERAL_SYNTAX(ErrorSeverity.WARNING, | 85 DEPRECATED_MAP_LITERAL_SYNTAX(ErrorSeverity.WARNING, |
| 84 "Deprecated Map literal syntax. Both String (as key) and value type argume
nts required."), | 86 "Deprecated Map literal syntax. Both String (as key) and value type argume
nts required."), |
| 85 DID_YOU_MEAN_NEW("%1$s is a %2$s. Did you mean (new %1$s)?"), | 87 DID_YOU_MEAN_NEW("%1$s is a %2$s. Did you mean (new %1$s)?"), |
| 86 DUPLICATE_IMPLEMENTS_TYPE("Duplicate type in the implements clause"), | 88 DUPLICATE_IMPLEMENTS_TYPE("Duplicate type in the implements clause"), |
| 87 DUPLICATE_IMPORTED_NAME("Element '%s' is introduced by %s imports: %s"), | 89 DUPLICATE_IMPORTED_NAME("Element '%s' is introduced by %s imports: %s"), |
| 88 DUPLICATE_IMPORTED_NAME_TYPE(ErrorSeverity.WARNING, "Element '%s' is introduce
d by %s imports: %s"), | 90 DUPLICATE_IMPORTED_NAME_TYPE(ErrorSeverity.WARNING, "Element '%s' is introduce
d by %s imports: %s"), |
| 89 DUPLICATE_INITIALIZATION("Duplicate initialization of '%s'"), | 91 DUPLICATE_INITIALIZATION("Duplicate initialization of '%s'"), |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 NO_SUCH_TYPE_CONST("no such type \"%s\" in constant constructor"), | 165 NO_SUCH_TYPE_CONST("no such type \"%s\" in constant constructor"), |
| 164 NOT_A_CLASS("\"%s\" is not a class"), | 166 NOT_A_CLASS("\"%s\" is not a class"), |
| 165 NOT_A_CLASS_OR_INTERFACE("\"%s\" is not a class or interface"), | 167 NOT_A_CLASS_OR_INTERFACE("\"%s\" is not a class or interface"), |
| 166 // TODO(zundel): error message needs JUnit test (reachable code?) | 168 // TODO(zundel): error message needs JUnit test (reachable code?) |
| 167 NOT_A_LABEL("\"%s\" is not a label"), | 169 NOT_A_LABEL("\"%s\" is not a label"), |
| 168 NOT_A_STATIC_FIELD("\"%s\" is not a static field"), | 170 NOT_A_STATIC_FIELD("\"%s\" is not a static field"), |
| 169 NOT_A_STATIC_METHOD("\"%s\" is not a static method"), | 171 NOT_A_STATIC_METHOD("\"%s\" is not a static method"), |
| 170 NOT_A_TYPE("type \"%s\" expected, but \"%s\" found"), | 172 NOT_A_TYPE("type \"%s\" expected, but \"%s\" found"), |
| 171 // TODO(zundel): error message needs JUnit test (reachable code?) | 173 // TODO(zundel): error message needs JUnit test (reachable code?) |
| 172 NOT_AN_INSTANCE_FIELD("%s is not an instance field"), | 174 NOT_AN_INSTANCE_FIELD("%s is not an instance field"), |
| 173 REDIRECTED_CONSTRUCTOR_CYCLE("Redirected constructor call has a cycle."), | 175 OPTIONAL_PARAMETERS_CANNOT_START_WITH_UNDER("Optional parameters cannot start
with an '_' character"), |
| 174 PARAMETER_INIT_OUTSIDE_CONSTRUCTOR("Parameter initializers can only be used in
constructors"), | 176 PARAMETER_INIT_OUTSIDE_CONSTRUCTOR("Parameter initializers can only be used in
constructors"), |
| 175 SUPER_METHOD_INVOCATION_IN_CONSTRUCTOR_INITIALIZER( | 177 SUPER_METHOD_INVOCATION_IN_CONSTRUCTOR_INITIALIZER( |
| 176 "Super method invocation is not allowed in constructor initializer"), | 178 "Super method invocation is not allowed in constructor initializer"), |
| 177 PARAMETER_INIT_STATIC_FIELD( | 179 PARAMETER_INIT_STATIC_FIELD( |
| 178 "Parameter initializer cannot be use to initialize a static field '%s'"), | 180 "Parameter initializer cannot be use to initialize a static field '%s'"), |
| 179 // TODO(zundel): error message needs JUnit test (reachable code?) | 181 // TODO(zundel): error message needs JUnit test (reachable code?) |
| 180 PARAMETER_INIT_WITH_REDIR_CONSTRUCTOR( | 182 PARAMETER_INIT_WITH_REDIR_CONSTRUCTOR( |
| 181 "Parameter initializers cannot be used with redirected constructors"), | 183 "Parameter initializers cannot be used with redirected constructors"), |
| 182 // TODO(zundel): error message needs JUnit test | 184 // TODO(zundel): error message needs JUnit test |
| 183 PARAMETER_NOT_MATCH_FIELD("Could not match parameter initializer '%s' with any
field"), | 185 PARAMETER_NOT_MATCH_FIELD("Could not match parameter initializer '%s' with any
field"), |
| 186 REDIRECTED_CONSTRUCTOR_CYCLE("Redirected constructor call has a cycle."), |
| 184 REDIRECTION_CONSTRUCTOR_TARGET_TYPE( | 187 REDIRECTION_CONSTRUCTOR_TARGET_TYPE( |
| 185 "Target of redirecting factory constructor is not a type"), | 188 "Target of redirecting factory constructor is not a type"), |
| 186 REDIRECTION_CONSTRUCTOR_TARGET_MUST_BE_CONST( | 189 REDIRECTION_CONSTRUCTOR_TARGET_MUST_BE_CONST( |
| 187 "Target of constant redirecting factory constructor also should be constan
t"), | 190 "Target of constant redirecting factory constructor also should be constan
t"), |
| 188 REDIRECTION_CONSTRUCTOR_CYCLE("Cycle in redirecting constructors"), | 191 REDIRECTION_CONSTRUCTOR_CYCLE("Cycle in redirecting constructors"), |
| 189 RETHROW_NOT_IN_CATCH("Re-throw not in a catch block"), | 192 RETHROW_NOT_IN_CATCH("Re-throw not in a catch block"), |
| 190 STATIC_FINAL_REQUIRES_VALUE("Static final fields must have an initial value"), | 193 STATIC_FINAL_REQUIRES_VALUE("Static final fields must have an initial value"), |
| 191 STATIC_METHOD_MUST_HAVE_BODY("Static method must have a body"), | 194 STATIC_METHOD_MUST_HAVE_BODY("Static method must have a body"), |
| 192 SUPER_IN_FACTORY_CONSTRUCTOR("Cannot use 'super' in a factory constructor"), | 195 SUPER_IN_FACTORY_CONSTRUCTOR("Cannot use 'super' in a factory constructor"), |
| 193 SUPER_IN_STATIC_METHOD("Cannot use 'super' in a static method"), | 196 SUPER_IN_STATIC_METHOD("Cannot use 'super' in a static method"), |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 @Override | 246 @Override |
| 244 public SubSystem getSubSystem() { | 247 public SubSystem getSubSystem() { |
| 245 return SubSystem.RESOLVER; | 248 return SubSystem.RESOLVER; |
| 246 } | 249 } |
| 247 | 250 |
| 248 @Override | 251 @Override |
| 249 public boolean needsRecompilation() { | 252 public boolean needsRecompilation() { |
| 250 return true; | 253 return true; |
| 251 } | 254 } |
| 252 } | 255 } |
| OLD | NEW |