Closed Mr-Rm closed 2 weeks ago
The changes in this pull request involve modifications to the ClassBuilder
, ContextMethodAttribute
, and ContextMethodMapper
classes within the OneScript.Core and ScriptEngine libraries. Key updates include alterations to method constructors, specifically the handling of alias parameters and the introduction of new constructors for better error reporting. Additionally, the method for retrieving aliases has been simplified. These changes collectively enhance the clarity and functionality of the respective classes while maintaining their overall structure.
File Path | Change Summary |
---|---|
src/OneScript.Core/Contexts/ClassBuilder.cs | Modified ExportClassMethod(MethodInfo nativeMethod) to instantiate ContextMethodAttribute with an additional null alias parameter. |
src/OneScript.Core/Contexts/ContextMethodAttribute.cs | Updated ContextMethodAttribute constructor to require a non-null alias , added a new constructor overload, and simplified GetName and GetAlias methods. |
src/ScriptEngine/Machine/Contexts/ContextMethodMapper.cs | Changed CreateMetadata method to call GetAlias() without parameters, altering how method aliases are retrieved. |
sequenceDiagram
participant User
participant ClassBuilder
participant ContextMethodAttribute
participant ContextMethodMapper
User->>ClassBuilder: Call ExportClassMethod(nativeMethod)
ClassBuilder->>ContextMethodAttribute: Create instance with nativeMethod.Name, null
ContextMethodAttribute-->>ClassBuilder: Return instance
ClassBuilder-->>User: Return method export result
User->>ContextMethodMapper: Call CreateMetadata()
ContextMethodMapper->>ContextMethodAttribute: Call GetAlias()
ContextMethodAttribute-->>ContextMethodMapper: Return alias
ContextMethodMapper-->>User: Return metadata
🐇 "In the code where rabbits hop,
New aliases now will stop!
Constructors clear, methods bright,
Contexts dance in pure delight!
With each change, we do rejoice,
Hopping high, we lift our voice!" 🐇
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
Добрый день!
В период с 27.10.2024 по 10.11.2024 включительно, буду находиться в ежегодном отпуске. Почта просматриваться не будет.
Summary by CodeRabbit
New Features
ContextMethodAttribute
class constructor for invalid identifiers.ContextMethodAttribute
for improved flexibility.Bug Fixes
CreateMetadata
method for better accuracy.Refactor
ContextMethodAttribute
for cleaner code.