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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart

Issue 24326003: Reapply: "Emit compile-time error on duplicate parameter names in typedefs." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Check for optional parameter assumes function, not typedef. Created 7 years, 3 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
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/resolution/members.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
index a4e367fa563b7728a987de57d5cf4a04ea97b828..6f07e12c58016fd610c71e9a1185911a389e557f 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/placeholder_collector.dart
@@ -244,6 +244,13 @@ class PlaceholderCollector extends Visitor {
});
}
+ // TODO(karlklose): should we create placeholders for these?
+ bool isTypedefParameter(Element element) {
+ return element != null &&
+ element.enclosingElement != null &&
+ element.enclosingElement.isTypedef();
+ }
+
void tryMakeLocalPlaceholder(Element element, Identifier node) {
bool isNamedOptionalParameter() {
FunctionElement function = element.enclosingElement;
@@ -258,9 +265,10 @@ class PlaceholderCollector extends Visitor {
// TODO(smok): Maybe we should rename privates as well, their privacy
// should not matter if they are local vars.
if (node.source.isPrivate()) return;
- if (element.isParameter() && isNamedOptionalParameter()) {
+ if (element.isParameter() && !isTypedefParameter(element) &&
+ isNamedOptionalParameter()) {
currentFunctionScope.registerParameter(node);
- } else if (Elements.isLocal(element)) {
+ } else if (Elements.isLocal(element) && !isTypedefParameter(element)) {
Johnni Winther 2013/09/23 08:06:18 How can this happen?
karlklose 2013/09/23 08:09:52 Typedef parameters are parameters that are not ins
makeLocalPlaceholder(node);
}
}
« no previous file with comments | « no previous file | sdk/lib/_internal/compiler/implementation/resolution/members.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698