Skip to content
Browse files

Revert "Support chaining up to constructors in structs"

This reverts commit e42d65d.
  • Loading branch information...
1 parent d68c083 commit 7b3b56dd25d8a344d19473ca680a30a507a15b33 @phako committed
Showing with 2 additions and 46 deletions.
  1. +2 −10 codegen/valaccodemethodcallmodule.vala
  2. +0 −9 vala/valamethodcall.vala
  3. +0 −27 vala/valastructvaluetype.vala
View
12 codegen/valaccodemethodcallmodule.vala
@@ -62,12 +62,6 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
m = cl.default_construction_method;
generate_method_declaration (m, source_declarations);
ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_real_cname ()));
- } else if (itype is StructValueType) {
- // constructor
- var st = (Struct) ((StructValueType) itype).type_symbol;
- m = st.default_construction_method;
- generate_method_declaration (m, source_declarations);
- ccall = new CCodeFunctionCall (new CCodeIdentifier (m.get_real_cname ()));
} else if (itype is DelegateType) {
deleg = ((DelegateType) itype).delegate_symbol;
}
@@ -120,7 +114,7 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
}
}
- if (m is CreationMethod && m.parent_symbol is Class) {
+ if (m is CreationMethod) {
if (context.profile == Profile.GOBJECT) {
if (!((Class) m.parent_symbol).is_compact) {
ccall.add_argument (new CCodeIdentifier ("object_type"));
@@ -135,8 +129,6 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
break;
}
}
- } else if (m is CreationMethod && m.parent_symbol is Struct) {
- ccall.add_argument (new CCodeIdentifier ("self"));
} else if (m != null && m.get_type_parameters ().size > 0) {
// generic method
add_generic_type_arguments (in_arg_map, ma.get_type_arguments (), expr);
@@ -252,7 +244,7 @@ internal class Vala.CCodeMethodCallModule : CCodeAssignmentModule {
param.accept (codegen);
}
head.generate_dynamic_method_wrapper ((DynamicMethod) m);
- } else if (m is CreationMethod && context.profile == Profile.GOBJECT && m.parent_symbol is Class) {
+ } else if (m is CreationMethod && context.profile == Profile.GOBJECT) {
ccall_expr = new CCodeAssignment (new CCodeIdentifier ("self"), new CCodeCastExpression (ccall, current_class.get_cname () + "*"));
if (!current_class.is_compact && current_class.get_type_parameters ().size > 0) {
View
9 vala/valamethodcall.vala
@@ -186,15 +186,6 @@ public class Vala.MethodCall : Expression {
((call.symbol_reference is CreationMethod
&& call.symbol_reference.parent_symbol is Struct)
|| call.symbol_reference is Struct)) {
- var cm = analyzer.find_current_method () as CreationMethod;
- if (cm != null) {
- if (cm.chain_up) {
- error = true;
- Report.error (source_reference, "Multiple constructor calls in the same constructor are not permitted");
- return false;
- }
- cm.chain_up = true;
- }
var struct_creation_expression = new ObjectCreationExpression ((MemberAccess) call, source_reference);
struct_creation_expression.struct_creation = true;
foreach (Expression arg in get_argument_list ()) {
View
27 vala/valastructvaluetype.vala
@@ -30,33 +30,6 @@ public class Vala.StructValueType : ValueType {
base (type_symbol);
}
- public override bool is_invokable () {
- var st = type_symbol as Struct;
- if (st != null && st.default_construction_method != null) {
- return true;
- } else {
- return false;
- }
- }
-
- public override DataType? get_return_type () {
- var st = type_symbol as Struct;
- if (st != null && st.default_construction_method != null) {
- return st.default_construction_method.return_type;
- } else {
- return null;
- }
- }
-
- public override List<FormalParameter>? get_parameters () {
- var st = type_symbol as Struct;
- if (st != null && st.default_construction_method != null) {
- return st.default_construction_method.get_parameters ();
- } else {
- return null;
- }
- }
-
public override DataType copy () {
var result = new StructValueType ((Struct) type_symbol);
result.source_reference = source_reference;

0 comments on commit 7b3b56d

Please sign in to comment.
Something went wrong with that request. Please try again.