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

Unified Diff: sdk/lib/_internal/compiler/implementation/resolution/members.dart

Issue 24260002: Revert "Emit compile-time error on duplicate parameter names in typedefs." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | tests/co19/co19-dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/resolution/members.dart
diff --git a/sdk/lib/_internal/compiler/implementation/resolution/members.dart b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
index b9deb490f1b85dc001938f92274757a6a2ad2dc7..73723474460c678b4201df23a7e66c5a560e262f 100644
--- a/sdk/lib/_internal/compiler/implementation/resolution/members.dart
+++ b/sdk/lib/_internal/compiler/implementation/resolution/members.dart
@@ -1723,30 +1723,6 @@ abstract class MappingVisitor<T> extends CommonResolverVisitor<T> {
}
return type;
}
-
- Element defineElement(Node node, Element element,
- {bool doAddToScope: true}) {
- compiler.ensure(element != null);
- mapping[node] = element;
- if (doAddToScope) {
- Element existing = scope.add(element);
- if (existing != element) {
- reportDuplicateDefinition(node, element, existing);
- }
- }
- return element;
- }
-
- void reportDuplicateDefinition(name, Spannable definition,
- Spannable existing) {
- compiler.reportError(
- definition,
- MessageKind.DUPLICATE_DEFINITION, {'name': name});
- compiler.reportMessage(
- compiler.spanFromSpannable(existing),
- MessageKind.EXISTING_DEFINITION.error({'name': name}),
- Diagnostic.INFO);
- }
}
/**
@@ -1939,6 +1915,24 @@ class ResolverVisitor extends MappingVisitor<Element> {
return null;
}
+ Element defineElement(Node node, Element element,
+ {bool doAddToScope: true}) {
+ compiler.ensure(element != null);
+ mapping[node] = element;
+ if (doAddToScope) {
+ Element existing = scope.add(element);
+ if (existing != element) {
+ compiler.reportError(
+ node, MessageKind.DUPLICATE_DEFINITION, {'name': node});
+ compiler.reportMessage(
+ compiler.spanFromSpannable(existing),
+ MessageKind.EXISTING_DEFINITION.error({'name': node}),
+ Diagnostic.INFO);
+ }
+ }
+ return element;
+ }
+
bool isNamedConstructor(Send node) => node.receiver != null;
Selector getRedirectingThisOrSuperConstructorSelector(Send node) {
@@ -2316,10 +2310,14 @@ class ResolverVisitor extends MappingVisitor<Element> {
if (namedArgument != null) {
SourceString source = namedArgument.name.source;
if (seenNamedArguments.containsKey(source)) {
- reportDuplicateDefinition(
- source,
+ compiler.reportError(
argument,
- seenNamedArguments[source]);
+ MessageKind.DUPLICATE_DEFINITION,
+ {'name': source});
+ compiler.reportMessage(
+ compiler.spanFromSpannable(seenNamedArguments[source]),
+ MessageKind.EXISTING_DEFINITION.error({'name': source}),
+ Diagnostic.INFO);
} else {
seenNamedArguments[source] = namedArgument;
}
@@ -3337,16 +3335,12 @@ class TypedefResolverVisitor extends TypeDefinitionVisitor {
scope = new TypeDeclarationScope(scope, element);
resolveTypeVariableBounds(node.typeParameters);
- FunctionSignature signature = SignatureResolver.analyze(
+ element.functionSignature = SignatureResolver.analyze(
compiler, node.formals, node.returnType, element,
defaultValuesAllowed: false);
- scope = new MethodScope(scope, element);
- signature.forEachParameter((Element element) {
- defineElement(element.parseNode(compiler), element);
- });
-
- element.alias = compiler.computeFunctionType(element, signature);
+ element.alias = compiler.computeFunctionType(
+ element, element.functionSignature);
void checkCyclicReference() {
var visitor = new TypedefCyclicVisitor(compiler, element);
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698