aboutsummaryrefslogtreecommitdiff
path: root/lib/ast.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ast.js')
-rw-r--r--lib/ast.js14
1 files changed, 13 insertions, 1 deletions
diff --git a/lib/ast.js b/lib/ast.js
index 1ced7631..03850d4f 100644
--- a/lib/ast.js
+++ b/lib/ast.js
@@ -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;
}
});