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
|
@ -258,21 +258,9 @@ namespace System.Collections
|
||||||
|
|
||||||
public bool ContainsValue(TValue value)
|
public bool ContainsValue(TValue value)
|
||||||
{
|
{
|
||||||
if (value == null)
|
for (int_cosize i = 0; i < mCount; i++)
|
||||||
{
|
{
|
||||||
for (int_cosize i = 0; i < mCount; i++)
|
if (mEntries[i].mHashCode >= 0 && mEntries[i].mValue == null) return true;
|
||||||
{
|
|
||||||
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;
|
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>
|
class ListWithAlloc<T> : List<T>
|
||||||
{
|
{
|
||||||
IRawAllocator mAlloc;
|
IRawAllocator mAlloc;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System.Diagnostics
|
namespace System.Diagnostics
|
||||||
{
|
{
|
||||||
class Check
|
static class Check
|
||||||
{
|
{
|
||||||
|
|
||||||
[Unchecked, SkipCall]
|
[Unchecked, SkipCall]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System.Diagnostics.Contracts
|
namespace System.Diagnostics.Contracts
|
||||||
{
|
{
|
||||||
class Contract
|
static class Contract
|
||||||
{
|
{
|
||||||
public enum ContractFailureKind
|
public enum ContractFailureKind
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
namespace System.Diagnostics
|
namespace System.Diagnostics
|
||||||
{
|
{
|
||||||
class Debug
|
static class Debug
|
||||||
{
|
{
|
||||||
#if !DEBUG
|
#if !DEBUG
|
||||||
[SkipCall]
|
[SkipCall]
|
||||||
|
|
|
@ -23,7 +23,7 @@ namespace System.IO
|
||||||
case FileReadError(FileReadError);
|
case FileReadError(FileReadError);
|
||||||
}
|
}
|
||||||
|
|
||||||
class File
|
static class File
|
||||||
{
|
{
|
||||||
public static Result<void, FileError> ReadAll(StringView path, List<uint8> outData)
|
public static Result<void, FileError> ReadAll(StringView path, List<uint8> outData)
|
||||||
{
|
{
|
||||||
|
|
|
@ -97,10 +97,10 @@ namespace System.IO
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//Read sized string from stream
|
/// Read sized string from stream
|
||||||
public Result<void> ReadStrSized32(int64 size, String output)
|
public Result<void> ReadStrSized32(int size, String output)
|
||||||
{
|
{
|
||||||
if (size <= 0)
|
if (size < 0)
|
||||||
return .Err;
|
return .Err;
|
||||||
|
|
||||||
for (int64 i = 0; i < size; i++)
|
for (int64 i = 0; i < size; i++)
|
||||||
|
@ -115,7 +115,13 @@ namespace System.IO
|
||||||
return .Ok;
|
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)
|
public Result<void> ReadStrC(String output)
|
||||||
{
|
{
|
||||||
Result<char8> char0;
|
Result<char8> char0;
|
||||||
|
|
|
@ -6,7 +6,7 @@ using System.Threading;
|
||||||
namespace System
|
namespace System
|
||||||
{
|
{
|
||||||
[StaticInitPriority(100)]
|
[StaticInitPriority(100)]
|
||||||
class Runtime
|
static class Runtime
|
||||||
{
|
{
|
||||||
const int32 cVersion = 8;
|
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)
|
public static mixin DeleteAndNullify(var val)
|
||||||
{
|
{
|
||||||
delete val;
|
delete val;
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
namespace System.Text
|
namespace System.Text
|
||||||
{
|
{
|
||||||
public class UTF16
|
public static class UTF16
|
||||||
{
|
{
|
||||||
public enum EncodeError
|
public enum EncodeError
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
namespace System.Text
|
namespace System.Text
|
||||||
{
|
{
|
||||||
class UTF8
|
static class UTF8
|
||||||
{
|
{
|
||||||
public const int8[256] sTrailingBytesForUTF8 =
|
public const int8[256] sTrailingBytesForUTF8 =
|
||||||
.(
|
.(
|
||||||
|
|
|
@ -683,13 +683,7 @@ namespace System
|
||||||
|
|
||||||
namespace System.Reflection
|
namespace System.Reflection
|
||||||
{
|
{
|
||||||
public struct TypeId : int32
|
public struct TypeId : int32 {}
|
||||||
{
|
|
||||||
public Type ToType()
|
|
||||||
{
|
|
||||||
return Type.[Friend]sTypes[(int32)this];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[Ordered, AlwaysInclude(AssumeInstantiated=true)]
|
[Ordered, AlwaysInclude(AssumeInstantiated=true)]
|
||||||
public class TypeInstance : Type
|
public class TypeInstance : Type
|
||||||
|
@ -1137,7 +1131,7 @@ namespace System.Reflection
|
||||||
|
|
||||||
public Type GetGenericArg(int argIdx)
|
public Type GetGenericArg(int argIdx)
|
||||||
{
|
{
|
||||||
return mResolvedTypeRefs[argIdx].ToType();
|
return Type.GetType(mResolvedTypeRefs[argIdx]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void GetFullName(String strBuffer)
|
public override void GetFullName(String strBuffer)
|
||||||
|
|
|
@ -2758,7 +2758,7 @@ namespace IDE.ui
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mIsReadOnly)
|
if (CheckReadOnly())
|
||||||
{
|
{
|
||||||
base.KeyChar(keyChar);
|
base.KeyChar(keyChar);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -1208,7 +1208,8 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
||||||
{
|
{
|
||||||
returnType = module->mBfIRBuilder->MapType(mReturnType);
|
returnType = module->mBfIRBuilder->MapType(mReturnType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool hasExplicitThis = false;
|
||||||
for (int paramIdx = -1; paramIdx < GetParamCount(); paramIdx++)
|
for (int paramIdx = -1; paramIdx < GetParamCount(); paramIdx++)
|
||||||
{
|
{
|
||||||
BfType* checkType = NULL;
|
BfType* checkType = NULL;
|
||||||
|
@ -1223,13 +1224,25 @@ void BfMethodInstance::GetIRFunctionInfo(BfModule* module, BfIRType& returnType,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (HasExplicitThis())
|
if (HasExplicitThis())
|
||||||
|
{
|
||||||
checkType = GetParamType(0);
|
checkType = GetParamType(0);
|
||||||
|
|
||||||
|
//TODO(BCF): Breaks tests
|
||||||
|
//hasExplicitThis = true;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
checkType = GetOwner();
|
checkType = GetOwner();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (hasExplicitThis)
|
||||||
|
{
|
||||||
|
// We already looked at this
|
||||||
|
hasExplicitThis = false;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
checkType = GetParamType(paramIdx);
|
checkType = GetParamType(paramIdx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue