private void _initItems(CapturedScopeItems items, Class?klass) { if (klass == null) { m_items = items; m_hasClass = false; } else { var newItems = new CapturedScopeItem[items.length + 1]; items.asSpan().CopyTo(newItems.AsSpan(0, items.length)); newItems[items.length] = new CapturedScopeItem(DataNodeType.CLASS, klass); m_hasClass = true; m_items = new CapturedScopeItems(newItems); } }
/// <summary> /// Creates a new instance of <see cref="CapturedScope"/>. /// </summary> /// <param name="items">A read-only array view of <see cref="CapturedScopeItem"/> instances /// representing the captured values, in a bottom-to-top order.</param> /// <param name="klass">The class for which to create the captured scope, or null when /// creating a captured scope for a function.</param> /// <param name="container">A <see cref="CapturedScopeContainerType"/> representing the /// container class used for holding the captured values.</param> public CapturedScope(CapturedScopeItems items, Class?klass, CapturedScopeContainerType container) { _initItems(items, klass); m_containerType = container; }