cat-language icon indicating copy to clipboard operation
cat-language copied to clipboard

popFunc doesn't actually ensure that it pops an instruction

Open sandersn opened this issue 6 years ago • 1 comments

It's probably an artifact from the translation from C#, but popFunc doesn't actually ensure that it pops an instruction. popType<T> uses this.pop() as T which is just a cast (assertion) in Typescript. So I think this error will never occur.

This pattern:

function f<T>(): T {
  return whatever as T;
}

Is not useful in Typescript and is misleading when coming from C#, because it's basically just a cast. I'd recommend replacing popType with this.pop() as T.

sandersn avatar Jan 04 '18 17:01 sandersn