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

Side by Side Diff: pkg/compiler/lib/src/elements/modelx.dart

Issue 1992733002: Handle redirecting factories. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
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 '../common.dart'; 7 import '../common.dart';
8 import '../common/resolution.dart' show Resolution, ParsingContext; 8 import '../common/resolution.dart' show Resolution, ParsingContext;
9 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
10 import '../constants/constant_constructors.dart'; 10 import '../constants/constant_constructors.dart';
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 get isExternal => unsupported(); 249 get isExternal => unsupported();
250 get constantConstructor => null; 250 get constantConstructor => null;
251 251
252 bool get isRedirectingGenerative => unsupported(); 252 bool get isRedirectingGenerative => unsupported();
253 bool get isRedirectingFactory => unsupported(); 253 bool get isRedirectingFactory => unsupported();
254 254
255 computeType(Resolution resolution) => unsupported(); 255 computeType(Resolution resolution) => unsupported();
256 256
257 bool get hasFunctionSignature => false; 257 bool get hasFunctionSignature => false;
258 258
259 bool get hasEffectiveTarget => true;
260
259 get effectiveTarget => this; 261 get effectiveTarget => this;
260 262
261 computeEffectiveTargetType(InterfaceType newType) => unsupported(); 263 computeEffectiveTargetType(InterfaceType newType) => unsupported();
262 264
263 get definingConstructor => null; 265 get definingConstructor => null;
264 266
265 FunctionElement asFunctionElement() => this; 267 FunctionElement asFunctionElement() => this;
266 268
267 String get message { 269 String get message {
268 return MessageTemplate.TEMPLATES[messageKind] 270 return MessageTemplate.TEMPLATES[messageKind]
(...skipping 1923 matching lines...) Expand 10 before | Expand all | Expand 10 after
2192 2194
2193 // TODO(johnniwinther): This should also return true for cyclic redirecting 2195 // TODO(johnniwinther): This should also return true for cyclic redirecting
2194 // generative constructors. 2196 // generative constructors.
2195 bool get isCyclicRedirection => effectiveTarget.isRedirectingFactory; 2197 bool get isCyclicRedirection => effectiveTarget.isRedirectingFactory;
2196 2198
2197 /// These fields are set by the post process queue when checking for cycles. 2199 /// These fields are set by the post process queue when checking for cycles.
2198 ConstructorElement effectiveTargetInternal; 2200 ConstructorElement effectiveTargetInternal;
2199 DartType _effectiveTargetType; 2201 DartType _effectiveTargetType;
2200 bool _isEffectiveTargetMalformed; 2202 bool _isEffectiveTargetMalformed;
2201 2203
2204 bool get hasEffectiveTarget => effectiveTargetInternal != null;
2205
2202 void setEffectiveTarget(ConstructorElement target, DartType type, 2206 void setEffectiveTarget(ConstructorElement target, DartType type,
2203 {bool isMalformed: false}) { 2207 {bool isMalformed: false}) {
2204 assert(invariant(this, target != null, 2208 assert(invariant(this, target != null,
2205 message: 'No effective target provided for $this.')); 2209 message: 'No effective target provided for $this.'));
2206 assert(invariant(this, effectiveTargetInternal == null, 2210 assert(invariant(this, effectiveTargetInternal == null,
2207 message: 'Effective target has already been computed for $this.')); 2211 message: 'Effective target has already been computed for $this.'));
2208 effectiveTargetInternal = target; 2212 effectiveTargetInternal = target;
2209 _effectiveTargetType = type; 2213 _effectiveTargetType = type;
2210 _isEffectiveTargetMalformed = isMalformed; 2214 _isEffectiveTargetMalformed = isMalformed;
2211 } 2215 }
(...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after
3284 body = node.asFunctionExpression().body; 3288 body = node.asFunctionExpression().body;
3285 } 3289 }
3286 return new ParsedResolvedAst( 3290 return new ParsedResolvedAst(
3287 declaration, 3291 declaration,
3288 node, 3292 node,
3289 body, 3293 body,
3290 definingElement.treeElements, 3294 definingElement.treeElements,
3291 definingElement.compilationUnit.script.resourceUri); 3295 definingElement.compilationUnit.script.resourceUri);
3292 } 3296 }
3293 } 3297 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/elements/elements.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698