Commit 5fe7cb97
5fe7cb979ccaMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 7 files · +2 added · ~5 modified
Description
Merge pull request #1430 from ryanseys/rs-c-class-eval-reopen
feat(class): reopen a class via Klass.class_eval/module_eval
Details
- Commit
- 5fe7cb979cca
- Parent
- 35a20a7e458e
- Merge parent
- 9ccdbe27e8f7
src/analyze_internal.hmodifiedView file
@@ -56,6 +56,12 @@
5656
/* Class index of the class/module body currently being analyzed (set around5757
ClassNode/ModuleNode body traversal). -1 outside any class body. */5858
extern int g_cbody_class_id;59+
/* Like g_cbody_class_id, but cleared when descending into a method/block scope:60+
the class index only while walking a class/module body's *direct* statements,61+
where `self` is the class object. -1 inside method bodies and at top level.62+
Mirrors codegen's g_class_body_id so a self/bare `class_eval` reopen is63+
recognized identically by analyze and codegen. */64+
extern int g_cbody_direct;5965
6066
/* Scan a subtree for BreakNode values and return their unified type.6167
Stops at DefNode/BlockNode boundaries (inner blocks have their own break scope). */src/analyze_scope.cmodifiedView file
Loading diff…
src/analyze_util.cmodifiedView file
Loading diff…
src/codegen_stmt.cmodifiedView file
Loading diff…
src/compiler.hmodifiedView file
Loading diff…
test/class_eval_reopen.rbaddedView file
Loading diff…
test/class_eval_reopen.rb.expectedaddedView file
Loading diff…