TGlas / tscript

Reference implementation of the TScript programming language
MIT License
18 stars 15 forks source link

Internal interpreter error in canvas functions for array arguments containing user-defined objects #120

Closed Mindena closed 2 years ago

Mindena commented 2 years ago

Description

Calling any of the functions curve, fillArea, frameArea or transform in the canvas namespace with arrays containing non-builtin objects results in the message internal interpreter error; Cannot read properties of undefined (reading 'length').

To Reproduce

class A {}
var a = A();

# Raise internal interpreter error:
# canvas.curve([a], false);
# canvas.fillArea([a]);
# canvas.frameArea([a]);
# canvas.transform([a, a], [a, a]);

# Raise runtime type error as expected:
# String.fromUnicode([a]);
# audio.MonoSound([a], 8000);
# audio.StereoSound([a], [a], 8000); 
TGlas commented 2 years ago

Thanks for the bug report. I will add a fix and corresponding unit tests soon.