} else if (param != null) {
instance = get_cvalue_ (get_parameter_cvalue (param));
}
+ } else if (expr.is_chainup) {
+ instance = get_this_cexpression ();
} else {
var temp_value = create_temp_value (expr.type_reference, true, expr);
instance = get_cvalue_ (temp_value);
}
if ((st != null && !st.is_simple_type ()) && !(get_ccode_instance_pos (m) < 0)) {
- creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
+ if (expr.is_chainup) {
+ creation_call.add_argument (instance);
+ } else {
+ creation_call.add_argument (new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance));
+ }
} else if (st != null && get_ccode_name (st) == "va_list") {
creation_call.add_argument (instance);
if (get_ccode_name (m) == "va_start") {
var vardecl = new CCodeVariableDeclarator ("self", default_value_for_type (creturn_type, true));
vardecl.init0 = true;
ccode.add_declaration (get_ccode_name (creturn_type), vardecl);
- } else {
+ } else if (!((CreationMethod) m).chain_up) {
// memset needs string.h
cfile.add_include ("string.h");
var czero = new CCodeFunctionCall (new CCodeIdentifier ("memset"));
void
bar_init (Bar *self)
{
- Foo _tmp0_ = {0};
- memset (self, 0, sizeof (Bar));
- foo_init_foo (&_tmp0_);
+ foo_init_foo (self);
(*self).j = 1;
}
{
Bar bar = {0};
Bar _tmp0_;
+ Bar _tmp1_;
bar_init (&bar);
_tmp0_ = bar;
- _vala_assert (_tmp0_.j == 1, "bar.j == 1");
+ _vala_assert (_tmp0_.i == 1, "bar.i == 1");
+ _tmp1_ = bar;
+ _vala_assert (_tmp1_.j == 1, "bar.j == 1");
}
int
void main () {
var bar = Bar ();
- //FIXME assert (bar.i == 1);
+ assert (bar.i == 1);
assert (bar.j == 1);
}
void
bar_init (Bar *self)
{
- memset (self, 0, sizeof (Bar));
foo_init (self);
(*self).j = 1;
}
void
foo_init (Foo *self)
{
- Foo _tmp0_ = {0};
- memset (self, 0, sizeof (Foo));
- foo_init_foo (&_tmp0_);
+ foo_init_foo (self);
(*self).j = 1;
}
{
Foo foo = {0};
Foo _tmp0_;
+ Foo _tmp1_;
foo_init (&foo);
_tmp0_ = foo;
- _vala_assert (_tmp0_.j == 1, "foo.j == 1");
+ _vala_assert (_tmp0_.i == 1, "foo.i == 1");
+ _tmp1_ = foo;
+ _vala_assert (_tmp1_.j == 1, "foo.j == 1");
}
int
void main () {
var foo = Foo ();
- //FIXME assert (foo.i == 1);
+ assert (foo.i == 1);
assert (foo.j == 1);
}
void
foo_init_bar (Foo *self)
{
- memset (self, 0, sizeof (Foo));
foo_init (self);
(*self).i = 1;
}
*/
public abstract bool is_yield_expression { get; set; }
+ /**
+ * Whether it is a creation chain up.
+ */
+ public abstract bool is_chainup { get; set; }
+
/**
* Appends the specified expression to the list of arguments.
*
*/
public bool is_constructv_chainup { get; private set; }
- public bool is_chainup { get; private set; }
+ public bool is_chainup { get; set; }
private Expression _call;
var struct_creation_expression = new ObjectCreationExpression ((MemberAccess) call, source_reference);
struct_creation_expression.struct_creation = true;
+ struct_creation_expression.is_chainup = is_chainup;
foreach (Expression arg in argument_list) {
struct_creation_expression.add_argument (arg);
}
public bool is_yield_expression { get; set; }
+ public bool is_chainup { get; set; }
+
public bool struct_creation { get; set; }
private List<Expression> argument_list = new ArrayList<Expression> ();