diff options
author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-11-30 11:05:26 +0000 |
---|---|---|
committer | Matt Valentine-House <matt@eightbitraptor.com> | 2023-11-30 21:31:57 +0000 |
commit | 57782d3d47bcb52af0006ac75e75f3b3609b1d31 (patch) | |
tree | 1ba2ddd9c6c0ecfec1f7b557eb680ebd1616317d /prism_compile.h | |
parent | a1647c460f253cbf2c988f5f8bcf43bf23f576be (diff) | |
download | ruby-57782d3d47bcb52af0006ac75e75f3b3609b1d31.tar.gz |
Store depth offset inside the scope node.
Instead of incrementing the depth using call by reference as we're
recursing up the stack we could instead store an offset for each known
scope where we know the depth is going to represented differently in the
Prism ast.
Diffstat (limited to 'prism_compile.h')
-rw-r--r-- | prism_compile.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/prism_compile.h b/prism_compile.h index d307807b84..2d64811e69 100644 --- a/prism_compile.h +++ b/prism_compile.h @@ -13,6 +13,11 @@ typedef struct pm_scope_node { ID *constants; st_table *index_lookup_table; + + // Some locals are defined at higher scopes than they are used. We can use + // this offset to control which parent scopes local table we should be + // referencing from the current scope. + unsigned int local_depth_offset; } pm_scope_node_t; void pm_scope_node_init(const pm_node_t *node, pm_scope_node_t *scope, pm_scope_node_t *previous, pm_parser_t *parser); |