Add delete statements

pull/70/head
Max Brunsfeld 2014-09-03 08:29:32 +07:00
parent cc80ba2ef6
commit 8fde482f20
2 changed files with 19 additions and 0 deletions

@ -33,6 +33,7 @@ module.exports = compiler.grammar
@return_statement,
@throw_statement,
@try_statement,
@delete_statement,
@var_declaration)
expression_statement: -> seq(
@ -102,6 +103,11 @@ module.exports = compiler.grammar
optional(@expression),
terminator())
delete_statement: -> seq(
keyword("delete"),
choice(@member_access, @subscript_access),
terminator())
var_declaration: -> seq(
keyword("var"),
commaSep1(err(choice(

@ -265,3 +265,16 @@ try { f; } catch { g; } finally { h; }
(statement_block (expression_statement (identifier))))
(finally
(statement_block (expression_statement (identifier))))))
============================================
Delete statements
============================================
delete thing.prop;
delete thing['prop'];
---
(program
(delete_statement (member_access (identifier) (identifier)))
(delete_statement (subscript_access (identifier) (string))))