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

Unified Diff: lib/src/js/nodes.dart

Issue 1341963003: qualify core types: Object, Error, Symbol (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 3 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
Index: lib/src/js/nodes.dart
diff --git a/lib/src/js/nodes.dart b/lib/src/js/nodes.dart
index 2f32feb0cfd8faa544e98ce718c8b92ea127956e..87ec7e1e074113cbc86dafed88399ef8675173c4 100644
--- a/lib/src/js/nodes.dart
+++ b/lib/src/js/nodes.dart
@@ -991,9 +991,18 @@ class This extends Expression {
final _thisFinder = new _ThisFinder();
class _ThisFinder extends BaseVisitor {
+ int nested = 0;
bool found = false;
visitThis(This node) {
- found = true;
+ if (nested <= 1) found = true;
+ }
+ visitFunctionExpression(FunctionExpression node) {
ochafik 2015/09/15 18:05:17 Does FunctionExpression include arrow functions? (
+ for (var param in node.params) {
+ param.accept(this);
+ }
+ ++nested;
+ node.body.accept(this);
+ --nested;
}
visitNode(Node node) {
if (!found) super.visitNode(node);
@@ -1030,6 +1039,11 @@ class NamedFunction extends Expression {
abstract class FunctionExpression extends Expression {
List<Parameter> get params;
get body; // Expression or block
+
+ void visitChildren(NodeVisitor visitor) {
+ for (Parameter param in params) param.accept(visitor);
+ body.accept(visitor);
+ }
}
class Fun extends FunctionExpression {
@@ -1045,11 +1059,6 @@ class Fun extends FunctionExpression {
accept(NodeVisitor visitor) => visitor.visitFun(this);
- void visitChildren(NodeVisitor visitor) {
- for (Parameter param in params) param.accept(visitor);
- body.accept(visitor);
- }
-
Fun _clone() => new Fun(params, body,
isGenerator: isGenerator, asyncModifier: asyncModifier);
@@ -1066,10 +1075,6 @@ class ArrowFun extends FunctionExpression {
accept(NodeVisitor visitor) => visitor.visitArrowFun(this);
- void visitChildren(NodeVisitor visitor) {
- for (Parameter param in params) param.accept(visitor);
- body.accept(visitor);
- }
/// True if this function actually closes of `this`. We use this in some
/// situations to generate different code.
bool get closesOverThis {

Powered by Google App Engine
This is Rietveld 408576698