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

Side by Side Diff: dart/lib/compiler/implementation/ssa/closure.dart

Issue 10855125: Ensure supertypes are loaded safely. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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) 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;
11 11
12 String toString() => "ClosureFieldElement($name)"; 12 String toString() => "ClosureFieldElement($name)";
13 } 13 }
14 14
15 class ClosureClassElement extends ClassElement { 15 class ClosureClassElement extends ClassElement {
16 ClosureClassElement(SourceString name, 16 ClosureClassElement(SourceString name,
17 Compiler compiler, 17 Compiler compiler,
18 Element enclosingElement) 18 Element enclosingElement)
19 : super(name, 19 : super(name,
20 enclosingElement, 20 enclosingElement,
21 // By assigning a fresh class-id we make sure that the hashcode 21 // By assigning a fresh class-id we make sure that the hashcode
22 // is unique, but also emit closure classes after all other 22 // is unique, but also emit closure classes after all other
23 // classes (since the emitter sorts classes by their id). 23 // classes (since the emitter sorts classes by their id).
24 compiler.getNextFreeClassId()) { 24 compiler.getNextFreeClassId()) {
25 isResolved = true; 25 supertypeLoadState = ClassElement.STATE_STARTED;
26 supertypeLoadState = ClassElement.STATE_DONE;
Lasse Reichstein Nielsen 2012/08/13 13:34:48 Wut? This needs a comment!
ahe 2012/08/13 15:14:01 You're right, I actually kept saying to myself tha
27 resolutionState = ClassElement.STATE_STARTED;
28 resolutionState = ClassElement.STATE_DONE;
26 compiler.closureClass.ensureResolved(compiler); 29 compiler.closureClass.ensureResolved(compiler);
27 supertype = compiler.closureClass.computeType(compiler); 30 supertype = compiler.closureClass.computeType(compiler);
31 interfaces = const EmptyLink<Type>();
28 } 32 }
29 bool isClosure() => true; 33 bool isClosure() => true;
30 } 34 }
31 35
32 class BoxElement extends Element { 36 class BoxElement extends Element {
33 BoxElement(SourceString name, Element enclosingElement) 37 BoxElement(SourceString name, Element enclosingElement)
34 : super(name, ElementKind.VARIABLE, enclosingElement); 38 : super(name, ElementKind.VARIABLE, enclosingElement);
35 } 39 }
36 40
37 class ThisElement extends Element { 41 class ThisElement extends Element {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 468 }
465 469
466 visitTryStatement(TryStatement node) { 470 visitTryStatement(TryStatement node) {
467 // TODO(ngeoffray): implement finer grain state. 471 // TODO(ngeoffray): implement finer grain state.
468 bool oldInTryStatement = inTryStatement; 472 bool oldInTryStatement = inTryStatement;
469 inTryStatement = true; 473 inTryStatement = true;
470 node.visitChildren(this); 474 node.visitChildren(this);
471 inTryStatement = oldInTryStatement; 475 inTryStatement = oldInTryStatement;
472 } 476 }
473 } 477 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698