Execution frame. More...
#include <frame.hpp>
Public Member Functions | |
| void | add (const scope &existing) |
| Adds an existing scope to the frame's scope chain. | |
| void | add (const scope *it) BY_SIDE_FUNC(add) |
| void | add (const nbicontainer &existing) |
| void | add (const nbicontainer *it) BY_SIDE_FUNC(add) |
| void | add (const node &owner) |
| void | add (const node *it) BY_SIDE_FUNC(add) |
| virtual void | add (const node *owner, const scope &s) |
| Adds a scope associated with a specific owner node to the frame's scope chain. | |
| void | add (const node *owner, const scope *s) BY_SIDE_FUNC(s |
| void | add (owner, *s) |
| void | void ()) |
| virtual void | addLocal (const std::string &name, const node &n) |
| Adds a local symbol to the innermost local scope of the current frame. | |
| void | addLocal (const std::string *name, const node &n) BY_SIDE_FUNC(name |
| void addLocal | void ()) |
| void | addLocal (const std::string &name, const node *n) BY_SIDE_FUNC(n |
| void | addLocal (name, *n) |
| void | void ()) |
| void | addLocal (const std::string *name, const node *n) BY_SIDE_FUNC(name &&n |
| void addLocal | void ()) |
| void | addLocal (const nchar *name, const node &n) BY_SIDE_FUNC(name |
| void | addLocal (std::string(name), n) |
| void | void ()) |
| void | addLocal (const nchar *name, const node *n) BY_SIDE_FUNC(name &&n |
| void | addLocal (std::string(name), *n) |
| void | void ()) |
| virtual void | del () |
| Deletes the top-most scope from the frame's scope chain. | |
| virtual nbool | setMe (const node &obj) |
| Sets the "me" object (context) for the current frame. | |
| nbool | setMe (const node *it) BY_SIDE_FUNC(setMe) |
| void | setMe () |
| const node * | getMe () const BY_CONST_FUNC(getMe()) node *getMe() |
| scope * | getLocals () |
| const scope * | getLocals () const BY_CONST_FUNC(getLocals()) virtual nbool addFunc(const baseFunc &new 1) |
| Adds a function to the current frame. | |
| nbool | addFunc (const baseFunc *it) BY_SIDE_FUNC(addFunc) |
| void | delFunc () |
| Deletes the function associated with the current frame. | |
| baseFunc * | getFunc () |
| const baseFunc * | getFunc () const BY_CONST_FUNC(getFunc()) node *getMeHaving(const node &sub) |
| Finds the "me" object (owner) within the frame that contains the specified sub-node. | |
| node * | getMeHaving (const node *it) BY_SIDE_FUNC(getMeHaving) |
| const node * | getMeHaving (const node &sub) const BY_CONST_FUNC(getMeHaving(sub)) const node *getMeHaving(const node *sub) const BY_CONST_FUNC(getMeHaving(sub)) scope *getScopeHaving(const node &sub) |
| Finds the scope within the frame that contains the specified sub-node. | |
| scope * | getScopeHaving (const node *it) BY_SIDE_FUNC(getScopeHaving) |
| tstr< nbicontainer > | mySubs () const override |
| priorType | prioritize (const args &a) const override |
| str | eval (const args &a) override |
| void | rel () override |
| const std::vector< scopeRegister > & | getScopeRegisters () const |
| virtual nbool | setRet (const node &newRet) const |
| Sets the return value for the current frame. | |
| virtual nbool | setRet (const node *it) const |
| node * | getRet () const |
| void | dump () const override |
Public Member Functions inherited from by::node | |
| me & | operator[] (const std::string &name) |
| const me & | operator[] (const std::string &name) const BY_CONST_FUNC(operator[](name)) |
| me & | operator[] (const std::string *it) |
| const me & | operator[] (const std::string *it) const BY_CONST_FUNC(operator[](it)) |
| me & | operator[] (const nchar *name) |
| const me & | operator[] (const nchar *name) const BY_CONST_FUNC(operator[](name)) |
| nbool | in (const node &elem) const |
| nbool | in (const node *elem) const |
| virtual scope & | subs ()=0 |
| const scope & | subs () const BY_CONST_FUNC(subs()) virtual tstr< nbicontainer > mySubs() const |
| Returns a tstr to a container of immediate sub-nodes (excluding inherited or chained ones). | |
| const node * | promote (const node &it) const |
| const node * | promote (const node *it) const BY_SIDE_FUNC(promote) |
| template<typename T > | |
| T * | sub (std::function< nbool(const std::string &, const T &)> l) |
| template<typename T > | |
| const T * | sub (std::function< nbool(const std::string &, const T &)> l) const BY_CONST_FUNC(sub< T >(l)) template< typename T |
| template<typename T = me> | |
| const T * | sub () const BY_CONST_FUNC(sub< T >()) template< typename T |
| template<typename T = me> | |
| T * | sub (const std::string *it) BY_SIDE_FUNC(sub) |
| template<typename T = me> | |
| const T * | sub (const std::string &name) const BY_CONST_FUNC(sub< T >(name)) template< typename T |
| template<typename T = me> | |
| T * | sub (const std::string *name, const args &a) BY_SIDE_FUNC(name |
| template<typename T = me> | |
| const T * | sub (const std::string &name, const args &a) const BY_CONST_FUNC(sub< T >(name |
| template<typename T = me> | |
| const T a const T * | sub (const std::string *name, const args &a) const BY_CONST_FUNC(sub< T >(name |
| template<typename T > | |
| const T a const T a tnarr< T, strTactic > | subAll (std::function< nbool(const std::string &, const T &)> l) const |
| template<typename T = me> | |
| tnarr< T, strTactic > | subAll () const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string &name) const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *it) const BY_SIDE_FUNC(subAll< T >) template< typename T |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string &name, const args &a) const |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *name, const args *a) const BY_SIDE_FUNC(name |
| tpriorities< T > subAll< T > | tpriorities ()) |
| template<typename T = me> | |
| tpriorities< T > | subAll (const std::string *name, const args &a) const BY_SIDE_FUNC(name |
| tpriorities< T > subAll< T > | tpriorities ()) |
| bool | canEval (const args &a) const |
| priorType | prioritize (const args *it) const BY_SIDE_FUNC(it |
| str | eval (const args *it) BY_SIDE_FUNC(eval) |
| str | eval (const std::string &name, const args &a) |
| str | eval (const std::string &name, const args *a) BY_SIDE_FUNC(a |
| str | eval (name, a) |
| str | str ()) |
| str | eval (const std::string *name, const args &a) BY_SIDE_FUNC(name |
| str eval | str ()) |
| str | eval (const std::string *name, const args *a) BY_SIDE_FUNC(name &&a |
| str eval | str ()) |
| str | eval (const std::string &name) |
| str | eval (const std::string *it) BY_SIDE_FUNC(eval) |
| str | eval () |
| template<typename T > | |
| nbool | is () const |
| nbool | is (const typeProvidable &to) const |
| nbool | is (const typeProvidable *it) const BY_SIDE_FUNC(is) |
| nbool | is (const type &to) const |
| nbool | is (const type *it) const BY_SIDE_FUNC(is) |
| template<typename T > | |
| tstr< T > | as () const |
| str | as (const typeProvidable &to) const |
| str | as (const typeProvidable *it) const BY_SIDE_FUNC(as) |
| str | as (const type &to) const |
| str | as (const type *it) const BY_SIDE_FUNC(as) |
| template<typename T > | |
| nbool | isImpli () const |
| virtual nbool | isImpli (const type &to) const |
| nbool | isImpli (const typeProvidable &to) const |
| nbool | isImpli (const typeProvidable *it) const BY_SIDE_FUNC(isImpli) |
| template<typename T > | |
| tstr< T > | asImpli () const |
| virtual str | asImpli (const type &to) const |
| str | asImpli (const typeProvidable &to) const |
| str | asImpli (const typeProvidable *it) const BY_SIDE_FUNC(asImpli) |
| virtual const src & | getSrc () const |
| virtual nbool | isComplete () const |
| virtual str | infer () const |
| virtual void | accept (const visitInfo &i, visitor &v) |
| void | inFrame (const bicontainable *args) const override |
| void | outFrame () const override |
| virtual const modifier & | getModifier () const |
| virtual void | inFrame (const bicontainable *args) const=0 |
| void | inFrame () const |
| virtual void | outFrame () const=0 |
Public Member Functions inherited from by::frameInteractable | |
| void | inFrame () const |
Public Attributes | |
| void addLocal | name |
| const scope *getScopeHaving(const node &sub) const BY_CONST_FUNC(getScopeHaving(sub)) const scope *getScopeHaving(const node *sub) const BY_CONST_FUNC(getScopeHaving(sub)) using node scope | subs )() override |
Public Attributes inherited from by::node | |
| T sub | name |
| T sub | nullptr |
| tpriorities< T > subAll< T > | name |
| priorType prioritize | it |
| priorType prioritize | NO_MATCH |
| str eval | name |
Additional Inherited Members | |
Protected Member Functions inherited from by::node | |
| virtual str | _onEvalSub (node &sub, const args &a) |
| Protected virtual method for evaluating a sub-node. | |
| virtual void | _setSrc (const src &s) |
| void | _setSrc (const src *it) BY_SIDE_FUNC(_setSrc) |
Execution frame.
A class that manages accessible symbols in the currently executing code block. Provides symbol lists in an optimized way by dynamically chaining multiple scopes. You should know scope and tnchain in advance.
When baseFunc is eval()ed, baseFunc calls inFrame() using frameInteract for scope owners obj, this, and blockExpr respectively. Each class's inFrame() operates by appropriately add()ing its owned scope to the frame.
baseFunc is the starting point that triggers all these frameInteracts. It calls in order: obj, func, blockExpr. baseObj creates a new frame object, adds it to frames, and places its subs() and me reference. obj adds its current file's scope in addition to baseObj's behavior. (pod scope is also added along with this.) func registers its scope subs() to the frame and adds args to the frame. blockExpr creates an empty scope to use as local scope.
Through the above process, when func is eval()ed, the new frame object has at least 5 scopes registered.
Looking only at the scope section above, you might misunderstand that "frame has an array of scopes". Since frame inherits from node, it provides subs(). subs() returns only the scope type rather than an array like vector<scope>, so it returns a scope object with multiple scopes linked together. When accessing to find symbols, you can write code concisely as if traversing a single container from the start, rather than having multiple scopes connected. This is possible because scope is implemented with tnchain.
Adds a scope associated with a specific owner node to the frame's scope chain.
This is typically used to add object scopes or function scopes where the owner provides context.
| owner | The node that "owns" the scope being added (e.g., an obj or baseFunc instance). |
| s | The scope to add, associated with the owner. |
Adds an existing scope to the frame's scope chain.
| existing | don't need to cloneChain() before passing this func. |
This integrates the provided scope into the current frame's lookup hierarchy.
| existing | The scope to add. |
Adds a local symbol to the innermost local scope of the current frame.
This method is used to define variables or functions that are accessible only within the current execution context's most specific local scope.
| name | The name of the local symbol. |
| n | The node representing the local symbol (e.g., a variable or function). |
|
virtual |
Deletes the top-most scope from the frame's scope chain.
This method is typically called when exiting a block or function scope, removing the local symbols associated with that scope from the frame.
| void by::frame::delFunc | ( | ) |
Deletes the function associated with the current frame.
This typically refers to the function that was most recently added or is currently active within this frame's context.
Finds the "me" object (owner) within the frame that contains the specified sub-node.
| sub | The sub-node to search for. |
Adds a function to the current frame.
This function becomes the "current" function for this frame, allowing its context to be used for symbol resolution or evaluation.
| new1 | The baseFunc object to add. |
Finds the scope within the frame that contains the specified sub-node.
| sub | The sub-node to search for. |
|
overridevirtual |
Sets the "me" object (context) for the current frame.
The "me" object typically represents the instance on which a method is being invoked or the current object context.
| obj | The node representing the "me" object. |
Sets the return value for the current frame.
This method is typically used to store the result of a function or block execution within the frame. The method is const because the _ret member is mutable, allowing the return value to be set even for const frame instances.
| newRet | The node representing the return value. |