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

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: More cleanup of ClassElement.cloneMembersTo 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 // We assign twice to [supertypeLoadState] as it contains asserts
26 // which enforce certain sequence of transitions.
27 supertypeLoadState = ClassElement.STATE_STARTED;
28 supertypeLoadState = ClassElement.STATE_DONE;
29 // Same as for [supertypeLoadState] above.
30 resolutionState = ClassElement.STATE_STARTED;
31 resolutionState = ClassElement.STATE_DONE;
26 compiler.closureClass.ensureResolved(compiler); 32 compiler.closureClass.ensureResolved(compiler);
27 supertype = compiler.closureClass.computeType(compiler); 33 supertype = compiler.closureClass.computeType(compiler);
34 interfaces = const EmptyLink<Type>();
28 } 35 }
29 bool isClosure() => true; 36 bool isClosure() => true;
30 } 37 }
31 38
32 class BoxElement extends Element { 39 class BoxElement extends Element {
33 BoxElement(SourceString name, Element enclosingElement) 40 BoxElement(SourceString name, Element enclosingElement)
34 : super(name, ElementKind.VARIABLE, enclosingElement); 41 : super(name, ElementKind.VARIABLE, enclosingElement);
35 } 42 }
36 43
37 class ThisElement extends Element { 44 class ThisElement extends Element {
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
464 } 471 }
465 472
466 visitTryStatement(TryStatement node) { 473 visitTryStatement(TryStatement node) {
467 // TODO(ngeoffray): implement finer grain state. 474 // TODO(ngeoffray): implement finer grain state.
468 bool oldInTryStatement = inTryStatement; 475 bool oldInTryStatement = inTryStatement;
469 inTryStatement = true; 476 inTryStatement = true;
470 node.visitChildren(this); 477 node.visitChildren(this);
471 inTryStatement = oldInTryStatement; 478 inTryStatement = oldInTryStatement;
472 } 479 }
473 } 480 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698