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

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

Issue 11260031: Issue 6202. Remove support for 'Dynamic'. Add Clean Up to rename to 'dynamic'. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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
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 import com.google.common.annotations.VisibleForTesting; 6 import com.google.common.annotations.VisibleForTesting;
7 import com.google.dart.compiler.DartCompilationError; 7 import com.google.dart.compiler.DartCompilationError;
8 import com.google.dart.compiler.DartCompilerContext; 8 import com.google.dart.compiler.DartCompilerContext;
9 import com.google.dart.compiler.ErrorCode; 9 import com.google.dart.compiler.ErrorCode;
10 import com.google.dart.compiler.ErrorSeverity; 10 import com.google.dart.compiler.ErrorSeverity;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 206 }
207 return element; 207 return element;
208 } 208 }
209 209
210 Type resolveType(DartNode diagnosticNode, DartNode identifier, List<DartTypeNo de> typeArguments, 210 Type resolveType(DartNode diagnosticNode, DartNode identifier, List<DartTypeNo de> typeArguments,
211 boolean isStatic, boolean isFactory, boolean isAnnotation, Er rorCode errorCode, 211 boolean isStatic, boolean isFactory, boolean isAnnotation, Er rorCode errorCode,
212 ErrorCode wrongNumberErrorCode) { 212 ErrorCode wrongNumberErrorCode) {
213 // Built-in identifier can not be used as a type annotation. 213 // Built-in identifier can not be used as a type annotation.
214 if (identifier instanceof DartIdentifier) { 214 if (identifier instanceof DartIdentifier) {
215 String name = ((DartIdentifier) identifier).getName(); 215 String name = ((DartIdentifier) identifier).getName();
216 if (DartParser.PSEUDO_KEYWORDS_SET.contains(name) && !DartParser.DYNAMIC_K EYWORD.equals(name) 216 if (DartParser.PSEUDO_KEYWORDS_SET.contains(name) && !"dynamic".equals(nam e)) {
217 && !DartParser.DYNAMIC_KEYWORD_DEPRECATED.equals(name)) {
218 onError(identifier, ResolverErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, name) ; 217 onError(identifier, ResolverErrorCode.BUILT_IN_IDENTIFIER_AS_TYPE, name) ;
219 return Types.newDynamicType(); 218 return Types.newDynamicType();
220 } 219 }
221 } 220 }
222 // OK, valid name for type. 221 // OK, valid name for type.
223 Element element = resolveName(identifier); 222 Element element = resolveName(identifier);
224 ElementKind elementKind = ElementKind.of(element); 223 ElementKind elementKind = ElementKind.of(element);
225 switch (elementKind) { 224 switch (elementKind) {
226 case TYPE_VARIABLE: { 225 case TYPE_VARIABLE: {
227 TypeVariableElement typeVariableElement = (TypeVariableElement) element; 226 TypeVariableElement typeVariableElement = (TypeVariableElement) element;
(...skipping 23 matching lines...) Expand all
251 } else { 250 } else {
252 duplicateErrorCode = ResolverErrorCode.DUPLICATE_IMPORTED_NAME; 251 duplicateErrorCode = ResolverErrorCode.DUPLICATE_IMPORTED_NAME;
253 } 252 }
254 onError(identifier, duplicateErrorCode, element.getName(), locations.siz e(), locations); 253 onError(identifier, duplicateErrorCode, element.getName(), locations.siz e(), locations);
255 return typeProvider.getDynamicType(); 254 return typeProvider.getDynamicType();
256 } 255 }
257 case NONE: 256 case NONE:
258 if (Elements.isIdentifierName(identifier, "void")) { 257 if (Elements.isIdentifierName(identifier, "void")) {
259 return typeProvider.getVoidType(); 258 return typeProvider.getVoidType();
260 } 259 }
261 if (Elements.isIdentifierName(identifier, DartParser.DYNAMIC_KEYWORD)) { 260 if (Elements.isIdentifierName(identifier, "dynamic")) {
262 return typeProvider.getDynamicType();
263 }
264 if (Elements.isIdentifierName(identifier, DartParser.DYNAMIC_KEYWORD_DEP RECATED)) {
265 return typeProvider.getDynamicType(); 261 return typeProvider.getDynamicType();
266 } 262 }
267 onError(identifier, errorCode, identifier); 263 onError(identifier, errorCode, identifier);
268 return typeProvider.getDynamicType(); 264 return typeProvider.getDynamicType();
269 default: 265 default:
270 if (!(identifier instanceof DartSyntheticErrorIdentifier)) { 266 if (!(identifier instanceof DartSyntheticErrorIdentifier)) {
271 if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) { 267 if (errorCode.getSubSystem().equals(SubSystem.RESOLVER)) {
272 onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elemen tKind); 268 onError(identifier, ResolverErrorCode.NOT_A_TYPE, identifier, elemen tKind);
273 } else { 269 } else {
274 onError(identifier, TypeErrorCode.NOT_A_TYPE, identifier, elementKin d); 270 onError(identifier, TypeErrorCode.NOT_A_TYPE, identifier, elementKin d);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 String name = node.getName(); 394 String name = node.getName();
399 return scope.findElement(scope.getLibrary(), name); 395 return scope.findElement(scope.getLibrary(), name);
400 } 396 }
401 397
402 @Override 398 @Override
403 public Element visitSyntheticErrorIdentifier(DartSyntheticErrorIdentifier no de) { 399 public Element visitSyntheticErrorIdentifier(DartSyntheticErrorIdentifier no de) {
404 return Elements.dynamicElement(); 400 return Elements.dynamicElement();
405 } 401 }
406 } 402 }
407 } 403 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698