Move the idea of a symbol having a default value up the class chain.

This commit is contained in:
Fábio Santos
2015-11-22 19:00:54 +00:00
committed by Richard van Velzen
parent 5b553aafe2
commit 7a8cffd631
2 changed files with 10 additions and 12 deletions

View File

@@ -1016,10 +1016,16 @@ var AST_SymbolAccessor = DEFNODE("SymbolAccessor", null, {
$documentation: "The name of a property accessor (setter/getter function)" $documentation: "The name of a property accessor (setter/getter function)"
}, AST_Symbol); }, 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)", $documentation: "A declaration symbol (symbol in var/const, function name or argument, symbol in catch)",
$propdoc: { $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); }, AST_Symbol);
@@ -1031,16 +1037,8 @@ var AST_SymbolConst = DEFNODE("SymbolConst", null, {
$documentation: "A constant declaration" $documentation: "A constant declaration"
}, AST_SymbolDeclaration); }, AST_SymbolDeclaration);
var AST_SymbolFunarg = DEFNODE("SymbolFunarg", "default", { var AST_SymbolFunarg = DEFNODE("SymbolFunarg", null, {
$documentation: "Symbol naming a function argument", $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); }, AST_SymbolVar);
var AST_SymbolDefun = DEFNODE("SymbolDefun", null, { var AST_SymbolDefun = DEFNODE("SymbolDefun", null, {

View File

@@ -1288,7 +1288,7 @@ function OutputStream(options) {
DEFPRINT(AST_Symbol, function (self, output) { DEFPRINT(AST_Symbol, function (self, output) {
self._do_print(output); self._do_print(output);
}); });
DEFPRINT(AST_SymbolFunarg, function(self, output){ DEFPRINT(AST_SymbolDeclaration, function(self, output){
self._do_print(output); self._do_print(output);
if (self.default) { if (self.default) {
output.space(); output.space();