Skip to content

native: запускается testrunner.os#1694

Open
Mr-Rm wants to merge 4 commits into
EvilBeaver:developfrom
Mr-Rm:v2/native-testrunner
Open

native: запускается testrunner.os#1694
Mr-Rm wants to merge 4 commits into
EvilBeaver:developfrom
Mr-Rm:v2/native-testrunner

Conversation

@Mr-Rm
Copy link
Copy Markdown
Collaborator

@Mr-Rm Mr-Rm commented Jun 1, 2026

Исправлены ошибки в native, не позволявшие скомпилировать и запустить test/testrunner.os

Summary by CodeRabbit

Release Notes

  • Refactor
    • Internal exception handling system refactored for improved consistency and flexibility.
    • Optimized runtime method compilation and instance context handling.
    • Streamlined internal type hierarchy by removing obsolete wrapper components.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 1, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 82bc8362-1b1c-4f8d-ba91-7aeb5eb41a35

📥 Commits

Reviewing files that changed from the base of the PR and between 109564d and 5cb3e74.

📒 Files selected for processing (7)
  • src/OneScript.Core/Exceptions/IExceptionInfoFactory.cs
  • src/OneScript.Native/Compiler/ExpressionHelpers.cs
  • src/OneScript.Native/Compiler/MethodCompiler.cs
  • src/OneScript.Native/Runtime/CallableMethod.cs
  • src/OneScript.Native/Runtime/DynamicOperations.cs
  • src/OneScript.Native/Runtime/NativeClassInstanceWrapper.cs
  • src/ScriptEngine/Machine/ExceptionInfoFactory.cs
💤 Files with no reviewable changes (1)
  • src/OneScript.Native/Runtime/NativeClassInstanceWrapper.cs

📝 Walkthrough

Walkthrough

The PR removes the NativeClassInstanceWrapper intermediate wrapper by refactoring both runtime and compiler layers to use IAttachableContext directly. It also generalizes exception info factory return types from BslObjectValue to BslValue across the exception-handling pipeline.

Changes

Wrapper Removal and Context Refactoring

Layer / File(s) Summary
Exception info contract generalization
src/OneScript.Core/Exceptions/IExceptionInfoFactory.cs, src/ScriptEngine/Machine/ExceptionInfoFactory.cs, src/OneScript.Native/Runtime/DynamicOperations.cs
Interface and implementations of exception-to-info conversion now return BslValue instead of BslObjectValue, widening the public contract to accept any BSL value rather than requiring a specific object type.
Runtime callable method context refactoring
src/OneScript.Native/Runtime/CallableMethod.cs
The NativeCallable delegate type, GetCallableWrapper method, and delegate expression-tree compilation are updated to use IAttachableContext directly as the instance "target" type instead of wrapping into NativeClassInstanceWrapper.
Compiler instance context refactoring
src/OneScript.Native/Compiler/MethodCompiler.cs, src/OneScript.Native/Compiler/ExpressionHelpers.cs
Instance method context parameter type changes from NativeClassInstanceWrapper to IAttachableContext. AccessModuleVariable now calls GetVariable directly on the context. ContextMethodInfo call results are conditionally cast to BslValue. Built-in Token.Type handling is refactored and exception description generation includes explicit IRuntimeContextInstance conversion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • EvilBeaver/OneScript#1494: Extends exception-info machinery (ExceptionInfoContext and ParametrizedRuntimeException) to support inner "cause" tracking within the same factory raising logic updated by this PR.

Poem

🐰 The wrapper's gone, now context shines direct,
No indirection veils the IAttachableContext,
Exception values grow more general and free,
From rigid objects to fluid BslValue spree! ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 6.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title 'native: запускается testrunner.os' is overly vague in English context, but in Russian it states the main outcome (testrunner.os now runs). However, it does not describe the actual technical changes made (removal of wrapper class, return type changes, context abstraction refactoring). Consider a more descriptive title that captures the core technical changes, such as 'native: refactor instance context handling and exception factory return types' or similar, which would better represent the substantial interface and implementation modifications.
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@Mr-Rm
Copy link
Copy Markdown
Collaborator Author

Mr-Rm commented Jun 1, 2026

Для запуска надо в oscript.cfg указать
runtime.default = native
Сами тесты запускать можно, но в них тоже есть препятствия для компиляции в native. WIP

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant