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

Unified Diff: lib/compiler/implementation/ssa/closure.dart

Issue 10693123: Use better names for closures and static variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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 | « lib/compiler/implementation/namer.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/closure.dart
diff --git a/lib/compiler/implementation/ssa/closure.dart b/lib/compiler/implementation/ssa/closure.dart
index 743ef54a10dc7a980c7cbf8d094e80679454a5d2..f6f0e3da4b48afc2d79568715998960f1d10fbca 100644
--- a/lib/compiler/implementation/ssa/closure.dart
+++ b/lib/compiler/implementation/ssa/closure.dart
@@ -13,17 +13,20 @@ class ClosureFieldElement extends Element {
}
class ClosureClassElement extends ClassElement {
- ClosureClassElement(Compiler compiler, Element enclosingElement)
- : super(compiler.closureClass.name,
+ ClosureClassElement(SourceString name,
+ Compiler compiler,
+ Element enclosingElement)
+ : super(name,
enclosingElement,
// By assigning a fresh class-id we make sure that the hashcode
- // is unique, but also emit closure class after all other
+ // is unique, but also emit closure classes after all other
// classes (since the emitter sorts classes by their id).
compiler.getNextFreeClassId()) {
isResolved = true;
compiler.closureClass.ensureResolved(compiler);
supertype = compiler.closureClass.computeType(compiler);
}
+ bool isClosure() => true;
}
class BoxElement extends Element {
@@ -353,10 +356,11 @@ class ClosureTranslator extends AbstractVisitor {
scopeData.boxedLoopVariables = result;
}
- ClosureData globalizeClosure(FunctionExpression node) {
- FunctionElement element = elements[node];
- ClassElement globalizedElement =
- new ClosureClassElement(compiler, element.getCompilationUnit());
+ ClosureData globalizeClosure(FunctionExpression node, Element element) {
+ SourceString closureName =
+ new SourceString(compiler.namer.closureName(element));
+ ClassElement globalizedElement = new ClosureClassElement(
+ closureName, compiler, element.getCompilationUnit());
FunctionElement callElement =
new FunctionElement.from(compiler.namer.CLOSURE_INVOCATION_NAME,
element,
@@ -388,7 +392,7 @@ class ClosureTranslator extends AbstractVisitor {
insideClosure = isClosure;
currentFunctionElement = elements[node];
if (insideClosure) {
- closureData = globalizeClosure(node);
+ closureData = globalizeClosure(node, element);
} else {
Element thisElement = null;
// TODO(floitsch): we should not need to look for generative constructors.
« no previous file with comments | « lib/compiler/implementation/namer.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698