[Pkg-mozext-commits] [adblock-plus] 47/464: make_function now works with lambda functions.
David Prévot
taffit at moszumanska.debian.org
Tue Jul 22 20:44:01 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 8c77268c99d5e68990a0fe1382690a90d2721416
Author: Joshua Cranmer <Pidgeot18 at gmail.com>
Date: Sat Aug 8 14:03:33 2009 -0400
make_function now works with lambda functions.
This is by wrapping with a TOK_LC node; you can tell it's fake because fakeNode is true.
---
utils/cleanast.js | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/utils/cleanast.js b/utils/cleanast.js
index 5e91276..be7d5af 100644
--- a/utils/cleanast.js
+++ b/utils/cleanast.js
@@ -225,6 +225,14 @@ function make_function(func_root) {
stmts = stmts.kids[0];
if (stmts.type == TOK_ARGSBODY)
stmts = stmts.kids[stmts.kids.length - 1];
+ if (stmts.type == TOK_RETURN) {
+ // This is a lambda function. For simplicity's sake, I'm going to turn this
+ // into a regular function by wrapping with TOK_LC (consumers of functions
+ // will find this easier to use)
+ let newtop = { fakeNode: true, line: stmts.line, col: stmts.col,
+ type: TOK_LC, op: JSOP_NOP, kids: [stmts]};
+ stmts = newtop;
+ }
assert(stmts.type == TOK_LC);
return { name: func_root.name, body: stmts, loc: get_location(func_root)};
}
--
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