Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart

Issue 18670003: Remove support for conflicting constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated cf. comments. Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
diff --git a/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart b/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
index 793c85023d92d4f7127b0ea80c41a43a566e93e8..81f9fec9f8dd874b964df4abfe3ad7f5c72748af 100644
--- a/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
+++ b/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
@@ -89,7 +89,10 @@ class MemberListener extends NodeListener {
// TODO(johnniwinther): Remove this method.
SourceString getMethodNameHack(Node methodName) {
Send send = methodName.asSend();
- if (send == null) return methodName.asIdentifier().source;
+ if (send == null) {
+ if (isConstructorName(methodName)) return const SourceString('');
+ return methodName.asIdentifier().source;
+ }
Identifier receiver = send.receiver.asIdentifier();
Identifier selector = send.selector.asIdentifier();
Operator operator = selector.asOperator();
@@ -100,17 +103,12 @@ class MemberListener extends NodeListener {
bool isUnary = identical(operator.token.next.next.stringValue, ')');
return Elements.constructOperatorName(operator.source, isUnary);
} else {
- if (receiver == null) {
- listener.cancel('library prefix in named factory constructor not '
- 'implemented', node: send.receiver);
- }
- if (receiver.source != enclosingElement.name) {
- listener.reportErrorCode(receiver,
+ if (receiver == null || receiver.source != enclosingElement.name) {
+ listener.reportErrorCode(send.receiver,
MessageKind.INVALID_CONSTRUCTOR_NAME,
{'name': enclosingElement.name});
}
- return Elements.constructConstructorName(receiver.source,
- selector.source);
+ return selector.source;
}
}

Powered by Google App Engine
This is Rietveld 408576698