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

Unified Diff: frog/leg/ssa/closure.dart

Issue 9666006: Support for "a is Function". (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « frog/leg/lib/js_helper.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: frog/leg/ssa/closure.dart
===================================================================
--- frog/leg/ssa/closure.dart (revision 5320)
+++ frog/leg/ssa/closure.dart (working copy)
@@ -12,6 +12,15 @@
String toString() => "ClosureFieldElement($name)";
}
+class ClosureClassElement extends ClassElement {
+ ClosureClassElement(Compiler compiler, Element enclosingElement)
+ : super(Compiler.CLOSURE, enclosingElement) {
+ isResolved = true;
+ compiler.closureClass.ensureResolved(compiler);
+ supertype = compiler.closureClass.computeType(compiler);
+ }
+}
+
// The box-element for a scope, and the captured variables that need to be
// stored in the box.
class ClosureScope {
@@ -292,20 +301,14 @@
ClosureData globalizeClosure(FunctionExpression node) {
FunctionElement element = elements[node];
- SourceString name = const SourceString("Closure");
- CompilationUnitElement compilationUnit = element.getCompilationUnit();
- ClassElement globalizedElement = new ClassElement(name, compilationUnit);
+ ClassElement globalizedElement =
+ new ClosureClassElement(compiler, element.getCompilationUnit());
FunctionElement callElement =
new FunctionElement.from(Namer.CLOSURE_INVOCATION_NAME,
element,
globalizedElement);
globalizedElement.backendMembers =
const EmptyLink<Element>().prepend(callElement);
- globalizedElement.isResolved = true;
- // TODO(karlklose): create function to get the resolved class object.
- ClassElement objectClass = compiler.coreLibrary.find(Types.OBJECT);
- globalizedElement.supertype = objectClass.computeType(compiler);
- objectClass.ensureResolved(compiler);
// The nested function's 'this' is the same as the one for the outer
// function. It could be [null] if we are inside a static method.
Element thisElement = closureData.thisElement;
« no previous file with comments | « frog/leg/lib/js_helper.dart ('k') | frog/leg/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698