refactor: consolidate type-check helpers into generic wrenIsObjType and validate IS operand is class

Replace six separate type-check functions (wrenIsClosure, wrenIsFiber, wrenIsFn, wrenIsInstance, wrenIsRange, wrenIsString) with a single wrenIsObjType that takes an ObjType parameter. Add IS_CLASS macro and runtime validation in the IS bytecode handler to ensure the right operand is a class, producing a clear error message when it is not. Add test case for non-class right operand.
This commit is contained in:
Bob Nystrom
2014-01-21 15:52:03 +00:00
parent 7e3b9a6bcb
commit 474e89c992
5 changed files with 21 additions and 43 deletions
View File
+1
View File
@@ -0,0 +1 @@
1 is false // expect runtime error: Right operand must be a class.