Commit e4e0cf8c authored by Botond Baranyi's avatar Botond Baranyi
Browse files

OOP: fixed method calls with return values on 'in' parameters (bug 563718)



Change-Id: If527b1a6e4acff5ae5c88e8e53f5a6766ffac551
Signed-off-by: Botond Baranyi's avatarBotond Baranyi <botond.baranyi@ericsson.com>
parent 498cdd78
......@@ -4232,6 +4232,17 @@ bool Type::chk_this_refd_value(Value *value, Common::Assignment *lhs, expected_v
default:
break;
}
if (!error_flag && ref->get_subrefs() != NULL &&
(ass->get_asstype() == Assignment::A_PAR_VAL ||
ass->get_asstype() == Assignment::A_PAR_VAL_IN)) {
Ttcn::FieldOrArrayRefs* subrefs = ref->get_subrefs();
for (size_t i = 0; i < subrefs->get_nof_refs(); ++i) {
if (subrefs->get_ref(i)->get_type() == Ttcn::FieldOrArrayRef::FUNCTION_REF) {
// the parameter needs to be copied, since all class methods are non-const
ass->use_as_lvalue(*ref);
}
}
}
break;
case Assignment::A_MODULEPAR_TEMP:
case Assignment::A_TEMPLATE:
......
......@@ -392,6 +392,7 @@ testcase tc_references() runs on CT {
type class Node {
public var integer data;
public var Node next;
public function f() return integer { return 1; }
}
function f_test(in Node p1, inout Node p2, out Node p3,
......@@ -405,6 +406,10 @@ function f_test(in Node p1, inout Node p2, out Node p3,
if (p3 != null) {
setverdict(fail, "Invalid 'out' parameter value at start: ", p3, ", expected: null");
}
var integer i := p1.f();
if (i != 1) {
setverdict(fail, "Invalid value returned by function call of 'in' parameter: ", i);
}
var Node tmp := p2;
p3 := p1;
p1 := null;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment