Commit 7be2e8a6
7be2e8a6c18fMerged
Yukihiro "Matz" Matsumoto <[email protected]> · 8 months ago · 5 files · +2 added · ~3 modified
Description
Add require_relative support for multi-file compilation
Parse required files at compile time, register their class/module/function definitions in the shared codegen context, and skip require_relative calls during code generation. The parser is swapped per-class so constant pool lookups use the correct file's parser throughout analysis and emission.
Co-Authored-By: Claude Opus 4.6 (1M context) [email protected]
Details
- Commit
- 7be2e8a6c18f
- Parent
- df20643c4ae5
examples/bm_require/lib/greeter.rbaddedView file
1+
class Greeter2+
def initialize(name)3+
@name = name4+
end5+
6+
def greet7+
"Hello, " + @name + "!"8+
end9+
endexamples/bm_require/main.rbaddedView file
Loading diff…
src/codegen.cmodifiedView file
Loading diff…
src/codegen.hmodifiedView file
Loading diff…
src/main.cmodifiedView file
Loading diff…