We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 43d8897 commit 2d8b6a7Copy full SHA for 2d8b6a7
kscr-core/Bytecode/Statement.cs
@@ -256,6 +256,10 @@ public virtual Stack Evaluate(RuntimeBase vm, Stack stack)
256
stack[Default] = stack.This;
257
break;
258
case (StatementComponentType.Expression, BytecodeType.Cast):
259
+ var targetType = vm.FindType(Arg)!;
260
+ var currentType = stack[Default]!.Value!.Type;
261
+ if (!targetType.CanHold(currentType))
262
+ throw new InternalException($"Cannot cast {currentType} to {targetType}");
263
// casting is implicitly evaluated by design
264
265
case (StatementComponentType.Expression, BytecodeType.StmtIf):
0 commit comments