Add Class and Function System with Lambda Captures#1
Add Class and Function System with Lambda Captures#1google-labs-jules[bot] wants to merge 1 commit intomasterfrom
Conversation
… and lambda captures. Refactored `ScriptIr.h` to use `Module` and `Function` structures for multi-function support. Updated `ScriptAst.h` to support `ClassStatement` and `NewExpression`. Implemented `OP_MakeClosure` and `OP_LoadCapture` for lambda support. Implemented `OP_New` for class instantiation. Updated `ScriptJit.h` interpreter to handle new opcodes and module structure.
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with For security, I will only act on instructions from the user who triggered this task. New to Jules? Learn more at jules.google/docs. |
This PR introduces a comprehensive update to the scripting language runtime and compiler to support:
Modulebased system that holds multipleFunctionobjects.classkeyword support, allowing definition of classes with methods and fields. ImplementedOP_Newto instantiate classes by creating objects and calling their constructors.OP_MakeClosureandOP_LoadCapture. The emitter now detects and resolves captures from parent scopes.ScriptJit.h(Interpreter) to execute the new bytecode format, manage stack frames for function calls and closures, and handle object creation.Key Changes:
ScriptIr.h: IntroducedModuleandFunctionstructs. UpdatedEmitterto work with functions and support capture resolution.ScriptAst.h: AddedClassStatement,NewExpression. UpdatedFunctionExpressionto emit closures.ScriptJit.h: RewroteInterpreterloop to supportModuleexecution,OP_Callfor closures, andOP_New.ScriptVariant.h: AddedClosurevariant type.PR created automatically by Jules for task 6205814732124054060 started by @telecomadm1145