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

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

Issue 11472022: Reject constructor names that conflict with members. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years 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: dart/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart b/dart/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
index e7ceaf85229e84f0cc2fc5bdfa5d787e86fbcc43..fc5e4df06259d3c16d2b2fe7d1fc0f30d95331b0 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/scanner/class_element_parser.dart
@@ -105,6 +105,9 @@ class MemberListener extends NodeListener {
listener.cancel('library prefix in named factory constructor not '
'implemented', node: send.receiver);
}
+ if (receiver.source != enclosingElement.name) {
+ listener.onDeprecatedFeature(receiver, 'interface factories');
+ }
return Elements.constructConstructorName(receiver.source,
selector.source);
}
@@ -137,6 +140,12 @@ class MemberListener extends NodeListener {
FunctionExpression method = popNode();
pushNode(null);
SourceString name = getMethodNameHack(method.name);
+ Identifier singleIdentifierName = method.name.asIdentifier();
+ if (singleIdentifierName != null && singleIdentifierName.source == name) {
+ if (name != enclosingElement.name) {
+ listener.onDeprecatedFeature(method.name, 'interface factories');
+ }
+ }
ElementKind kind = ElementKind.FUNCTION;
Element memberElement =
new PartialFunctionElement(name, beginToken, null, endToken,

Powered by Google App Engine
This is Rietveld 408576698