Skip to content

Commit aaeaa5f

Browse files
committed
EvilBeaver#1531: Метод выполнения кода делегата.
1 parent c22978a commit aaeaa5f

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/OneScript.StandardLibrary/DelegateAction.cs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,16 @@ public override void CallAsProcedure(int methodNumber, IValue[] arguments, IBslP
8383
_action(process, arguments);
8484
}
8585

86+
[ContextMethod("Выполнить")]
87+
public BslValue Execute(IBslProcess process, params BslValue[] p)
88+
{
89+
var retValue = _action(process, p);
90+
return retValue is IValueReference r
91+
? r.BslValue
92+
: (BslValue)(retValue ?? ValueFactory.Create())
93+
;
94+
}
95+
8696
[ScriptConstructor]
8797
public static DelegateAction Create(IRuntimeContextInstance target, string methodName)
8898
{

0 commit comments

Comments
 (0)