mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-17 23:56:05 +02:00
Fixes while working on ref for dictionary
This commit is contained in:
parent
191d0337d0
commit
70d32885b1
6 changed files with 29 additions and 23 deletions
|
@ -13,9 +13,9 @@ namespace System.Collections
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics.Contracts;
|
||||
|
||||
public class Dictionary<TKey, TValue> : ICollection<(TKey key, TValue* value)>, IEnumerable<(TKey key, TValue* value)> where TKey : IHashable //: IDictionary<TKey, TValue>, IDictionary, IReadOnlyDictionary<TKey, TValue>, ISerializable, IDeserializationCallback
|
||||
public class Dictionary<TKey, TValue> : ICollection<(TKey key, TValue value)>, IEnumerable<(TKey key, TValue value)> where TKey : IHashable
|
||||
{
|
||||
typealias KeyValuePair=(TKey key, TValue* value);
|
||||
typealias KeyValuePair=(TKey key, TValue value);
|
||||
|
||||
private struct Entry
|
||||
{
|
||||
|
@ -112,7 +112,7 @@ namespace System.Collections
|
|||
|
||||
public void Add(KeyValuePair kvPair)
|
||||
{
|
||||
Insert(kvPair.key, *kvPair.value, true);
|
||||
Insert(kvPair.key, kvPair.value, true);
|
||||
}
|
||||
|
||||
public bool TryAdd(TKey key, TValue value)
|
||||
|
@ -228,8 +228,10 @@ namespace System.Collections
|
|||
TValue value;
|
||||
if (TryGetValue(kvPair.key, out value))
|
||||
{
|
||||
return value == *kvPair.value;
|
||||
}else{
|
||||
return value == kvPair.value;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -244,7 +246,7 @@ namespace System.Collections
|
|||
{
|
||||
if (i >= index)
|
||||
{
|
||||
kvPair[i]=(Keys.Current, &Values.CurrentRef);
|
||||
kvPair[i] = (Keys.Current, Values.Current);
|
||||
}
|
||||
}
|
||||
while(Keys.MoveNext() && Values.MoveNext());
|
||||
|
@ -682,7 +684,7 @@ namespace System.Collections
|
|||
|
||||
public KeyValuePair Current
|
||||
{
|
||||
get { return (mDictionary.mEntries[mCurrentIndex].mKey, &mDictionary.mEntries[mCurrentIndex].mValue); }
|
||||
get { return (mDictionary.mEntries[mCurrentIndex].mKey, mDictionary.mEntries[mCurrentIndex].mValue); }
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
|
|
|
@ -5,7 +5,6 @@ namespace System.Collections
|
|||
interface IEnumerator<T>
|
||||
{
|
||||
Result<T> GetNext() mut;
|
||||
T Current { get; };
|
||||
}
|
||||
|
||||
interface IResettable
|
||||
|
|
|
@ -120,7 +120,7 @@ namespace System
|
|||
for (let kv in envVars)
|
||||
{
|
||||
keys[idx] = kv.key;
|
||||
values[idx] = *kv.value;
|
||||
values[idx] = kv.value;
|
||||
++idx;
|
||||
}
|
||||
|
||||
|
@ -158,7 +158,7 @@ namespace System
|
|||
for (let kv in envVars)
|
||||
{
|
||||
keys[idx] = kv.key;
|
||||
values[idx] = *kv.value;
|
||||
values[idx] = kv.value;
|
||||
++idx;
|
||||
}
|
||||
|
||||
|
|
|
@ -76,7 +76,7 @@ namespace System
|
|||
|
||||
for (let kv in lhs.mProperties)
|
||||
{
|
||||
Object lhsVal = *kv.value;
|
||||
Object lhsVal = kv.value;
|
||||
Object rhsVal;
|
||||
if (!rhs.Get(kv.key, out rhsVal))
|
||||
return false;
|
||||
|
|
|
@ -570,16 +570,13 @@ namespace System.Reflection
|
|||
int16 mMethodDataCount;
|
||||
int16 mPropertyDataCount;
|
||||
int16 mFieldDataCount;
|
||||
int16 mConstructorDataCount;
|
||||
|
||||
void* mInterfaceDataPtr;
|
||||
MethodData* mMethodDataPtr;
|
||||
void* mPropertyDataPtr;
|
||||
FieldData* mFieldDataPtr;
|
||||
void* mConstructorDataPtr;
|
||||
void** mCustomAttrDataPtr;
|
||||
|
||||
|
||||
public override int32 InstanceSize
|
||||
{
|
||||
get
|
||||
|
@ -873,7 +870,7 @@ namespace System.Reflection
|
|||
EnumDiscriminator = 0x0200
|
||||
}
|
||||
|
||||
public enum MethodFlags : int16
|
||||
public enum MethodFlags : uint16
|
||||
{
|
||||
MethodAccessMask = 0x0007,
|
||||
PrivateScope = 0x0000, // Member not referenceable.
|
||||
|
@ -906,6 +903,7 @@ namespace System.Reflection
|
|||
StdCall = 0x1000,
|
||||
FastCall = 0x2000,
|
||||
ThisCall = 0x3000, // Purposely resuing StdCall|FastCall
|
||||
Mutating = 0x4000
|
||||
Mutating = 0x4000,
|
||||
Constructor = 0x8000,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -16,6 +16,7 @@ namespace System
|
|||
public class Type
|
||||
{
|
||||
extern const Type* sTypes;
|
||||
extern static int32 sTypeCount;
|
||||
|
||||
protected const BindingFlags cDefaultLookup = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
|
||||
|
||||
|
@ -26,6 +27,14 @@ namespace System
|
|||
protected TypeCode mTypeCode;
|
||||
protected uint8 mAlign;
|
||||
|
||||
public static TypeId TypeIdEnd
|
||||
{
|
||||
get
|
||||
{
|
||||
return (.)sTypeCount;
|
||||
}
|
||||
}
|
||||
|
||||
public int32 Size
|
||||
{
|
||||
get
|
||||
|
@ -570,13 +579,11 @@ namespace System.Reflection
|
|||
int16 mMethodDataCount;
|
||||
int16 mPropertyDataCount;
|
||||
int16 mFieldDataCount;
|
||||
int16 mConstructorDataCount;
|
||||
|
||||
void* mInterfaceDataPtr;
|
||||
MethodData* mMethodDataPtr;
|
||||
void* mPropertyDataPtr;
|
||||
FieldData* mFieldDataPtr;
|
||||
void* mConstructorDataPtr;
|
||||
void** mCustomAttrDataPtr;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue