From becd673914ec72f1d454bbc0ac04cba0e551f326 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Mon, 9 Dec 2019 10:28:56 -0800 Subject: [PATCH] Property [Inline] changes, large container/string fixes, reload fixes --- BeefLibs/Beefy2D/src/widgets/EditWidget.bf | 2 +- BeefLibs/corlib/src/Attribute.bf | 2 +- BeefLibs/corlib/src/Nullable.bf | 6 ++-- BeefLibs/corlib/src/Span.bf | 30 ++++++++++--------- BeefLibs/corlib/src/String.bf | 4 +-- .../src/System/Collections/Generic/List.bf | 6 ++++ IDE/src/ui/HoverWatch.bf | 8 ++--- IDE/src/ui/SourceEditWidgetContent.bf | 4 +-- IDE/src/ui/WatchPanel.bf | 20 ++++++------- 9 files changed, 45 insertions(+), 37 deletions(-) diff --git a/BeefLibs/Beefy2D/src/widgets/EditWidget.bf b/BeefLibs/Beefy2D/src/widgets/EditWidget.bf index 421d8098..f165a36a 100644 --- a/BeefLibs/Beefy2D/src/widgets/EditWidget.bf +++ b/BeefLibs/Beefy2D/src/widgets/EditWidget.bf @@ -854,7 +854,7 @@ namespace Beefy.widgets var action = new DeleteSelectionAction(this); action.mMoveCursor = moveCursor; mData.mUndoManager.Add(action); - PhysDeleteSelection(); + PhysDeleteSelection(moveCursor); } } diff --git a/BeefLibs/corlib/src/Attribute.bf b/BeefLibs/corlib/src/Attribute.bf index ac1be99b..8269f27c 100644 --- a/BeefLibs/corlib/src/Attribute.bf +++ b/BeefLibs/corlib/src/Attribute.bf @@ -102,7 +102,7 @@ namespace System } } - [AttributeUsage(.Method /*1*/ | .Invocation | .Property)] + [AttributeUsage(.Method /*1*/ | .Invocation)] public struct InlineAttribute : Attribute { diff --git a/BeefLibs/corlib/src/Nullable.bf b/BeefLibs/corlib/src/Nullable.bf index 75f4e64c..c2975345 100644 --- a/BeefLibs/corlib/src/Nullable.bf +++ b/BeefLibs/corlib/src/Nullable.bf @@ -15,15 +15,15 @@ namespace System mValue = value; } - [Inline] public bool HasValue { + [Inline] get { return mHasValue; } } - [Inline] public T Value { + [Inline] get { if (!mHasValue) @@ -35,9 +35,9 @@ namespace System } } - [Inline] public ref T ValueRef { + [Inline] get mut { if (!mHasValue) diff --git a/BeefLibs/corlib/src/Span.bf b/BeefLibs/corlib/src/Span.bf index 091c0bae..31273eb9 100644 --- a/BeefLibs/corlib/src/Span.bf +++ b/BeefLibs/corlib/src/Span.bf @@ -50,65 +50,67 @@ namespace System { return Span(array); } - - [Inline] + public int Length { + [Inline] get { return mLength; } + [Inline] set mut { mLength = value; } } - - [Inline] + public T* Ptr { + [Inline] get { return mPtr; } + [Inline] set mut { mPtr = value; } } - - [Inline] + public T* EndPtr { + [Inline] get { return mPtr + mLength; } } - - [Inline] + public bool IsEmpty { + [Inline] get { return mLength == 0; } } - - [Inline] + public bool IsNull { + [Inline] get { return mPtr == null; } } - - [Inline] + public ref T this[int index] { + [Inline] get { return ref mPtr[index]; @@ -331,10 +333,10 @@ namespace System return OptSpan(array); } - - [Inline] + public T* Ptr { + [Inline] get { return mPtr; diff --git a/BeefLibs/corlib/src/String.bf b/BeefLibs/corlib/src/String.bf index eb190100..59d8ff2a 100644 --- a/BeefLibs/corlib/src/String.bf +++ b/BeefLibs/corlib/src/String.bf @@ -685,7 +685,7 @@ namespace System void Realloc(int newSize) { Debug.Assert(AllocSize > 0, "String has been frozen"); - Debug.Assert((uint_strsize)newSize <= cSizeFlags); + Debug.Assert((uint)newSize <= cSizeFlags); char8* newPtr = new:this char8[newSize]*; Internal.MemCpy(newPtr, Ptr, mLength); if (IsDynAlloc) @@ -703,7 +703,7 @@ namespace System void Realloc(char8* newPtr, int newSize) { Debug.Assert(AllocSize > 0, "String has been frozen"); - Debug.Assert((uint_strsize)newSize <= cSizeFlags); + Debug.Assert((uint)newSize <= cSizeFlags); Internal.MemCpy(newPtr, Ptr, mLength); if (IsDynAlloc) delete:this mPtr; diff --git a/IDE/mintest/minlib/src/System/Collections/Generic/List.bf b/IDE/mintest/minlib/src/System/Collections/Generic/List.bf index ecfc0d2b..275b861a 100644 --- a/IDE/mintest/minlib/src/System/Collections/Generic/List.bf +++ b/IDE/mintest/minlib/src/System/Collections/Generic/List.bf @@ -429,6 +429,12 @@ namespace System.Collections.Generic #endif } + public void Insert(int index, Span items) + { + if (items.Length == 0) + return; + } + public void RemoveAt(int index) { if (((int)Internal.UnsafeCastToPtr(this) & 0xFFFF) == 0x4BA0) diff --git a/IDE/src/ui/HoverWatch.bf b/IDE/src/ui/HoverWatch.bf index a6d71b0a..409a1015 100644 --- a/IDE/src/ui/HoverWatch.bf +++ b/IDE/src/ui/HoverWatch.bf @@ -794,9 +794,9 @@ namespace IDE.ui } else if (memberVals0 == ":repeat") { - int32 startIdx = int32.Parse(scope String(memberVals[1])); - int32 count = int32.Parse(scope String(memberVals[2])); - int32 maxShow = int32.Parse(scope String(memberVals[3])); + int startIdx = Int.Parse(scope String(memberVals[1])); + int count = Int.Parse(scope String(memberVals[2])); + int maxShow = Int.Parse(scope String(memberVals[3])); String displayStr = new String(memberVals[4]); String evalStr = new String(memberVals[5]); @@ -814,7 +814,7 @@ namespace IDE.ui watchSeriesInfo.mEvalTemplate = evalStr; watchSeriesInfo.mStartIdx = startIdx; watchSeriesInfo.mCount = count; - watchSeriesInfo.mShowPageSize = maxShow; + watchSeriesInfo.mShowPageSize = (int32)maxShow; watchSeriesInfo.mShowPages = 1; var memberWatch = new PendingWatch(); diff --git a/IDE/src/ui/SourceEditWidgetContent.bf b/IDE/src/ui/SourceEditWidgetContent.bf index 4bc2768c..d49c2a9d 100644 --- a/IDE/src/ui/SourceEditWidgetContent.bf +++ b/IDE/src/ui/SourceEditWidgetContent.bf @@ -354,7 +354,7 @@ namespace IDE.ui editWidgetContent.mHadPersistentTextPositionDeletes = false; editWidgetContent.mSelection = EditSelection(pos, pos + len); - editWidgetContent.DeleteSelection(); + editWidgetContent.DeleteSelection(false); // If we have modified a section of text containing breakpoint (for example), this gets encoded by // 'adds' of the new lines and then 'removes' of the old lines. We do a Levenshtein search for @@ -420,7 +420,7 @@ namespace IDE.ui editWidgetContent.CursorTextPos = posTo; var subStr = scope String(); subStr.Append(text, posFrom, len); - editWidgetContent.InsertAtCursor(subStr); + editWidgetContent.InsertAtCursor(subStr, .NoMoveCursor); if (cmdParts.Count >= 5) { diff --git a/IDE/src/ui/WatchPanel.bf b/IDE/src/ui/WatchPanel.bf index a00b3bce..0defcce7 100644 --- a/IDE/src/ui/WatchPanel.bf +++ b/IDE/src/ui/WatchPanel.bf @@ -434,9 +434,9 @@ namespace IDE.ui public String mDisplayTemplate ~ delete _; public String mEvalTemplate ~ delete _; public int32 mStartMemberIdx; - public int32 mStartIdx; - public int32 mCount; - public int32 mCurCount; // When counting up unsized series + public int mStartIdx; + public int mCount; + public int mCurCount; // When counting up unsized series public int32 mShowPages; public int32 mShowPageSize; public String mAddrs ~ delete _; @@ -1262,10 +1262,10 @@ namespace IDE.ui if (continuationDone) { // We finally have the count - mWatchSeriesInfo.mCount = (int32)totalCount; + mWatchSeriesInfo.mCount = totalCount; } } - mWatchSeriesInfo.mCurCount = (int32)totalCount; + mWatchSeriesInfo.mCurCount = totalCount; int showCount = Math.Min(totalCount, mWatchSeriesInfo.mShowPages * mWatchSeriesInfo.mShowPageSize); @@ -1423,7 +1423,7 @@ namespace IDE.ui { if (mWatchSeriesInfo.mMoreButton.mDisabled) return; - mWatchSeriesInfo.mShowPages = Math.Min(mWatchSeriesInfo.mShowPages + 1, 1 + (mWatchSeriesInfo.mCurCount + mWatchSeriesInfo.mShowPageSize - 1) / mWatchSeriesInfo.mShowPageSize); + mWatchSeriesInfo.mShowPages = (int32)Math.Min(mWatchSeriesInfo.mShowPages + 1, 1 + (mWatchSeriesInfo.mCurCount + mWatchSeriesInfo.mShowPageSize - 1) / mWatchSeriesInfo.mShowPageSize); mWatchSeriesInfo.mMoreButton.mVisible = false; mWatchSeriesInfo.mLessButton.mVisible = false; }); @@ -2297,9 +2297,9 @@ namespace IDE.ui } else if (memberVals0 == ":repeat") { - int32 startIdx = int32.Parse(scope String(memberVals[1])); - int32 count = int32.Parse(scope String(memberVals[2])); - int32 maxShow = int32.Parse(scope String(memberVals[3])); + int startIdx = Int.Parse(scope String(memberVals[1])); + int count = Int.Parse(scope String(memberVals[2])); + int maxShow = Int.Parse(scope String(memberVals[3])); String displayStr = scope String(memberVals[4]); String evalStr = scope String(memberVals[5]); @@ -2318,7 +2318,7 @@ namespace IDE.ui watchSeriesInfo.mEvalTemplate = new String(evalStr); watchSeriesInfo.mStartIdx = startIdx; watchSeriesInfo.mCount = count; - watchSeriesInfo.mShowPageSize = maxShow; + watchSeriesInfo.mShowPageSize = (int32)maxShow; watchSeriesInfo.mShowPages = 1; WatchListViewItem memberItem;