Skip to content

Commit

Permalink
Merge pull request #1455 from akpaevj/fix/1452
Browse files Browse the repository at this point in the history
Приведено в соответствие поведение ОС к 1С
  • Loading branch information
EvilBeaver committed Oct 1, 2024
2 parents 4844629 + 2810752 commit 3ecfdca
Showing 1 changed file with 10 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ This Source Code Form is subject to the terms of the
using OneScript.Contexts;
using OneScript.Exceptions;
using OneScript.Types;
using OneScript.Values;
using ScriptEngine.Machine;
using ScriptEngine.Machine.Contexts;

Expand Down Expand Up @@ -81,7 +82,7 @@ public ValueListItem GetValue(IValue index)
/// <param name="picture">Картинка (необязательный) - Визуальное представление добавляемого значения</param>
/// <returns>ЭлементСпискаЗначений</returns>
[ContextMethod("Добавить", "Add")]
public ValueListItem Add(IValue value, string presentation = null, bool check = false, IValue picture = null)
public ValueListItem Add(IValue value = null, string presentation = null, bool check = false, IValue picture = null)
{
var newItem = CreateNewListItem(value, presentation, check, picture);

Expand All @@ -99,7 +100,7 @@ public ValueListItem Add(IValue value, string presentation = null, bool check =
/// <param name="picture">Картинка (необязательный) - Визуальное представление добавляемого значения</param>
/// <returns>ЭлементСпискаЗначений</returns>
[ContextMethod("Вставить", "Insert")]
public ValueListItem Insert(int index, IValue value, string presentation = null, bool check = false, IValue picture = null)
public ValueListItem Insert(int index, IValue value = null, string presentation = null, bool check = false, IValue picture = null)
{
var newItem = CreateNewListItem(value, presentation, check, picture);
_items.Insert(index, newItem);
Expand All @@ -109,11 +110,13 @@ public ValueListItem Insert(int index, IValue value, string presentation = null,

private static ValueListItem CreateNewListItem(IValue value, string presentation, bool check, IValue picture)
{
var newItem = new ValueListItem();
newItem.Value = value;
newItem.Presentation = presentation;
newItem.Check = check;
newItem.Picture = picture;
var newItem = new ValueListItem
{
Value = value ?? BslUndefinedValue.Instance,
Presentation = presentation,
Check = check,
Picture = picture
};
return newItem;
}

Expand Down

0 comments on commit 3ecfdca

Please sign in to comment.