mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
merge master
This commit is contained in:
commit
65df810d41
14 changed files with 109 additions and 35 deletions
|
@ -257,23 +257,11 @@ namespace System.Collections
|
|||
}
|
||||
|
||||
public bool ContainsValue(TValue value)
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
for (int_cosize i = 0; i < mCount; i++)
|
||||
{
|
||||
if (mEntries[i].mHashCode >= 0 && mEntries[i].mValue == null) return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
//TODO: IMPORTANT!
|
||||
/*EqualityComparer<TValue> c = EqualityComparer<TValue>.Default;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
if (entries[i].hashCode >= 0 && c.Equals(entries[i].value, value)) return true;
|
||||
}*/
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -930,6 +930,59 @@ namespace System.Collections
|
|||
}
|
||||
}
|
||||
|
||||
extension List<T> where T : String
|
||||
{
|
||||
public bool Contains(T item, StringComparison comparison)
|
||||
{
|
||||
if (item == null)
|
||||
{
|
||||
for (int i = 0; i < mSize; i++)
|
||||
if (mItems[i] == null)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < mSize; i++)
|
||||
if (mItems[i].Equals(item, comparison))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public int IndexOf(T item, StringComparison comparison)
|
||||
{
|
||||
for (int i = 0; i < mSize; i++)
|
||||
if (mItems[i].Equals(item, comparison))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int IndexOf(T item, int index, StringComparison comparison)
|
||||
{
|
||||
for (int i = index; i < mSize; i++)
|
||||
if (mItems[i].Equals(item, comparison))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int IndexOf(T item, int index, int count, StringComparison comparison)
|
||||
{
|
||||
for (int i = index; i < index + count; i++)
|
||||
if (mItems[i].Equals(item, comparison))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
|
||||
public int LastIndexOf(T item, StringComparison comparison)
|
||||
{
|
||||
for (int i = mSize - 1; i >= 0; i--)
|
||||
if (mItems[i].Equals(item, comparison))
|
||||
return i;
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
class ListWithAlloc<T> : List<T>
|
||||
{
|
||||
IRawAllocator mAlloc;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace System.Diagnostics
|
||||
{
|
||||
class Check
|
||||
static class Check
|
||||
{
|
||||
|
||||
[Unchecked, SkipCall]
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace System.Diagnostics.Contracts
|
||||
{
|
||||
class Contract
|
||||
static class Contract
|
||||
{
|
||||
public enum ContractFailureKind
|
||||
{
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace System.Diagnostics
|
||||
{
|
||||
class Debug
|
||||
static class Debug
|
||||
{
|
||||
#if !DEBUG
|
||||
[SkipCall]
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace System.IO
|
|||
case FileReadError(FileReadError);
|
||||
}
|
||||
|
||||
class File
|
||||
static class File
|
||||
{
|
||||
public static Result<void, FileError> ReadAll(StringView path, List<uint8> outData)
|
||||
{
|
||||
|
|
|
@ -97,10 +97,10 @@ namespace System.IO
|
|||
}
|
||||
}
|
||||
|
||||
//Read sized string from stream
|
||||
public Result<void> ReadStrSized32(int64 size, String output)
|
||||
/// Read sized string from stream
|
||||
public Result<void> ReadStrSized32(int size, String output)
|
||||
{
|
||||
if (size <= 0)
|
||||
if (size < 0)
|
||||
return .Err;
|
||||
|
||||
for (int64 i = 0; i < size; i++)
|
||||
|
@ -115,7 +115,13 @@ namespace System.IO
|
|||
return .Ok;
|
||||
}
|
||||
|
||||
//Reads null terminated ASCII string from the stream. Null terminator is read from stream but isn't appended to output string
|
||||
public Result<void> ReadStrSized32(String output)
|
||||
{
|
||||
int size = Try!(Read<int32>());
|
||||
return ReadStrSized32(size, output);
|
||||
}
|
||||
|
||||
/// Reads null terminated ASCII string from the stream. Null terminator is read from stream but isn't appended to output string
|
||||
public Result<void> ReadStrC(String output)
|
||||
{
|
||||
Result<char8> char0;
|
||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading;
|
|||
namespace System
|
||||
{
|
||||
[StaticInitPriority(100)]
|
||||
class Runtime
|
||||
static class Runtime
|
||||
{
|
||||
const int32 cVersion = 8;
|
||||
|
||||
|
|
|
@ -227,6 +227,26 @@ static
|
|||
}
|
||||
}
|
||||
|
||||
public static mixin DeleteContainerAndDisposeItems(var container)
|
||||
{
|
||||
if (container != null)
|
||||
{
|
||||
for (var value in container)
|
||||
value.Dispose();
|
||||
delete container;
|
||||
}
|
||||
}
|
||||
|
||||
public static mixin ClearAndDisposeItems(var container)
|
||||
{
|
||||
if (container != null)
|
||||
{
|
||||
for (var value in container)
|
||||
value.Dispose();
|
||||
container.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
public static mixin DeleteAndNullify(var val)
|
||||
{
|
||||
delete val;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Diagnostics;
|
||||
namespace System.Text
|
||||
{
|
||||
public class UTF16
|
||||
public static class UTF16
|
||||
{
|
||||
public enum EncodeError
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
using System.Diagnostics;
|
||||
namespace System.Text
|
||||
{
|
||||
class UTF8
|
||||
static class UTF8
|
||||
{
|
||||
public const int8[256] sTrailingBytesForUTF8 =
|
||||
.(
|
||||
|
|
|
@ -683,13 +683,7 @@ namespace System
|
|||
|
||||
namespace System.Reflection
|
||||
{
|
||||
public struct TypeId : int32
|
||||
{
|
||||
public Type ToType()
|
||||
{
|
||||
return Type.[Friend]sTypes[(int32)this];
|
||||
}
|
||||
}
|
||||
public struct TypeId : int32 {}
|
||||
|
||||
[Ordered, AlwaysInclude(AssumeInstantiated=true)]
|
||||
public class TypeInstance : Type
|
||||
|
@ -1137,7 +1131,7 @@ namespace System.Reflection
|
|||
|
||||
public Type GetGenericArg(int argIdx)
|
||||
{
|
||||
return mResolvedTypeRefs[argIdx].ToType();
|
||||
return Type.GetType(mResolvedTypeRefs[argIdx]);
|
||||
}
|
||||
|
||||
public override void GetFullName(String strBuffer)
|
||||
|
|
|
@ -2758,7 +2758,7 @@ namespace IDE.ui
|
|||
return;
|
||||
}
|
||||
|
||||
if (mIsReadOnly)
|
||||
if (CheckReadOnly())
|
||||
{
|
||||
base.KeyChar(keyChar);
|
||||
return;
|
||||
|
|
|
@ -1209,6 +1209,7 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
|||
returnType = module->mBfIRBuilder->MapType(mReturnType);
|
||||
}
|
||||
|
||||
bool hasExplicitThis = false;
|
||||
for (int paramIdx = -1; paramIdx < GetParamCount(); paramIdx++)
|
||||
{
|
||||
BfType* checkType = NULL;
|
||||
|
@ -1223,13 +1224,25 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
|||
else
|
||||
{
|
||||
if (HasExplicitThis())
|
||||
{
|
||||
checkType = GetParamType(0);
|
||||
|
||||
//TODO(BCF): Breaks tests
|
||||
//hasExplicitThis = true;
|
||||
}
|
||||
else
|
||||
checkType = GetOwner();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (hasExplicitThis)
|
||||
{
|
||||
// We already looked at this
|
||||
hasExplicitThis = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
checkType = GetParamType(paramIdx);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue