}
}, AST_Scope);
+var AST_Accessor = DEFNODE("Accessor", null, {
+ $documentation: "A setter/getter function"
+}, AST_Lambda);
+
var AST_Function = DEFNODE("Function", null, {
$documentation: "A function expression"
}, AST_Lambda);
$documentation: "Base class for all symbols",
});
+var AST_SymbolAccessor = DEFNODE("SymbolAccessor", null, {
+ $documentation: "The name of a property accessor (setter/getter function)"
+}, AST_Symbol);
+
var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
$documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
$propdoc: {
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();
a.push(new AST_ObjectGetter({
start : start,
key : name,
- value : function_(false, AST_Lambda),
+ value : function_(false, AST_Accessor),
end : prev()
}));
continue;
a.push(new AST_ObjectSetter({
start : start,
key : name,
- value : function_(false, AST_Lambda),
+ value : function_(false, AST_Accessor),
end : prev()
}));
continue;
return this.definition().unmangleable(options);
});
+// property accessors are not mangleable
+AST_SymbolAccessor.DEFMETHOD("unmangleable", function(){
+ return true;
+});
+
// labels are always mangleable
AST_Label.DEFMETHOD("unmangleable", function(){
return false;
}
if (node instanceof AST_Scope) {
var p = tw.parent();
- var is_setget = p instanceof AST_ObjectSetter || p instanceof AST_ObjectGetter;
node.variables.each(function(symbol){
- if (!(is_setget && symbol instanceof AST_SymbolLambda)) {
- if (options.except.indexOf(symbol.name) < 0) {
- to_mangle.push(symbol);
- }
+ if (options.except.indexOf(symbol.name) < 0) {
+ to_mangle.push(symbol);
}
});
return;