diff options
Diffstat (limited to 'lib/ast.js')
-rw-r--r-- | lib/ast.js | 14 |
1 files changed, 13 insertions, 1 deletions
@@ -376,7 +376,7 @@ var AST_Toplevel = DEFNODE("Toplevel", "globals", { } }, AST_Scope); -var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments", { +var AST_Lambda = DEFNODE("Lambda", "name argnames uses_arguments length_read", { $documentation: "Base class for functions", $propdoc: { name: "[AST_SymbolDeclaration?] the name of this function", @@ -614,6 +614,18 @@ var AST_PropAccess = DEFNODE("PropAccess", "expression property", { $propdoc: { expression: "[AST_Node] the “container” expression", property: "[AST_Node|string] the property to access. For AST_Dot this is always a plain string, while for AST_Sub it's an arbitrary AST_Node" + }, + getProperty: function() { + var p = this.property; + if (p instanceof AST_Constant) { + return p.getValue(); + } + if (p instanceof AST_UnaryPrefix + && p.operator == "void" + && p.expression instanceof AST_Constant) { + return; + } + return p; } }); |