Skip to content

Commit 72d2520

Browse files
committed
Empty keyString removed
1 parent d1549ef commit 72d2520

5 files changed

Lines changed: 13 additions & 14 deletions

File tree

YantraJS.Core/Core/KeyString.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ private PropertyKey(KeyType type, uint index,in KeyString key, JSSymbol symbol =
3232
}
3333
public static implicit operator PropertyKey(int index)
3434
{
35-
return new PropertyKey(KeyType.UInt, (uint)index, KeyString.Empty);
35+
return new PropertyKey(KeyType.UInt, (uint)index, 0);
3636
}
3737

3838
public static implicit operator PropertyKey(uint index)
3939
{
40-
return new PropertyKey(KeyType.UInt, index, KeyString.Empty);
40+
return new PropertyKey(KeyType.UInt, index, 0);
4141
}
4242

4343
public static implicit operator PropertyKey(in KeyString key)
@@ -52,7 +52,7 @@ public static implicit operator PropertyKey(string key)
5252

5353
public static implicit operator PropertyKey(JSSymbol key)
5454
{
55-
return new PropertyKey(KeyType.Symbol, key.Key, KeyString.Empty, key);
55+
return new PropertyKey(KeyType.Symbol, key.Key, 0, key);
5656
}
5757
}
5858

YantraJS.Core/Core/KeyString1.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,7 @@
1313
/// </summary>
1414
public enum KeyString : int
1515
{
16-
Empty = 0,
17-
__proto__,
16+
__proto__ = 1,
1817
length,
1918

2019
Number,

YantraJS.Core/Core/Object/KeyEnumerator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public bool MoveNextProperty(out KeyString key, out JSProperty value)
5151
}
5252
parent = null;
5353
}
54-
key = KeyString.Empty;
54+
key = 0;
5555
value = default;
5656
return false;
5757
}
@@ -83,7 +83,7 @@ public bool MoveNext(out KeyString key, out JSValue value)
8383
}
8484
parent = null;
8585
}
86-
key = KeyString.Empty;
86+
key = 0;
8787
value = null;
8888
return false;
8989
}

YantraJS.Core/Core/Storage/JSProperty.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ internal static JSProperty Property(
185185
JSValue d,
186186
JSPropertyAttributes attributes = JSPropertyAttributes.EnumerableConfigurableValue)
187187
{
188-
return new JSProperty(KeyString.Empty, d, attributes);
188+
return new JSProperty(0, d, attributes);
189189
}
190190

191191
//[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -288,7 +288,7 @@ internal static JSProperty Property(
288288
JSFunction set = null,
289289
JSPropertyAttributes attributes = JSPropertyAttributes.EnumerableConfigurableProperty)
290290
{
291-
return new JSProperty(KeyString.Empty, get, set, attributes);
291+
return new JSProperty(0, get, set, attributes);
292292
}
293293

294294
}

YantraJS.Core/Core/Storage/PropertySequence.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ public bool MoveNext(out KeyString key, out JSProperty property)
9595
return true;
9696
}
9797
property = JSProperty.Empty;
98-
key = KeyString.Empty;
98+
key = 0;
9999
return false;
100100
}
101101

@@ -123,7 +123,7 @@ public bool MoveNextKey(out KeyString key)
123123
start = objP.Next;
124124
return true;
125125
}
126-
key = KeyString.Empty;
126+
key = 0;
127127
return false;
128128
}
129129
}
@@ -166,7 +166,7 @@ public bool MoveNext(out KeyString key)
166166
return true;
167167
}
168168
// property = JSProperty.Empty;
169-
key = KeyString.Empty;
169+
key = 0;
170170
return false;
171171
}
172172

@@ -193,7 +193,7 @@ public bool MoveNext(out JSValue value, out KeyString key)
193193
return true;
194194
}
195195
value = null;
196-
key = KeyString.Empty;
196+
key = 0;
197197
return false;
198198
}
199199

@@ -219,7 +219,7 @@ public bool MoveNextProperty(out JSProperty value, out KeyString key)
219219
return true;
220220
}
221221
value = JSProperty.Empty;
222-
key = KeyString.Empty;
222+
key = 0;
223223
return false;
224224
}
225225

0 commit comments

Comments
 (0)