Skip to content

fix #1699: алиас ThisObject для ЭтотОбъект#1700

Merged
EvilBeaver merged 1 commit into
EvilBeaver:developfrom
Mr-Rm:v2/fix-1699
Jun 5, 2026
Merged

fix #1699: алиас ThisObject для ЭтотОбъект#1700
EvilBeaver merged 1 commit into
EvilBeaver:developfrom
Mr-Rm:v2/fix-1699

Conversation

@Mr-Rm
Copy link
Copy Markdown
Collaborator

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

Возможность добавлять алиасы для локальных переменных модуля

Summary by CodeRabbit

  • Refactor
    • Improved field alias handling to ensure module fields properly track and manage alias values.
    • Enhanced consistency in compile-time symbol generation for object properties.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jun 5, 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: 123dfe63-0002-4069-9abb-b807a5dd978d

📥 Commits

Reviewing files that changed from the base of the PR and between 01167fe and 985230b.

📒 Files selected for processing (3)
  • src/OneScript.Core/Contexts/BslFieldInfo.cs
  • src/OneScript.Core/Contexts/BslScriptFieldInfo.cs
  • src/ScriptEngine/Machine/Contexts/ThisAwareScriptedObjectBase.cs

📝 Walkthrough

Walkthrough

This PR makes the Alias property abstract in BslFieldInfo, forcing subclasses to provide their own implementation. BslScriptFieldInfo adds backing storage via an internal _alias field that persists alias values through the SetAlias method. A separate change ensures the ThisObject symbol uses a constant index rather than a magic number for consistency.

Changes

Field metadata and context property handling

Layer / File(s) Summary
Abstract Alias contract
src/OneScript.Core/Contexts/BslFieldInfo.cs
Alias property becomes abstract, requiring derived classes to implement alias value provision instead of defaulting to null.
Alias field storage and implementation
src/OneScript.Core/Contexts/BslScriptFieldInfo.cs
Constructor initializes _alias field, Alias override returns stored _alias value, and SetAlias assigns incoming alias to the backing field.
Symbol index constant alignment
src/ScriptEngine/Machine/Contexts/ThisAwareScriptedObjectBase.cs
ThisObject symbol dispatching index uses THISOBJ_VARIABLE_INDEX constant instead of hardcoded 0.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A field needs a name, now written in stone—
abstract decrees what must be shown.
Constants replace the magic numbers,
each alias stored, no longer slumbers.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly addresses the main change: making the Alias property abstract in BslFieldInfo and implementing alias support in BslScriptFieldInfo, which enables adding aliases for module local variables like the ThisObject/ЭтотОбъект aliasing described in the objectives.
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.

@EvilBeaver EvilBeaver merged commit 3ec14c9 into EvilBeaver:develop Jun 5, 2026
2 checks passed
@Mr-Rm Mr-Rm deleted the v2/fix-1699 branch June 5, 2026 13:02
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.

2 participants