Skip to content

Commit 6240042

Browse files
committed
Merge remote-tracking branch 'upstream/develop-9.0' into merge-develop_9.0_05.06.18
2 parents a6e4378 + 092d411 commit 6240042

File tree

9 files changed

+90
-7
lines changed

9 files changed

+90
-7
lines changed

.gitmodules

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
[submodule "ide"]
22
path = ide
33
url = https://github.com/livecode/livecode-ide
4-
branch = develop
4+
branch = develop-9.0
55
[submodule "thirdparty"]
66
path = thirdparty
77
url = https://github.com/livecode/livecode-thirdparty
8-
branch = develop
8+
branch = develop-9.0
99
[submodule "libcpptest/googletest"]
1010
path = libcpptest/googletest
1111
url = https://github.com/google/googletest.git
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# LiveCode Builder Language
2+
## Nullable aggregate fields
3+
* Aggregate fields of Pointer type can now contain `nothing`,
4+
i.e. null pointers

docs/notes/bugfix-21326.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Ensure binary strings remain so when binary string is appended or prepended

engine/src/exec-engine.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,8 @@ void MCEngineExecPutIntoVariable(MCExecContext& ctxt, MCExecValue p_value, int p
704704
else
705705
{
706706
if (MCValueGetTypeCode(p_var . mark . text) == kMCValueTypeCodeData &&
707-
p_value . type == kMCExecValueTypeDataRef)
707+
MCExecTypeIsValueRef(p_value.type) &&
708+
MCValueGetTypeCode(p_value.valueref_value) == kMCValueTypeCodeData)
708709
{
709710
// AL-2014-11-20: Make sure the incoming exec value is released.
710711
MCAutoDataRef t_value_data;

engine/src/variable.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -613,7 +613,8 @@ bool MCVariable::modify_ctxt(MCExecContext& ctxt, MCExecValue p_value, MCVariabl
613613

614614
bool MCVariable::modify_ctxt(MCExecContext& ctxt, MCExecValue p_value, MCSpan<MCNameRef> p_path, MCVariableSettingStyle p_setting)
615615
{
616-
if (p_value . type == kMCExecValueTypeDataRef)
616+
if (MCExecTypeIsValueRef(p_value.type) &&
617+
MCValueGetTypeCode(p_value.valueref_value) == kMCValueTypeCodeData)
617618
{
618619
if (can_become_data(ctxt, p_path))
619620
{

libcpptest/googletest

Submodule googletest updated 82 files

libfoundation/src/foundation-foreign.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1294,9 +1294,16 @@ static bool _aggregate_export(const MCForeignTypeDescriptor* desc, MCValueRef p_
12941294
const MCForeignTypeDescriptor *t_field_desc = MCForeignTypeInfoGetDescriptor(t_field_type);
12951295
if (t_element_type == t_field_desc->bridgetype)
12961296
{
1297-
if (!t_field_desc->doexport(t_field_desc, t_element, false, t_ptr))
1297+
if (t_element_type == kMCNullTypeInfo)
12981298
{
1299-
t_success = false;
1299+
MCMemoryClear(t_ptr, t_size);
1300+
}
1301+
else
1302+
{
1303+
if (!t_field_desc->doexport(t_field_desc, t_element, false, t_ptr))
1304+
{
1305+
t_success = false;
1306+
}
13001307
}
13011308
}
13021309
else if (MCTypeInfoIsForeign(t_element_type))

tests/lcb/vm/foreign-aggregate.lcb

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,18 @@ public handler TestForeignAggregate_Roundtrip()
2626
end repeat
2727
end handler
2828

29+
public foreign type AggregateWithPointer binds to "MCAggregateTypeInfo:r"
30+
constant kAggregateWithNullPointer is [nothing]
31+
32+
public handler TestForeignAggregateNullPointerRoundTrip()
33+
variable tAggregate as AggregateWithPointer
34+
put kAggregateWithNullPointer into tAggregate
35+
36+
variable tList as List
37+
put tAggregate into tList
38+
39+
test "aggregate containing null pointer roundtrips" when \
40+
tList[1] is kAggregateWithNullPointer[1]
41+
end handler
42+
2943
end module
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
script "CoreEnginePut"
2+
/*
3+
Copyright (C) 2018 LiveCode Ltd.
4+
5+
This file is part of LiveCode.
6+
7+
LiveCode is free software; you can redistribute it and/or modify it under
8+
the terms of the GNU General Public License v3 as published by the Free
9+
Software Foundation.
10+
11+
LiveCode is distributed in the hope that it will be useful, but WITHOUT ANY
12+
WARRANTY; without even the implied warranty of MERCHANTABILITY or
13+
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14+
for more details.
15+
16+
You should have received a copy of the GNU General Public License
17+
along with LiveCode. If not see <http://www.gnu.org/licenses/>. */
18+
19+
// Test MCVariable::modify variant
20+
on TestPutAfterData
21+
local tVar
22+
put numToByte(1) into tVar
23+
put numToByte(1) after tVar
24+
TestAssert "put after preserves binary string", \
25+
tVar is strictly a binary string
26+
end TestPutAfterData
27+
28+
// Test MCEngineExecPutIntoVariable ValueRef chunk variant
29+
on TestPutAfterDataChunk
30+
local tVar, tArray
31+
put numToByte(1) into tVar
32+
put numToByte(1) after byte 1 of tVar
33+
TestAssert "put after chunk preserves binary string", \
34+
tVar is strictly a binary string
35+
end TestPutAfterDataChunk
36+
37+
// Test MCVariable::modify_ctxt variant
38+
on TestPutAfterDataExecValue
39+
local tVar, tArray
40+
put numToByte(1) into tVar
41+
put numToByte(1) into tArray[1]
42+
put tArray[1] after tVar
43+
TestAssert "put as execvalue after preserves binary string", \
44+
tVar is strictly a binary string
45+
end TestPutAfterDataExecValue
46+
47+
// Test MCEngineExecPutIntoVariable ExecValue chunk variant
48+
on TestPutAfterDataChunkExecValue
49+
local tVar, tArray
50+
put numToByte(1) into tVar
51+
put numToByte(1) into tArray[1]
52+
put tArray[1] after byte 1 of tVar
53+
TestAssert "put as execvalue after chunk preserves binary string", \
54+
tVar is strictly a binary string
55+
end TestPutAfterDataChunkExecValue

0 commit comments

Comments
 (0)