This repository was archived by the owner on Aug 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 225
Expand file tree
/
Copy pathassign-ops.lcb
More file actions
48 lines (33 loc) · 1.46 KB
/
assign-ops.lcb
File metadata and controls
48 lines (33 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
module __VMTEST.assign_ops
use com.livecode.foreign
foreign handler MCValueGetTypeInfo(in pValue as Pointer) returns Pointer binds to "<builtin>"
foreign handler MCTypeInfoIsForeign(in pTypeInfo as Pointer) returns CBool binds to "<builtin>"
foreign handler MCArrayFetchValue(in pArray as Array, in pCaseSensitive as CBool, in pKey as Pointer, out rValue as Pointer) returns CBool binds to "<builtin>"
foreign handler MCNameCreate(in pString as String, out rName as Pointer) returns CBool binds to "<builtin>"
foreign handler MCProperListFetchElementAtIndex(in pList as List, in pIndex as LCUIndex) returns Pointer binds to "<builtin>"
unsafe handler __IsForeignValue(in pValue as Pointer) returns Boolean
return MCTypeInfoIsForeign(MCValueGetTypeInfo(pValue))
end handler
public handler TestAssignArrayOpForeignBridge()
unsafe
variable tVar as CBool
put false into tVar
variable tKey as Pointer
MCNameCreate("key", tKey)
variable tValue as Pointer
MCArrayFetchValue({"key": tVar}, false, tKey, tValue)
test "foreign value bridged to optional any in array assign" \
when not __IsForeignValue(tValue)
end unsafe
end handler
public handler TestAssignListOpForeignBridge()
unsafe
variable tVar as CBool
put false into tVar
variable tValue as Pointer
put MCProperListFetchElementAtIndex([tVar], 0) into tValue
test "foreign value bridged to optional any in list assign" \
when not __IsForeignValue(tValue)
end unsafe
end handler
end module