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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 16549004: Add type arguments to constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Adjust test status. Created 7 years, 6 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
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library elements.modelx; 5 library elements.modelx;
6 6
7 import 'dart:collection' show LinkedHashMap; 7 import 'dart:collection' show LinkedHashMap;
8 8
9 import 'elements.dart'; 9 import 'elements.dart';
10 import '../../compiler.dart' as api; 10 import '../../compiler.dart' as api;
(...skipping 1235 matching lines...) Expand 10 before | Expand all | Expand 10 after
1246 // TODO(ahe): This is expedient for now, but it should be 1246 // TODO(ahe): This is expedient for now, but it should be
1247 // checked by the resolver. Keeping http://dartbug.com/3970 1247 // checked by the resolver. Keeping http://dartbug.com/3970
1248 // open to track this. 1248 // open to track this.
1249 throw new SpannableAssertionFailure( 1249 throw new SpannableAssertionFailure(
1250 target, 'redirecting factory leads to cycle'); 1250 target, 'redirecting factory leads to cycle');
1251 } 1251 }
1252 } 1252 }
1253 return target; 1253 return target;
1254 } 1254 }
1255 1255
1256 InterfaceType computeTargetType(Compiler compiler,
1257 InterfaceType newType) {
1258 if (!isRedirectingFactory) return newType;
1259 ClassElement targetClass = getEnclosingClass();
1260 TreeElements treeElements =
1261 compiler.enqueuer.resolution.getCachedElements(
1262 declaration);
1263 FunctionExpression functionNode = parseNode(compiler);
1264 Return redirectionNode = functionNode.body;
1265 return treeElements.getType(redirectionNode.expression)
1266 .subst(newType.typeArguments, targetClass.typeVariables);
1267 }
1268
1256 /** 1269 /**
1257 * Applies a patch function to this function. The patch function's body 1270 * Applies a patch function to this function. The patch function's body
1258 * is used as replacement when parsing this function's body. 1271 * is used as replacement when parsing this function's body.
1259 * This method must not be called after the function has been parsed, 1272 * This method must not be called after the function has been parsed,
1260 * and it must be called at most once. 1273 * and it must be called at most once.
1261 */ 1274 */
1262 void setPatch(FunctionElement patchElement) { 1275 void setPatch(FunctionElement patchElement) {
1263 // Sanity checks. The caller must check these things before calling. 1276 // Sanity checks. The caller must check these things before calling.
1264 assert(patch == null); 1277 assert(patch == null);
1265 this.patch = patchElement; 1278 this.patch = patchElement;
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2188 2201
2189 MetadataAnnotation ensureResolved(Compiler compiler) { 2202 MetadataAnnotation ensureResolved(Compiler compiler) {
2190 if (resolutionState == STATE_NOT_STARTED) { 2203 if (resolutionState == STATE_NOT_STARTED) {
2191 compiler.resolver.resolveMetadataAnnotation(this); 2204 compiler.resolver.resolveMetadataAnnotation(this);
2192 } 2205 }
2193 return this; 2206 return this;
2194 } 2207 }
2195 2208
2196 String toString() => 'MetadataAnnotation($value, $resolutionState)'; 2209 String toString() => 'MetadataAnnotation($value, $resolutionState)';
2197 } 2210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698