From 5335942b599d85263d3c18eb99ff5ebd04a8bc98 Mon Sep 17 00:00:00 2001 From: Damien George Date: Tue, 18 Apr 2017 22:52:18 +1000 Subject: py/compile: Refactor handling of special super() call. This patch refactors the handling of the special super() call within the compiler. It removes the need for a global (to the compiler) state variable which keeps track of whether the subject of an expression is super. The handling of super() is now done entirely within one function, which makes the compiler a bit cleaner and allows to easily add more optimisations to super calls. Changes to the code size are: bare-arm: +12 minimal: +0 unix x64: +48 unix nanbox: -16 stmhal: +4 cc3200: +0 esp8266: -56 --- py/grammar.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'py/grammar.h') diff --git a/py/grammar.h b/py/grammar.h index e8041c0e0..930d96dc1 100644 --- a/py/grammar.h +++ b/py/grammar.h @@ -261,7 +261,7 @@ DEF_RULE(atom_expr_await, c(atom_expr_await), and(3), tok(KW_AWAIT), rule(atom), DEF_RULE_NC(atom_expr, or(1), rule(atom_expr_normal)) #endif DEF_RULE(atom_expr_normal, c(atom_expr_normal), and_ident(2), rule(atom), opt_rule(atom_expr_trailers)) -DEF_RULE(atom_expr_trailers, c(atom_expr_trailers), one_or_more, rule(trailer)) +DEF_RULE_NC(atom_expr_trailers, one_or_more, rule(trailer)) DEF_RULE_NC(power_dbl_star, and_ident(2), tok(OP_DBL_STAR), rule(factor)) // atom: '(' [yield_expr|testlist_comp] ')' | '[' [testlist_comp] ']' | '{' [dictorsetmaker] '}' | NAME | NUMBER | STRING+ | '...' | 'None' | 'True' | 'False' -- cgit v1.2.3