wrenReturn___() -> wrenSlotSet___().

This turns those functions into general-purpose functions for writing
raw C values into slots on the foreign call stack.

Writing a return just means writing a value to slot 0.
This commit is contained in:
Bob Nystrom
2015-12-16 13:00:13 -08:00
parent 4b3c818ec5
commit 7fcdcf2f1a
16 changed files with 215 additions and 152 deletions

16
test/api/slots.wren Normal file
View File

@ -0,0 +1,16 @@
class Slots {
foreign static noSet
foreign static getSlots(bool, num, string, bytes, value)
foreign static setSlots(a, b, c, d)
}
// If nothing is set in the return slot, it retains its previous value, the
// receiver.
System.print(Slots.noSet == Slots) // expect: true
var value = ["value"]
System.print(Slots.getSlots(true, "by\0te", 12.34, "str", value) == value) // expect: true
System.print(Slots.setSlots(value, 0, 0, 0) == value) // expect: true