You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
результат Делегата при вызове процедуры +тест - #1809
Исправляет падение по NRE при использовании результата вызова Процедуры через Делегат:
ПроцедураТестоваяПроцедура() ЭкспортКонецПроцедурыДействие=Новый Действие(ЭтотОбъект,"ТестоваяПроцедура");Результат= Действие.Выполнить();// будет Результат == null, без ошибкиСообщить(Результат =Неопределено);// падает здесь
Ошибка в строке: 6 / Внешнее исключение (System.NullReferenceException): Object reference not set to an instance of an object.}
DelegateAction создаёт лямбду с вызовом метода всегда через CallAsFunction. Для процедур возвращаемое значение будет null, который не конвертировался в Неопределено
Исправлено внутри стековой машины, т.к. это исправляет ещё и возможность аналогичного падения динамического вызова модулем #native метода подключенного модуля #stack
Summary by CodeRabbit
Bug Fixes
Procedure calls now return an undefined result consistently, including when invoked through an action. This avoids exposing a null or empty value as the result of a procedure call and makes the returned value match the expected behavior for procedures. Function calls continue to return their calculated results.
No actionable comments were generated in the recent review.
Walkthrough
ExecuteMethod now initializes procedure results to BslUndefinedValue.Instance. A new test invokes an exported procedure through Действие.Выполнить() and checks that the result is Неопределено.
Changes: Procedure action result
Layer / File(s)
Summary
Initialize and test procedure results src/ScriptEngine/Machine/MachineInstance.cs, tests/delegate-action.os
ExecuteMethod initializes procedure results to BslUndefinedValue.Instance. The test suite registers a test that invokes an exported procedure through Действие.Выполнить() and checks that the result is Неопределено.
Calling a procedure through a delegate now returns Неопределено instead of null, so comparing the result no longer throws a NullReferenceException. The change is small and tested, and I found no merge-blocking risk.
Pre-merge checks: 4
Check name
Status
Explanation
Description Check
Check skipped - CodeRabbit’s high-level summary is enabled.
Title check
The title "результат Делегата при вызове процедуры +тест" ("Delegate result when calling a procedure + test") matches the main change. The fix makes a procedure invoked through a delegate return Неопр…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title "результат Делегата при вызове процедуры +тест" ("Delegate result when calling a procedure + test") matches the main change. The fix makes a procedure invoked through a delegate return Неопределено (undefined) instead of null, and the PR adds a test for that case. The title names the behavior and the test, so a teammate scanning history can identify the primary change.
Finishing Touches
Generate unit tests (beta)
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
File: No configuration file from this repository applied
Commit: Unavailable
Layers: defaults
Review profile: CHILL
Plan: Advanced
Run ID: c9929cbc-1454-4172-88b6-046efc78095f
Commits
Reviewing files that changed from the base of the PR and between df5432c and e1171e4.
Files selected for processing: 2
src/ScriptEngine/Machine/MachineInstance.cs
tests/delegate-action.os
Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Исправляет падение по NRE при использовании результата вызова Процедуры через Делегат:
Ошибка в строке: 6 / Внешнее исключение (System.NullReferenceException): Object reference not set to an instance of an object.}
DelegateActionсоздаёт лямбду с вызовом метода всегда черезCallAsFunction. Для процедур возвращаемое значение будетnull, который не конвертировался вНеопределеноИсправлено внутри стековой машины, т.к. это исправляет ещё и возможность аналогичного падения динамического вызова модулем #native метода подключенного модуля #stack
Summary by CodeRabbit