Make slots available to the API outside of foreign methods.
At any point in time, the user can call wrenEnsureSlots() which will implicitly create a fiber and point to its stack if needed.
This commit is contained in:
+10
-3
@@ -3,6 +3,7 @@ class Slots {
|
||||
foreign static getSlots(bool, num, string, bytes, value)
|
||||
foreign static setSlots(a, b, c, d)
|
||||
foreign static ensure()
|
||||
foreign static ensureOutsideForeign()
|
||||
}
|
||||
|
||||
// If nothing is set in the return slot, it retains its previous value, the
|
||||
@@ -10,8 +11,14 @@ class Slots {
|
||||
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.getSlots(true, "by\0te", 12.34, "str", value) == value)
|
||||
// expect: true
|
||||
|
||||
System.print(Slots.setSlots(value, 0, 0, 0) == value) // expect: true
|
||||
System.print(Slots.setSlots(value, 0, 0, 0) == value)
|
||||
// expect: true
|
||||
|
||||
System.print(Slots.ensure()) // expect: 1 -> 20 (190)
|
||||
System.print(Slots.ensure())
|
||||
// expect: 1 -> 20 (190)
|
||||
|
||||
System.print(Slots.ensureOutsideForeign())
|
||||
// expect: 0 -> 20 (190)
|
||||
|
||||
Reference in New Issue
Block a user