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

Unified Diff: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java

Issue 8479037: Provide enclosing element (method) for local function object, issue 145 (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 1 month 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
Index: compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
diff --git a/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java b/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
index 79fadd59d835ddd8afc9b328264b1f175de57f04..47f89893d824afce869c30d860de71fabb36b3ce 100644
--- a/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
+++ b/compiler/java/com/google/dart/compiler/backend/js/GenerateJavascriptAST.java
@@ -2478,7 +2478,9 @@ public class GenerateJavascriptAST {
mangledName = null;
qualifier = (JsExpression) generate(target);
EnclosingElement enclosingElement = element.getEnclosingElement();
- if ((kind == ElementKind.FUNCTION_OBJECT) && (element.getEnclosingElement() != null)) {
+ if (kind == ElementKind.FUNCTION_OBJECT
zundel 2011/11/07 19:26:53 nit. I would just move this into a separate FUNCT
+ && enclosingElement != null
+ && enclosingElement.getKind() == ElementKind.CLASS) {
// Function-object invocations can be made directly, unless they're closures (in which
// case their enclosing-element will be null).
method = (MethodElement) element;

Powered by Google App Engine
This is Rietveld 408576698