add AST_Accessor and AST_SymbolAccessor node types

AST_Accessor will represent the function for a setter or getter.  Since they
are not mangleable, and they should not introduce a name in scope, we have a
new node for their name (AST_SymbolAccessor) which doesn't inherit from
AST_SymbolDeclaration.

fix #37
This commit is contained in:
Mihai Bazon
2012-11-07 12:43:27 +02:00
parent a1ae0c8609
commit 5276a4a873
3 changed files with 19 additions and 7 deletions

View File

@@ -883,6 +883,8 @@ function parse($TEXT, options) {
var function_ = function(in_statement, ctor) {
var name = is("name") ? as_symbol(in_statement
? AST_SymbolDefun
: ctor === AST_Accessor
? AST_SymbolAccessor
: AST_SymbolLambda) : null;
if (in_statement && !name)
unexpected();
@@ -1158,7 +1160,7 @@ function parse($TEXT, options) {
a.push(new AST_ObjectGetter({
start : start,
key : name,
value : function_(false, AST_Lambda),
value : function_(false, AST_Accessor),
end : prev()
}));
continue;
@@ -1167,7 +1169,7 @@ function parse($TEXT, options) {
a.push(new AST_ObjectSetter({
start : start,
key : name,
value : function_(false, AST_Lambda),
value : function_(false, AST_Accessor),
end : prev()
}));
continue;