Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Приведено в соответствие поведение ОС к 1С #1455

Merged
merged 1 commit into from
Oct 1, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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