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/ResolutionContext.java

Issue 8956047: This adds a unit test to show the type checking functionality missing in dartc (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Updated test, $chk() can sneak in another way Created 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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.dart.compiler.DartCompilationError; 8 import com.google.dart.compiler.DartCompilationError;
9 import com.google.dart.compiler.DartCompilerContext; 9 import com.google.dart.compiler.DartCompilerContext;
10 import com.google.dart.compiler.ErrorCode; 10 import com.google.dart.compiler.ErrorCode;
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 if (typeArgumentNodes == null || typeArgumentNodes.size() != typeParameters. size()) { 225 if (typeArgumentNodes == null || typeArgumentNodes.size() != typeParameters. size()) {
226 typeArguments = new Type[typeParameters.size()]; 226 typeArguments = new Type[typeParameters.size()];
227 for (int i = 0; i < typeArguments.length; i++) { 227 for (int i = 0; i < typeArguments.length; i++) {
228 typeArguments[i] = typeProvider.getDynamicType(); 228 typeArguments[i] = typeProvider.getDynamicType();
229 } 229 }
230 if (typeArgumentNodes != null && typeArgumentNodes.size() > 0) { 230 if (typeArgumentNodes != null && typeArgumentNodes.size() > 0) {
231 ErrorCode wrongNumberErrorCode = 231 ErrorCode wrongNumberErrorCode =
232 errorCode instanceof ResolverErrorCode 232 errorCode instanceof ResolverErrorCode
233 ? ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS 233 ? ResolverErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS
234 : TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS; 234 : TypeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS;
235 onError(node, wrongNumberErrorCode, element.getType()); 235 onError(node, wrongNumberErrorCode, element.getType(), typeParameters.si ze());
236 } 236 }
237 int index = 0; 237 int index = 0;
238 if (typeArgumentNodes != null) { 238 if (typeArgumentNodes != null) {
239 for (DartTypeNode typeNode : typeArgumentNodes) { 239 for (DartTypeNode typeNode : typeArgumentNodes) {
240 Type type = resolveType(typeNode, isStatic, isFactory, errorCode); 240 Type type = resolveType(typeNode, isStatic, isFactory, errorCode);
241 typeNode.setType(type); 241 typeNode.setType(type);
242 if (index < typeArguments.length) { 242 if (index < typeArguments.length) {
243 typeArguments[index] = type; 243 typeArguments[index] = type;
244 } 244 }
245 index++; 245 index++;
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 return null; 326 return null;
327 } 327 }
328 328
329 @Override 329 @Override
330 public Element visitIdentifier(DartIdentifier node) { 330 public Element visitIdentifier(DartIdentifier node) {
331 String name = node.getTargetName(); 331 String name = node.getTargetName();
332 return scope.findElement(scope.getLibrary(), name); 332 return scope.findElement(scope.getLibrary(), name);
333 } 333 }
334 } 334 }
335 } 335 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698