mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 00:09:49 +00:00
Use shared error for constructor's with return type.
Dart2js reports constructor's with return type, as long as the class is used. R=sigmund@google.com Review URL: https://codereview.chromium.org/1704173002 .
This commit is contained in:
parent
0c86f0d58b
commit
3301bc7786
|
@ -65,4 +65,12 @@ const Map<MessageKind, MessageTemplate> TEMPLATES = const <MessageKind, MessageT
|
|||
"external foo; main(){}",
|
||||
]
|
||||
), // Generated. Don't edit.
|
||||
MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE: const MessageTemplate(
|
||||
MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE,
|
||||
"Constructors can't have a return type",
|
||||
howToFix: "Try removing the return type.",
|
||||
examples: const [
|
||||
"class A { int A() {} } main() { new A(); }",
|
||||
]
|
||||
), // Generated. Don't edit.
|
||||
};
|
||||
|
|
|
@ -1847,10 +1847,6 @@ main() {
|
|||
const MessageTemplate(MessageKind.OPERATOR_NAMED_PARAMETERS,
|
||||
"Operator '#{operatorName}' cannot have named parameters."),
|
||||
|
||||
MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE:
|
||||
const MessageTemplate(MessageKind.CONSTRUCTOR_WITH_RETURN_TYPE,
|
||||
"Cannot have return type for constructor."),
|
||||
|
||||
MessageKind.CANNOT_RETURN_FROM_CONSTRUCTOR:
|
||||
const MessageTemplate(MessageKind.CANNOT_RETURN_FROM_CONSTRUCTOR,
|
||||
"Constructors can't return values.",
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -385,18 +385,20 @@ final Map<String, Message> MESSAGES = {
|
|||
]),
|
||||
|
||||
'CLASS_IN_CLASS': new Message(
|
||||
// Dart2js currently reports this as an EXTRANEOUS_MODIFIER error.
|
||||
// TODO(floitsch): make dart2js use this error instead.
|
||||
id: 'DOTHQH',
|
||||
category: Category.parserError,
|
||||
template: "Classes can't be declared inside other classes.",
|
||||
howToFix: "Try moving the class to the top-level.",
|
||||
usedBy: [analyzer],
|
||||
examples: const ["class A { class B {} } main() {}",]),
|
||||
examples: const ["class A { class B {} } main() { new A(); }",]),
|
||||
|
||||
'CONSTRUCTOR_WITH_RETURN_TYPE': new Message(
|
||||
id: 'VOJBWY',
|
||||
category: Category.parserError,
|
||||
template: "Constructors can't have a return type",
|
||||
howToFix: "Try removing the return type.",
|
||||
usedBy: [analyzer],
|
||||
examples: const ["class A { int A() {} } main() {}",]),
|
||||
usedBy: [analyzer, dart2js],
|
||||
examples: const ["class A { int A() {} } main() { new A(); }",]),
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue