Move the idea of a symbol having a default value up the class chain.
This commit is contained in:
committed by
Richard van Velzen
parent
5b553aafe2
commit
7a8cffd631
20
lib/ast.js
20
lib/ast.js
@@ -1016,10 +1016,16 @@ var AST_SymbolAccessor = DEFNODE("SymbolAccessor", null, {
|
||||
$documentation: "The name of a property accessor (setter/getter function)"
|
||||
}, AST_Symbol);
|
||||
|
||||
var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init", {
|
||||
var AST_SymbolDeclaration = DEFNODE("SymbolDeclaration", "init default", {
|
||||
$documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
|
||||
$propdoc: {
|
||||
init: "[AST_Node*/S] array of initializers for this declaration."
|
||||
init: "[AST_Node*/S] array of initializers for this declaration.",
|
||||
default: "[AST_Expression] The default for this parameter. For example, `= 6`"
|
||||
},
|
||||
_walk: function (visitor) {
|
||||
return visitor._visit(this, function() {
|
||||
if (this.default) this.default._walk(visitor);
|
||||
});
|
||||
}
|
||||
}, AST_Symbol);
|
||||
|
||||
@@ -1031,16 +1037,8 @@ var AST_SymbolConst = DEFNODE("SymbolConst", null, {
|
||||
$documentation: "A constant declaration"
|
||||
}, AST_SymbolDeclaration);
|
||||
|
||||
var AST_SymbolFunarg = DEFNODE("SymbolFunarg", "default", {
|
||||
var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, {
|
||||
$documentation: "Symbol naming a function argument",
|
||||
$propdoc: {
|
||||
default: "[AST_Expression] The default for this parameter. For example, `= 6`"
|
||||
},
|
||||
_walk: function (visitor) {
|
||||
return visitor._visit(this, function() {
|
||||
if (this.default) this.default._walk(visitor);
|
||||
});
|
||||
}
|
||||
}, AST_SymbolVar);
|
||||
|
||||
var AST_SymbolDefun = DEFNODE("SymbolDefun", null, {
|
||||
|
||||
@@ -1288,7 +1288,7 @@ function OutputStream(options) {
|
||||
DEFPRINT(AST_Symbol, function (self, output) {
|
||||
self._do_print(output);
|
||||
});
|
||||
DEFPRINT(AST_SymbolFunarg, function(self, output){
|
||||
DEFPRINT(AST_SymbolDeclaration, function(self, output){
|
||||
self._do_print(output);
|
||||
if (self.default) {
|
||||
output.space();
|
||||
|
||||
Reference in New Issue
Block a user