Skip to content

Commit

Permalink
Add runtime support for string indexing.
Browse files Browse the repository at this point in the history
  • Loading branch information
vddCore committed Aug 1, 2024
1 parent a6389b6 commit 00e214b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion VirtualMachine/EVIL.Ceres/EVIL.Ceres.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>

<Version>7.7.0</Version>
<Version>7.8.0</Version>

<IsPackable>false</IsPackable>
</PropertyGroup>
Expand Down
12 changes: 12 additions & 0 deletions VirtualMachine/EVIL.Ceres/ExecutionEngine/ExecutionUnit.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1304,6 +1304,18 @@ public void Step()
a = PopValue(); // Key
c = PopValue(); // Table

if (c.Type == DynamicValueType.String && a.Type == DynamicValueType.String)
{
c = _global.Index("str");

if (c.Type != DynamicValueType.Table)
{
throw new UnsupportedDynamicValueOperationException(
"Attempt to index a string value using a string, but no `str' support table found."
);
}
}

if (c.Type == DynamicValueType.Table)
{
if (!c.Table!.Contains(a))
Expand Down

0 comments on commit 00e214b

Please sign in to comment.