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: frog/leg/ssa/closure.dart

Issue 9419048: Resolve class element of Object, even if no objects are used. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 10 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
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class ClosureFieldElement extends Element { 5 class ClosureFieldElement extends Element {
6 ClosureFieldElement(SourceString name, ClassElement enclosing) 6 ClosureFieldElement(SourceString name, ClassElement enclosing)
7 : super(name, ElementKind.FIELD, enclosing); 7 : super(name, ElementKind.FIELD, enclosing);
8 8
9 bool isInstanceMember() => true; 9 bool isInstanceMember() => true;
10 bool isAssignable() => false; 10 bool isAssignable() => false;
(...skipping 280 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 SourceString name = const SourceString("Closure"); 291 SourceString name = const SourceString("Closure");
292 CompilationUnitElement compilationUnit = element.getCompilationUnit(); 292 CompilationUnitElement compilationUnit = element.getCompilationUnit();
293 ClassElement globalizedElement = new ClassElement(name, compilationUnit); 293 ClassElement globalizedElement = new ClassElement(name, compilationUnit);
294 FunctionElement callElement = 294 FunctionElement callElement =
295 new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME, 295 new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME,
296 element, 296 element,
297 globalizedElement); 297 globalizedElement);
298 globalizedElement.backendMembers = 298 globalizedElement.backendMembers =
299 const EmptyLink<Element>().prepend(callElement); 299 const EmptyLink<Element>().prepend(callElement);
300 globalizedElement.isResolved = true; 300 globalizedElement.isResolved = true;
301 ClassElement objectClass = 301 // TODO(karlklose): create function to get the resolved class object.
302 compiler.coreLibrary.find(const SourceString('Object')); 302 ClassElement objectClass = compiler.coreLibrary.find(Types.OBJECT);
303 globalizedElement.supertype = new SimpleType(Types.OBJECT, objectClass); 303 globalizedElement.supertype = objectClass.computeType(compiler);
304 objectClass.resolve(compiler);
304 // The nested function's 'this' is the same as the one for the outer 305 // The nested function's 'this' is the same as the one for the outer
305 // function. It could be [null] if we are inside a static method. 306 // function. It could be [null] if we are inside a static method.
306 Element thisElement = closureData.thisElement; 307 Element thisElement = closureData.thisElement;
307 return new ClosureData(element, globalizedElement, 308 return new ClosureData(element, globalizedElement,
308 callElement, thisElement); 309 callElement, thisElement);
309 } 310 }
310 311
311 visitFunctionExpression(FunctionExpression node) { 312 visitFunctionExpression(FunctionExpression node) {
312 FunctionElement element = elements[node]; 313 FunctionElement element = elements[node];
313 bool isClosure = (closureData !== null); 314 bool isClosure = (closureData !== null);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 } 388 }
388 } 389 }
389 390
390 visitTryStatement(TryStatement node) { 391 visitTryStatement(TryStatement node) {
391 // TODO(ngeoffray): implement finer grain state. 392 // TODO(ngeoffray): implement finer grain state.
392 inTryCatchOrFinally = true; 393 inTryCatchOrFinally = true;
393 node.visitChildren(this); 394 node.visitChildren(this);
394 inTryCatchOrFinally = false; 395 inTryCatchOrFinally = false;
395 } 396 }
396 } 397 }
OLDNEW
« no previous file with comments | « frog/leg/ssa/builder.dart ('k') | tests/co19/co19-leg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698