diff options
author | Matt Valentine-House <matt@eightbitraptor.com> | 2023-10-05 20:41:41 +0100 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2023-10-06 12:21:03 +0000 |
commit | 7db4ce13ed051bc422c5db594bb41edbaeb1ae35 (patch) | |
tree | beeea6a29e4a88fd696ef1ea106df57c872ce680 /prism/parser.h | |
parent | 723318f5d7a6475f69fc0d095a4149547b6050a3 (diff) | |
download | ruby-7db4ce13ed051bc422c5db594bb41edbaeb1ae35.tar.gz |
[ruby/prism] Introduce transparent scopes.
A transparent scope is a scope that cannot have local variables added to
it's local table. When a local is added to it's table, it instead gets
added to the first non-transparent parent scope.
This is used in for loops to ensure the correct depth for local
variables inside the body
https://github.com/ruby/prism/commit/ddb8e82253
Co-Authored-By: Kevin Newton <kddnewton@gmail.com>
Diffstat (limited to 'prism/parser.h')
-rw-r--r-- | prism/parser.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/prism/parser.h b/prism/parser.h index 0a5ba80819..0553e29819 100644 --- a/prism/parser.h +++ b/prism/parser.h @@ -293,6 +293,11 @@ typedef struct pm_scope { // This is necessary to determine if child blocks are allowed to use // numbered parameters. bool numbered_params; + + // A transparent scope is a scope that cannot have locals set on itself. + // When a local is set on this scope, it will instead be set on the parent + // scope's local table. + bool transparent; } pm_scope_t; // This struct represents the overall parser. It contains a reference to the |