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

Side by Side Diff: compiler/java/com/google/dart/compiler/resolver/Resolver.java

Issue 10961058: Issue 5302. Type alias type parameters should not conflict with formal parameters (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 package com.google.dart.compiler.resolver; 5 package com.google.dart.compiler.resolver;
6 6
7 import com.google.common.annotations.VisibleForTesting; 7 import com.google.common.annotations.VisibleForTesting;
8 import com.google.common.collect.Lists; 8 import com.google.common.collect.Lists;
9 import com.google.common.collect.Sets; 9 import com.google.common.collect.Sets;
10 import com.google.dart.compiler.DartCompilationPhase; 10 import com.google.dart.compiler.DartCompilationPhase;
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 } 237 }
238 return null; 238 return null;
239 } 239 }
240 240
241 @Override 241 @Override
242 public Element visitFunctionTypeAlias(DartFunctionTypeAlias alias) { 242 public Element visitFunctionTypeAlias(DartFunctionTypeAlias alias) {
243 alias.getMetadata().accept(this); 243 alias.getMetadata().accept(this);
244 getContext().pushFunctionAliasScope(alias); 244 getContext().pushFunctionAliasScope(alias);
245 resolveFunctionAlias(alias); 245 resolveFunctionAlias(alias);
246 246
247 List<DartParameter> parameters = alias.getParameters(); 247 getContext().pushScope("<parameters>");
248 for (DartParameter parameter : parameters) { 248 try {
249 assert parameter.getElement() != null; 249 List<DartParameter> parameters = alias.getParameters();
250 if (parameter.getQualifier() instanceof DartThisExpression) { 250 for (DartParameter parameter : parameters) {
251 onError(parameter.getName(), ResolverErrorCode.PARAMETER_INIT_OUTSIDE_ CONSTRUCTOR); 251 assert parameter.getElement() != null;
252 } else { 252 if (parameter.getQualifier() instanceof DartThisExpression) {
253 if (parameter.getModifiers().isNamed() 253 onError(parameter.getName(), ResolverErrorCode.PARAMETER_INIT_OUTSID E_CONSTRUCTOR);
254 && DartIdentifier.isPrivateName(parameter.getElement().getName())) { 254 } else {
255 onError(parameter.getName(), 255 if (parameter.getModifiers().isNamed()
256 ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER); 256 && DartIdentifier.isPrivateName(parameter.getElement().getName() )) {
257 onError(parameter.getName(),
258 ResolverErrorCode.NAMED_PARAMETERS_CANNOT_START_WITH_UNDER);
259 }
260 getContext().declare(parameter.getElement(), ResolverErrorCode.DUPLI CATE_PARAMETER);
257 } 261 }
258 getContext().declare(
259 parameter.getElement(),
260 ResolverErrorCode.DUPLICATE_PARAMETER);
261 } 262 }
263 } finally {
264 getContext().popScope();
262 } 265 }
263 266
264 getContext().popScope(); 267 getContext().popScope();
265 return null; 268 return null;
266 } 269 }
267 270
268 @Override 271 @Override
269 public Element visitClass(DartClass cls) { 272 public Element visitClass(DartClass cls) {
270 assert currentMethod == null : "nested class?"; 273 assert currentMethod == null : "nested class?";
271 ClassNodeElement classElement = cls.getElement(); 274 ClassNodeElement classElement = cls.getElement();
(...skipping 2105 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment(); 2380 ClassElement currentClass = (ClassElement) constructor.getEnclosingEle ment();
2378 if (nextClass == currentClass) { 2381 if (nextClass == currentClass) {
2379 return (ConstructorNodeElement) nextConstructorElement; 2382 return (ConstructorNodeElement) nextConstructorElement;
2380 } 2383 }
2381 } 2384 }
2382 } 2385 }
2383 } 2386 }
2384 return null; 2387 return null;
2385 } 2388 }
2386 } 2389 }
OLDNEW
« no previous file with comments | « no previous file | compiler/javatests/com/google/dart/compiler/type/TypeAnalyzerCompilerTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698