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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 2925263002: A step towards handling `new Object()` in compile_from_dill_test (Closed)
Patch Set: Created 3 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
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 library closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import 'common/names.dart' show Identifiers; 7 import 'common/names.dart' show Identifiers;
8 import 'common/resolution.dart' show ParsingContext, Resolution; 8 import 'common/resolution.dart' show ParsingContext, Resolution;
9 import 'common/tasks.dart' show CompilerTask; 9 import 'common/tasks.dart' show CompilerTask;
10 import 'common.dart'; 10 import 'common.dart';
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 143
144 /// Use [closureClass] instead. 144 /// Use [closureClass] instead.
145 @deprecated 145 @deprecated
146 get enclosingElement => super.enclosingElement; 146 get enclosingElement => super.enclosingElement;
147 147
148 ClosureClassElement get closureClass => super.enclosingElement; 148 ClosureClassElement get closureClass => super.enclosingElement;
149 149
150 MemberElement get memberContext => closureClass.methodElement.memberContext; 150 MemberElement get memberContext => closureClass.methodElement.memberContext;
151 151
152 @override 152 @override
153 Entity get declaredEntity => local; 153 Local get declaredEntity => local;
154
154 @override 155 @override
155 Entity get rootOfScope => closureClass; 156 Entity get rootOfScope => closureClass;
156 157
157 bool get hasNode => false; 158 bool get hasNode => false;
158 159
159 Node get node { 160 Node get node {
160 throw new SpannableAssertionFailure( 161 throw new SpannableAssertionFailure(
161 local, 'Should not access node of ClosureFieldElement.'); 162 local, 'Should not access node of ClosureFieldElement.');
162 } 163 }
163 164
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 @override 286 @override
286 MemberElement get memberContext => executableContext.memberContext; 287 MemberElement get memberContext => executableContext.memberContext;
287 288
288 String toString() => 'BoxLocal($name)'; 289 String toString() => 'BoxLocal($name)';
289 } 290 }
290 291
291 // TODO(ngeoffray, ahe): These classes continuously cause problems. We need to 292 // TODO(ngeoffray, ahe): These classes continuously cause problems. We need to
292 // find a more general solution. 293 // find a more general solution.
293 class BoxFieldElement extends ElementX 294 class BoxFieldElement extends ElementX
294 implements TypedElement, FieldElement, PrivatelyNamedJSEntity { 295 implements TypedElement, FieldElement, PrivatelyNamedJSEntity {
296 final LocalVariableElement variableElement;
295 final BoxLocal box; 297 final BoxLocal box;
296 298
297 BoxFieldElement(String name, this.variableElement, BoxLocal box) 299 BoxFieldElement(String name, this.variableElement, BoxLocal box)
298 : this.box = box, 300 : this.box = box,
299 super(name, ElementKind.FIELD, box.executableContext); 301 super(name, ElementKind.FIELD, box.executableContext);
300 302
301 ResolutionDartType computeType(Resolution resolution) => type; 303 ResolutionDartType computeType(Resolution resolution) => type;
302 304
303 ResolutionDartType get type => variableElement.type; 305 ResolutionDartType get type => variableElement.type;
304 306
305 @override 307 @override
306 Entity get declaredEntity => variableElement; 308 Local get declaredEntity => variableElement;
309
307 @override 310 @override
308 Entity get rootOfScope => box; 311 Entity get rootOfScope => box;
309 312
310 final VariableElement variableElement;
311
312 accept(ElementVisitor visitor, arg) { 313 accept(ElementVisitor visitor, arg) {
313 return visitor.visitBoxFieldElement(this, arg); 314 return visitor.visitBoxFieldElement(this, arg);
314 } 315 }
315 316
316 @override 317 @override
317 bool get hasNode => false; 318 bool get hasNode => false;
318 319
319 @override 320 @override
320 bool get hasResolvedAst => false; 321 bool get hasResolvedAst => false;
321 322
(...skipping 914 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 sb.write('#'); 1237 sb.write('#');
1237 sb.write(name); 1238 sb.write(name);
1238 sb.write(')'); 1239 sb.write(')');
1239 return sb.toString(); 1240 return sb.toString();
1240 } 1241 }
1241 } 1242 }
1242 1243
1243 /// 1244 ///
1244 /// Move the below classes to a JS model eventually. 1245 /// Move the below classes to a JS model eventually.
1245 /// 1246 ///
1246 abstract class JSEntity implements Entity { 1247 abstract class JSEntity implements MemberEntity {
1247 Entity get declaredEntity; 1248 Local get declaredEntity;
1248 } 1249 }
1249 1250
1250 abstract class PrivatelyNamedJSEntity implements JSEntity { 1251 abstract class PrivatelyNamedJSEntity implements JSEntity {
1251 Entity get rootOfScope; 1252 Entity get rootOfScope;
1252 } 1253 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/elements/common.dart » ('j') | pkg/compiler/lib/src/elements/common.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698