summaryrefslogtreecommitdiff
path: root/py/scope.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-10-13 16:39:46 +0100
committerDamien George <damien.p.george@gmail.com>2016-04-18 15:09:34 +0100
commit61398ab45a2ef27ce44769b4259ee97b583f2978 (patch)
treef69060919c31a0e720f383470eb62d59fe8b9fb6 /py/scope.c
parent5bf649f37065ac0855f55f99496adb4cce63557d (diff)
py: Implement parse bytecode.
Diffstat (limited to 'py/scope.c')
-rw-r--r--py/scope.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/py/scope.c b/py/scope.c
index 632e52752..e40825173 100644
--- a/py/scope.c
+++ b/py/scope.c
@@ -30,7 +30,7 @@
#if MICROPY_ENABLE_COMPILER
-scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_uint_t emit_options) {
+scope_t *scope_new(scope_kind_t kind, const byte *pn, qstr source_file, mp_uint_t emit_options) {
scope_t *scope = m_new0(scope_t, 1);
scope->kind = kind;
scope->pn = pn;
@@ -41,8 +41,7 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_u
break;
case SCOPE_FUNCTION:
case SCOPE_CLASS:
- assert(MP_PARSE_NODE_IS_STRUCT(pn));
- scope->simple_name = MP_PARSE_NODE_LEAF_ARG(((mp_parse_node_struct_t*)pn)->nodes[0]);
+ pt_extract_id(pn, &scope->simple_name); // function name
break;
case SCOPE_LAMBDA:
scope->simple_name = MP_QSTR__lt_lambda_gt_;
@@ -62,7 +61,6 @@ scope_t *scope_new(scope_kind_t kind, mp_parse_node_t pn, qstr source_file, mp_u
default:
assert(0);
}
- scope->raw_code = mp_emit_glue_new_raw_code();
scope->emit_options = emit_options;
scope->id_info_alloc = MICROPY_ALLOC_SCOPE_ID_INIT;
scope->id_info = m_new(id_info_t, scope->id_info_alloc);