diff options
author | Mihai Bazon <mihai@bazon.net> | 2012-10-12 10:11:01 +0300 |
---|---|---|
committer | Mihai Bazon <mihai@bazon.net> | 2012-10-12 10:11:01 +0300 |
commit | fc39553714ab747339c11173e11ca95aaea1ed0c (patch) | |
tree | 9d388d9bac57124510d488fc0b505f33272aa154 /lib/parse.js | |
parent | d9d67317b1283886b24fec9a4c6607bf729a5e59 (diff) | |
download | tracifyjs-fc39553714ab747339c11173e11ca95aaea1ed0c.tar.gz tracifyjs-fc39553714ab747339c11173e11ca95aaea1ed0c.zip |
use AST_Lambda for object setters/getters
so that the optimization that drops the name if unused doesn't apply.
close #12
Diffstat (limited to 'lib/parse.js')
-rw-r--r-- | lib/parse.js | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/parse.js b/lib/parse.js index a87e868d..662e6dc8 100644 --- a/lib/parse.js +++ b/lib/parse.js @@ -880,14 +880,14 @@ function parse($TEXT, options) { }); }; - var function_ = function(in_statement) { + var function_ = function(in_statement, ctor) { var name = is("name") ? as_symbol(in_statement ? AST_SymbolDefun : AST_SymbolLambda) : null; if (in_statement && !name) unexpected(); expect("("); - var ctor = in_statement ? AST_Defun : AST_Function; + if (!ctor) ctor = in_statement ? AST_Defun : AST_Function; return new ctor({ name: name, argnames: (function(first, a){ @@ -1158,7 +1158,7 @@ function parse($TEXT, options) { a.push(new AST_ObjectGetter({ start : start, key : name, - value : function_(false), + value : function_(false, AST_Lambda), end : prev() })); continue; @@ -1167,7 +1167,7 @@ function parse($TEXT, options) { a.push(new AST_ObjectSetter({ start : start, key : name, - value : function_(false), + value : function_(false, AST_Lambda), end : prev() })); continue; |