summaryrefslogtreecommitdiffstatshomepage
path: root/py/parse.c
diff options
context:
space:
mode:
authorDamien <damien.p.george@gmail.com>2013-10-06 00:28:28 +0100
committerDamien <damien.p.george@gmail.com>2013-10-06 00:28:28 +0100
commitb14de21fc806d11e9af40d64da0f2cea953345f9 (patch)
tree01d9923429a0a4400c173fe7906c9e7d494f12f8 /py/parse.c
parenta2f2f7db1f42f9229df9d4f353689f24685e5dc4 (diff)
downloadmicropython-b14de21fc806d11e9af40d64da0f2cea953345f9.tar.gz
micropython-b14de21fc806d11e9af40d64da0f2cea953345f9.zip
Optimise typedargslist_name to not create a node if just an id.
Diffstat (limited to 'py/parse.c')
-rw-r--r--py/parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/py/parse.c b/py/parse.c
index ba41f749e9..5eb4b27dbf 100644
--- a/py/parse.c
+++ b/py/parse.c
@@ -414,7 +414,8 @@ py_parse_node_t py_parse(py_lexer_t *lex, int wanted_rule) {
// never emit these rules if they have only 1 argument
// NOTE: can't put atom_paren here because we need it to distinguisg, for example, [a,b] from [(a,b)]
- if (rule->rule_id == RULE_else_stmt || rule->rule_id == RULE_testlist_comp_3b || rule->rule_id == RULE_import_as_names_paren || rule->rule_id == RULE_typedargslist_colon || rule->rule_id == RULE_typedargslist_equal || rule->rule_id == RULE_dictorsetmaker_colon || rule->rule_id == RULE_classdef_2 || rule->rule_id == RULE_with_item_as || rule->rule_id == RULE_assert_stmt_extra || rule->rule_id == RULE_as_name || rule->rule_id == RULE_raise_stmt_from || rule->rule_id == RULE_vfpdef) {
+ // TODO possibly put varargslist_name, varargslist_equal here as well
+ if (rule->rule_id == RULE_else_stmt || rule->rule_id == RULE_testlist_comp_3b || rule->rule_id == RULE_import_as_names_paren || rule->rule_id == RULE_typedargslist_name || rule->rule_id == RULE_typedargslist_colon || rule->rule_id == RULE_typedargslist_equal || rule->rule_id == RULE_dictorsetmaker_colon || rule->rule_id == RULE_classdef_2 || rule->rule_id == RULE_with_item_as || rule->rule_id == RULE_assert_stmt_extra || rule->rule_id == RULE_as_name || rule->rule_id == RULE_raise_stmt_from || rule->rule_id == RULE_vfpdef) {
emit_rule = false;
}