use AST_Lambda for object setters/getters
so that the optimization that drops the name if unused doesn't apply. close #12
This commit is contained in:
@@ -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
|
var name = is("name") ? as_symbol(in_statement
|
||||||
? AST_SymbolDefun
|
? AST_SymbolDefun
|
||||||
: AST_SymbolLambda) : null;
|
: AST_SymbolLambda) : null;
|
||||||
if (in_statement && !name)
|
if (in_statement && !name)
|
||||||
unexpected();
|
unexpected();
|
||||||
expect("(");
|
expect("(");
|
||||||
var ctor = in_statement ? AST_Defun : AST_Function;
|
if (!ctor) ctor = in_statement ? AST_Defun : AST_Function;
|
||||||
return new ctor({
|
return new ctor({
|
||||||
name: name,
|
name: name,
|
||||||
argnames: (function(first, a){
|
argnames: (function(first, a){
|
||||||
@@ -1158,7 +1158,7 @@ function parse($TEXT, options) {
|
|||||||
a.push(new AST_ObjectGetter({
|
a.push(new AST_ObjectGetter({
|
||||||
start : start,
|
start : start,
|
||||||
key : name,
|
key : name,
|
||||||
value : function_(false),
|
value : function_(false, AST_Lambda),
|
||||||
end : prev()
|
end : prev()
|
||||||
}));
|
}));
|
||||||
continue;
|
continue;
|
||||||
@@ -1167,7 +1167,7 @@ function parse($TEXT, options) {
|
|||||||
a.push(new AST_ObjectSetter({
|
a.push(new AST_ObjectSetter({
|
||||||
start : start,
|
start : start,
|
||||||
key : name,
|
key : name,
|
||||||
value : function_(false),
|
value : function_(false, AST_Lambda),
|
||||||
end : prev()
|
end : prev()
|
||||||
}));
|
}));
|
||||||
continue;
|
continue;
|
||||||
|
|||||||
Reference in New Issue
Block a user