[Pkg-mozext-commits] [adblock-plus] 141/464: Fixed: Expression closures aren't decompiled correctly (function body needs to be a block)
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:11 UTC 2014
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository adblock-plus.
commit 0f1e9d5bb06964720162519a0cd400d947ab2b90
Author: Wladimir Palant <trev at adblockplus.org>
Date: Wed May 4 13:59:21 2011 +0200
Fixed: Expression closures aren't decompiled correctly (function body needs to be a block)
---
scripts/decompile.js | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/scripts/decompile.js b/scripts/decompile.js
index cf2d794..250ae2a 100644
--- a/scripts/decompile.js
+++ b/scripts/decompile.js
@@ -26,9 +26,19 @@ let visitor = {
unindent();
}
},
- _visitNeedBlock: function (stmt) {
- if (stmt.type == "EmptyStatement")
- output("{}").flush();
+ _visitNeedBlock: function (stmt, noFlush) {
+ if (stmt.type == "EmptyStatement") {
+ output("{}")
+ if (!noFlush)
+ flush();
+ }
+ else if (stmt.type == "ReturnStatement") {
+ output("{").flush().indent();
+ stmt.visit(this);
+ unindent().output("}");
+ if (!noFlush)
+ flush();
+ }
else
stmt.visit(this);
},
@@ -38,15 +48,7 @@ let visitor = {
if (func.name)
output(func.name);
this._visitArray(func.arguments, '(', ') ');
- if (func.body.type == "EmptyStatement")
- output("{ }");
- else if (func.body.type == "ReturnStatement") {
- output("{").flush().indent();
- func.body.visit(this);
- unindent().output("}");
- }
- else
- func.body.visit(this);
+ this._visitNeedBlock(func.body, true);
return true;
},
visitParameter: function (p) {
@@ -279,7 +281,7 @@ let visitor = {
output(" ").output(prop.value.name);
}
this._visitArray(prop.value.arguments, '(', ') ');
- this._visitNeedBlock(prop.value.body);
+ this._visitNeedBlock(prop.value.body, true);
return true;
}
prop.property.visit(this);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/adblock-plus.git
More information about the Pkg-mozext-commits
mailing list