From: Jürg Billeter Date: Mon, 26 Jun 2006 13:54:03 +0000 (+0000) Subject: plug some memory leaks, adapt to Vala.Block changes replace public fields X-Git-Tag: VALA_0_0_1~26 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d5c1409f70839312a958b5acc5cd71e434308366;p=thirdparty%2Fvala.git plug some memory leaks, adapt to Vala.Block changes replace public fields 2006-06-26 Jürg Billeter * vala/parser.y: plug some memory leaks, adapt to Vala.Block changes * vala/valaattribute.vala, vala/valabinaryexpression.vala, vala/valablock.vala, vala/valabooleanexpression.vala, vala/valabreakstatement.vala, vala/valaliteral.vala, vala/valastatement.vala: replace public fields by properties / private fields, don't mark properties as construct-only, use non-null types * vala/valadatatype.vala: renamed from Vala.Type_ to Vala.DataType * vala/valasymbolbuilder.vala, vala/valasymbolresolver.vala, vala/valasemanticanalyzer.vala, vala/valacodegenerator.vala, vala/valasourcefile.vala, vala/valacallback.vala, vala/valaclass.vala, vala/valaclassregisterfunction.vala, vala/valaconstant.vala, vala/valaenum.vala, vala/valaflags.vala, vala/valainstancecast.vala, vala/valainterface.vala, vala/valainterfaceregisterfunction.vala, vala/valamethod.vala, vala/valastruct.vala, vala/valatypeparameter.vala, vala/valatypereference.vala, vala/valatypergisterfunction.vala: adapt to renaming of Vala.Type_ to Vala.DataType * vala/Makefile.am: update svn path=/trunk/; revision=53 --- diff --git a/vala/ChangeLog b/vala/ChangeLog index b4d62b4f1..78caaed0d 100644 --- a/vala/ChangeLog +++ b/vala/ChangeLog @@ -1,3 +1,24 @@ +2006-06-26 Jürg Billeter + + * vala/parser.y: plug some memory leaks, adapt to Vala.Block changes + * vala/valaattribute.vala, vala/valabinaryexpression.vala, + vala/valablock.vala, vala/valabooleanexpression.vala, + vala/valabreakstatement.vala, vala/valaliteral.vala, + vala/valastatement.vala: replace public fields by properties / private + fields, don't mark properties as construct-only, use non-null types + * vala/valadatatype.vala: renamed from Vala.Type_ to Vala.DataType + * vala/valasymbolbuilder.vala, vala/valasymbolresolver.vala, + vala/valasemanticanalyzer.vala, vala/valacodegenerator.vala, + vala/valasourcefile.vala, vala/valacallback.vala, vala/valaclass.vala, + vala/valaclassregisterfunction.vala, vala/valaconstant.vala, + vala/valaenum.vala, vala/valaflags.vala, vala/valainstancecast.vala, + vala/valainterface.vala, vala/valainterfaceregisterfunction.vala, + vala/valamethod.vala, vala/valastruct.vala, + vala/valatypeparameter.vala, vala/valatypereference.vala, + vala/valatypergisterfunction.vala: adapt to renaming of Vala.Type_ to + Vala.DataType + * vala/Makefile.am: update + 2006-06-22 Jürg Billeter * vala/valaassignment.vala: don't mark properties as construct-only, diff --git a/vala/vala/Makefile.am b/vala/vala/Makefile.am index 0f466e817..0b53dff8d 100644 --- a/vala/vala/Makefile.am +++ b/vala/vala/Makefile.am @@ -77,6 +77,9 @@ libvala_la_SOURCES = \ valacontinuestatement.c \ valacontinuestatement.h \ valacontinuestatement.vala \ + valadatatype.c \ + valadatatype.h \ + valadatatype.vala \ valadeclarationstatement.c \ valadeclarationstatement.h \ valadeclarationstatement.vala \ @@ -239,9 +242,6 @@ libvala_la_SOURCES = \ valasymbolresolver.c \ valasymbolresolver.h \ valasymbolresolver.vala \ - valatype.c \ - valatype.h \ - valatype.vala \ valatypecheck.c \ valatypecheck.h \ valatypecheck.vala \ diff --git a/vala/vala/parser.y b/vala/vala/parser.y index 14bea6ea0..a4a8c4c57 100644 --- a/vala/vala/parser.y +++ b/vala/vala/parser.y @@ -393,6 +393,7 @@ type_name vala_type_reference_add_type_argument ($$, l->data); g_object_unref (l->data); } + g_list_free ($2); } | IDENTIFIER DOT IDENTIFIER opt_type_argument_list { @@ -406,6 +407,7 @@ type_name vala_type_reference_add_type_argument ($$, l->data); g_object_unref (l->data); } + g_list_free ($4); } ; @@ -990,8 +992,13 @@ block : OPEN_BRACE opt_statement_list CLOSE_BRACE { ValaSourceReference *src = src(@1); - $$ = VALA_STATEMENT (vala_block_new ($2, src)); + $$ = VALA_STATEMENT (vala_block_new (src)); if ($2 != NULL) { + GList *l; + for (l = $2; l != NULL; l = l->next) { + vala_block_add_statement (VALA_BLOCK ($$), l->data); + g_object_unref (l->data); + } g_list_free ($2); } g_object_unref (src); @@ -1074,6 +1081,7 @@ local_variable_type vala_type_reference_add_type_argument ($$, l->data); g_object_unref (l->data); } + g_list_free ($2); g_object_unref ($1); } | REF primary_expression opt_type_argument_list opt_op_neg @@ -1090,6 +1098,7 @@ local_variable_type vala_type_reference_add_type_argument ($$, l->data); g_object_unref (l->data); } + g_list_free ($3); g_object_unref ($2); } | local_variable_type array_qualifier @@ -1399,7 +1408,7 @@ class_declaration VALA_CODE_NODE(current_class)->attributes = $2; if ($3 != 0) { - VALA_TYPE_(current_class)->access = $3; + VALA_DATA_TYPE(current_class)->access = $3; } for (l = $7; l != NULL; l = l->next) { vala_class_add_type_parameter (current_class, l->data); @@ -1982,7 +1991,7 @@ struct_header } VALA_CODE_NODE($$)->attributes = $2; if ($3 != 0) { - VALA_TYPE_($$)->access = $3; + VALA_DATA_TYPE($$)->access = $3; } g_free ($5); @@ -2088,7 +2097,7 @@ enum_declaration VALA_CODE_NODE($$)->attributes = $2; if ($3 != 0) { - VALA_TYPE_($$)->access = $3; + VALA_DATA_TYPE($$)->access = $3; } for (l = $6; l != NULL; l = l->next) { vala_enum_add_value ($$, l->data); @@ -2169,7 +2178,7 @@ callback_declaration $$ = vala_callback_new ($6, $5, src); g_object_unref (src); if ($3 != 0) { - VALA_TYPE_($$)->access = $3; + VALA_DATA_TYPE($$)->access = $3; } VALA_CODE_NODE($$)->attributes = $2; diff --git a/vala/vala/valaattribute.vala b/vala/vala/valaattribute.vala index af6b6b285..fae496a66 100644 --- a/vala/vala/valaattribute.vala +++ b/vala/vala/valaattribute.vala @@ -24,16 +24,16 @@ using GLib; namespace Vala { public class Attribute : CodeNode { - public string name { get; construct; } - public SourceReference source_reference { get; construct; } + public string! name { get; set construct; } + public SourceReference source_reference { get; set; } public List args; - public static ref Attribute new (string name, SourceReference source) { + public static ref Attribute! new (string! name, SourceReference source) { return (new Attribute (name = name, source_reference = source)); } - public void add_argument (NamedArgument arg) { + public void add_argument (NamedArgument! arg) { args.append (arg); } } diff --git a/vala/vala/valabinaryexpression.vala b/vala/vala/valabinaryexpression.vala index 6f8f18eba..a3e561717 100644 --- a/vala/vala/valabinaryexpression.vala +++ b/vala/vala/valabinaryexpression.vala @@ -24,15 +24,15 @@ using GLib; namespace Vala { public class BinaryExpression : Expression { - public BinaryOperator operator { get; construct; } - public Expression left { get; construct; } - public Expression right { get; construct; } + public BinaryOperator operator { get; set construct; } + public Expression! left { get; set construct; } + public Expression! right { get; set construct; } - public static ref BinaryExpression new (BinaryOperator op, Expression left, Expression right, SourceReference source) { + public static ref BinaryExpression! new (BinaryOperator op, Expression! left, Expression! right, SourceReference source) { return (new BinaryExpression (operator = op, left = left, right = right, source_reference = source)); } - public override void accept (CodeVisitor visitor) { + public override void accept (CodeVisitor! visitor) { left.accept (visitor); right.accept (visitor); diff --git a/vala/vala/valablock.vala b/vala/vala/valablock.vala index e609a5768..f6709755a 100644 --- a/vala/vala/valablock.vala +++ b/vala/vala/valablock.vala @@ -24,16 +24,20 @@ using GLib; namespace Vala { public class Block : Statement { - public List statement_list { get; construct; } - public bool contains_jump_statement; + private List statement_list; + public bool contains_jump_statement { get; set; } private List local_variables; - public static ref Block new (List statement_list, SourceReference source) { - return (new Block (statement_list = statement_list, source_reference = source)); + public static ref Block! new (SourceReference source) { + return (new Block (source_reference = source)); } public void add_statement (Statement! stmt) { - _statement_list.append (stmt); + statement_list.append (stmt); + } + + public ref List get_statements () { + return statement_list; } public void add_local_variable (VariableDeclarator! decl) { @@ -47,7 +51,7 @@ namespace Vala { public override void accept (CodeVisitor! visitor) { visitor.visit_begin_block (this); - foreach (Statement stmt in statement_list) { + foreach (Statement! stmt in statement_list) { stmt.accept (visitor); } diff --git a/vala/vala/valabooleanliteral.vala b/vala/vala/valabooleanliteral.vala index 09a988c6b..7ad98fb63 100644 --- a/vala/vala/valabooleanliteral.vala +++ b/vala/vala/valabooleanliteral.vala @@ -24,14 +24,14 @@ using GLib; namespace Vala { public class BooleanLiteral : Literal { - public bool value { get; construct; } - public SourceReference source_reference { get; construct; } + public bool value { get; set; } + public SourceReference source_reference { get; set; } - public static ref BooleanLiteral new (bool b, SourceReference source) { + public static ref BooleanLiteral! new (bool b, SourceReference source) { return (new BooleanLiteral (value = b, source_reference = source)); } - public override void accept (CodeVisitor visitor) { + public override void accept (CodeVisitor! visitor) { visitor.visit_boolean_literal (this); } } diff --git a/vala/vala/valabreakstatement.vala b/vala/vala/valabreakstatement.vala index 6aff3be06..4df127bc9 100644 --- a/vala/vala/valabreakstatement.vala +++ b/vala/vala/valabreakstatement.vala @@ -24,11 +24,11 @@ using GLib; namespace Vala { public class BreakStatement : Statement { - public static ref BreakStatement new (SourceReference source) { + public static ref BreakStatement! new (SourceReference source) { return (new BreakStatement (source_reference = source)); } - public override void accept (CodeVisitor visitor) { + public override void accept (CodeVisitor! visitor) { visitor.visit_break_statement (this); } } diff --git a/vala/vala/valacallback.vala b/vala/vala/valacallback.vala index 0185c0533..3dc5bc372 100644 --- a/vala/vala/valacallback.vala +++ b/vala/vala/valacallback.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Callback : Type_ { + public class Callback : DataType { public TypeReference return_type { get; construct; } public List parameters; diff --git a/vala/vala/valaclass.vala b/vala/vala/valaclass.vala index 18486cf58..e9267d96d 100644 --- a/vala/vala/valaclass.vala +++ b/vala/vala/valaclass.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Class : Type_ { + public class Class : DataType { List type_parameters; public List base_types; public Class base_class; @@ -197,7 +197,7 @@ namespace Vala { if (lit is StringLiteral) { var val = ((StringLiteral) lit).eval (); foreach (string filename in val.split (",")) { - cheader_filenames.append (filename); + add_cheader_filename (filename); } } } diff --git a/vala/vala/valaclassregisterfunction.vala b/vala/vala/valaclassregisterfunction.vala index f80acf0c4..cc88c3c81 100644 --- a/vala/vala/valaclassregisterfunction.vala +++ b/vala/vala/valaclassregisterfunction.vala @@ -26,7 +26,7 @@ namespace Vala { public class ClassRegisterFunction : TypeRegisterFunction { public Class class_reference { get; construct; } - public override Type_ get_type_declaration () { + public override DataType get_type_declaration () { return class_reference; } diff --git a/vala/vala/valacodegenerator.vala b/vala/vala/valacodegenerator.vala index d698723f7..bd3eb34b5 100644 --- a/vala/vala/valacodegenerator.vala +++ b/vala/vala/valacodegenerator.vala @@ -613,8 +613,8 @@ namespace Vala { } public override void visit_constant (Constant! c) { - if (c.symbol.parent_symbol.node is Type_) { - var t = (Type_) c.symbol.parent_symbol.node; + if (c.symbol.parent_symbol.node is DataType) { + var t = (DataType) c.symbol.parent_symbol.node; var cdecl = new CCodeDeclaration (type_name = c.type_reference.get_const_cname ()); var arr = ""; if (c.type_reference.array) { @@ -633,8 +633,8 @@ namespace Vala { if (f.instance) { instance_priv_struct.add_field (f.type_reference.get_cname (), f.get_cname ()); } else { - if (f.symbol.parent_symbol.node is Type_) { - var t = (Type_) f.symbol.parent_symbol.node; + if (f.symbol.parent_symbol.node is DataType) { + var t = (DataType) f.symbol.parent_symbol.node; var cdecl = new CCodeDeclaration (type_name = f.type_reference.get_cname ()); cdecl.add_declarator (new CCodeVariableDeclarator (name = "%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ()))); cdecl.modifiers = CCodeModifiers.STATIC; @@ -644,7 +644,7 @@ namespace Vala { } } - private ref CCodeStatement create_type_check_statement (Method! m, Type_! t, bool non_null, string! var_name) { + private ref CCodeStatement create_type_check_statement (Method! m, DataType! t, bool non_null, string! var_name) { var ccheck = new CCodeFunctionCall (); var ctype_check = new CCodeFunctionCall (call = new CCodeIdentifier (name = t.get_upper_case_cname ("IS_"))); @@ -691,13 +691,13 @@ namespace Vala { if (m.instance) { var this_type = new TypeReference (); - this_type.type = (Type_) m.symbol.parent_symbol.node; + this_type.type = (DataType) m.symbol.parent_symbol.node; if (!m.is_override) { var cparam = new CCodeFormalParameter (type_name = this_type.get_cname (), name = "self"); function.add_parameter (cparam); } else { var base_type = new TypeReference (); - base_type.type = (Type_) m.base_method.symbol.parent_symbol.node; + base_type.type = (DataType) m.base_method.symbol.parent_symbol.node; var cparam = new CCodeFormalParameter (type_name = base_type.get_cname (), name = "base"); function.add_parameter (cparam); } @@ -776,7 +776,7 @@ namespace Vala { var vfunc = new CCodeFunction (name = m.get_cname (), return_type = m.return_type.get_cname ()); var this_type = new TypeReference (); - this_type.type = (Type_) m.symbol.parent_symbol.node; + this_type.type = (DataType) m.symbol.parent_symbol.node; var cparam = new CCodeFormalParameter (type_name = this_type.get_cname (), name = "self"); vfunc.add_parameter (cparam); @@ -935,7 +935,7 @@ namespace Vala { var cblock = new CCodeBlock (); - foreach (Statement stmt in b.statement_list) { + foreach (Statement stmt in b.get_statements ()) { var src = stmt.source_reference; if (src != null && src.comment != null) { cblock.add_statement (new CCodeComment (text = src.comment)); @@ -1393,7 +1393,7 @@ namespace Vala { visit_expression (expr); } - private void process_cmember (Expression! expr, CCodeExpression pub_inst, Type_ base_type) { + private void process_cmember (Expression! expr, CCodeExpression pub_inst, DataType base_type) { if (expr.symbol_reference.node is Method) { var m = (Method) expr.symbol_reference.node; if (!m.is_override) { @@ -1406,7 +1406,7 @@ namespace Vala { if (f.instance) { ref CCodeExpression typed_inst; if (f.symbol.parent_symbol.node != base_type) { - typed_inst = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((Type_) f.symbol.parent_symbol.node).get_upper_case_cname (null))); + typed_inst = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) f.symbol.parent_symbol.node).get_upper_case_cname (null))); ((CCodeFunctionCall) typed_inst).add_argument (pub_inst); } else { typed_inst = pub_inst; @@ -1419,8 +1419,8 @@ namespace Vala { } expr.ccodenode = new CCodeMemberAccess (inner = inst, member_name = f.get_cname (), is_pointer = true); } else { - if (f.symbol.parent_symbol.node is Type_) { - var t = (Type_) f.symbol.parent_symbol.node; + if (f.symbol.parent_symbol.node is DataType) { + var t = (DataType) f.symbol.parent_symbol.node; expr.ccodenode = new CCodeIdentifier (name = "%s_%s".printf (t.get_lower_case_cname (null), f.get_cname ())); } else { expr.ccodenode = new CCodeIdentifier (name = f.get_cname ()); @@ -1445,7 +1445,7 @@ namespace Vala { ccast.add_argument (pub_inst); typed_pub_inst = ccast; } else if (prop.symbol.parent_symbol.node != base_type) { - var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((Type_) prop.symbol.parent_symbol.node).get_upper_case_cname (null))); + var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null))); ccast.add_argument (pub_inst); typed_pub_inst = ccast; } @@ -1474,7 +1474,7 @@ namespace Vala { public override void visit_simple_name (SimpleName! expr) { var pub_inst = new CCodeIdentifier (name = "self"); - var base_type = (Type_) current_type_symbol.node; + var base_type = (DataType) current_type_symbol.node; process_cmember (expr, pub_inst, base_type); @@ -1489,7 +1489,7 @@ namespace Vala { public override void visit_member_access (MemberAccess! expr) { var pub_inst = (CCodeExpression) expr.inner.ccodenode; - Type_ base_type = null; + DataType base_type = null; if (expr.inner.static_type != null) { base_type = expr.inner.static_type.type; } @@ -1528,8 +1528,8 @@ namespace Vala { Report.error (expr.source_reference, "unsupported method invocation"); } - if (req_cast && ((Type_) m.symbol.parent_symbol.node).is_reference_type ()) { - var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((Type_) base_method.symbol.parent_symbol.node).get_upper_case_cname (null))); + if (req_cast && ((DataType) m.symbol.parent_symbol.node).is_reference_type ()) { + var ccall = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) base_method.symbol.parent_symbol.node).get_upper_case_cname (null))); ccall.add_argument (instance); instance = ccall; } @@ -1757,8 +1757,8 @@ namespace Vala { return; } - if (req_cast && ((Type_) prop.symbol.parent_symbol.node).is_reference_type ()) { - var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((Type_) prop.symbol.parent_symbol.node).get_upper_case_cname (null))); + if (req_cast && ((DataType) prop.symbol.parent_symbol.node).is_reference_type ()) { + var ccast = new CCodeFunctionCall (call = new CCodeIdentifier (name = ((DataType) prop.symbol.parent_symbol.node).get_upper_case_cname (null))); ccast.add_argument (instance); instance = ccast; } diff --git a/vala/vala/valaconstant.vala b/vala/vala/valaconstant.vala index e84d7f2b4..c4dc7d60d 100644 --- a/vala/vala/valaconstant.vala +++ b/vala/vala/valaconstant.vala @@ -44,8 +44,8 @@ namespace Vala { string cname; public string get_cname () { if (cname == null) { - if (symbol.parent_symbol.node is Type_) { - var t = (Type_) symbol.parent_symbol.node; + if (symbol.parent_symbol.node is DataType) { + var t = (DataType) symbol.parent_symbol.node; cname = "%s_%s".printf (t.get_upper_case_cname (null), name); } else { var ns = (Namespace) symbol.parent_symbol.node; diff --git a/vala/vala/valatype.vala b/vala/vala/valadatatype.vala similarity index 76% rename from vala/vala/valatype.vala rename to vala/vala/valadatatype.vala index 19271c36c..cbd37a8e9 100644 --- a/vala/vala/valatype.vala +++ b/vala/vala/valadatatype.vala @@ -23,9 +23,9 @@ using GLib; namespace Vala { - public abstract class Type_ : CodeNode { - public string name { get; construct; } - public SourceReference source_reference { get; construct; } + public abstract class DataType : CodeNode { + public string! name { get; set construct; } + public SourceReference source_reference { get; set; } public weak Namespace @namespace; public MemberAccessibility access; @@ -39,12 +39,19 @@ namespace Vala { public abstract ref string get_upper_case_cname (string infix); public abstract ref string get_lower_case_cname (string infix); - public List cheader_filenames; + private List cheader_filenames; public ref List get_cheader_filenames () { if (cheader_filenames == null) { - cheader_filenames = @namespace.get_cheader_filenames (); + /* default to header filenames of the namespace */ + foreach (string filename in @namespace.get_cheader_filenames ()) { + add_cheader_filename (filename); + } } return cheader_filenames.copy (); } + + public void add_cheader_filename (string! filename) { + cheader_filenames.append (filename); + } } } diff --git a/vala/vala/valaenum.vala b/vala/vala/valaenum.vala index 1b58c4972..9331d32f0 100644 --- a/vala/vala/valaenum.vala +++ b/vala/vala/valaenum.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Enum : Type_ { + public class Enum : DataType { List values; public static ref Enum new (string name, SourceReference source) { @@ -101,7 +101,7 @@ namespace Vala { if (lit is StringLiteral) { var val = ((StringLiteral) lit).eval (); foreach (string filename in val.split (",", 0)) { - cheader_filenames.append (filename); + add_cheader_filename (filename); } } } diff --git a/vala/vala/valaflags.vala b/vala/vala/valaflags.vala index 06801d62c..e01b0b9f1 100644 --- a/vala/vala/valaflags.vala +++ b/vala/vala/valaflags.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Flags : Type_ { + public class Flags : DataType { List values; public static ref Flags new (string name, SourceReference source) { diff --git a/vala/vala/valainstancecast.vala b/vala/vala/valainstancecast.vala index acd3bc77c..0ce980fc1 100644 --- a/vala/vala/valainstancecast.vala +++ b/vala/vala/valainstancecast.vala @@ -24,7 +24,7 @@ using GLib; namespace Vala { public class InstanceCast : CCodeFunctionCall { - public Type_ type_reference { get; construct; } + public DataType type_reference { get; construct; } public CCodeExpression inner { get; construct; } InstanceCast () { diff --git a/vala/vala/valainterface.vala b/vala/vala/valainterface.vala index 27e8f8af9..621861814 100644 --- a/vala/vala/valainterface.vala +++ b/vala/vala/valainterface.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Interface : Type_ { + public class Interface : DataType { List type_parameters; public List base_types; diff --git a/vala/vala/valainterfaceregisterfunction.vala b/vala/vala/valainterfaceregisterfunction.vala index 66ad166b0..644b5c6eb 100644 --- a/vala/vala/valainterfaceregisterfunction.vala +++ b/vala/vala/valainterfaceregisterfunction.vala @@ -26,7 +26,7 @@ namespace Vala { public class InterfaceRegisterFunction : TypeRegisterFunction { public Interface interface_reference { get; construct; } - public override Type_ get_type_declaration () { + public override DataType get_type_declaration () { return interface_reference; } diff --git a/vala/vala/valaliteral.vala b/vala/vala/valaliteral.vala index 0694aaac6..b820dda5b 100644 --- a/vala/vala/valaliteral.vala +++ b/vala/vala/valaliteral.vala @@ -24,6 +24,6 @@ using GLib; namespace Vala { public abstract class Literal : CodeNode { - public TypeReference static_type; + public TypeReference static_type { get; set; } } } diff --git a/vala/vala/valamethod.vala b/vala/vala/valamethod.vala index f8a7a1458..9d0029fda 100644 --- a/vala/vala/valamethod.vala +++ b/vala/vala/valamethod.vala @@ -82,8 +82,8 @@ namespace Vala { public string get_cname () { if (cname == null) { var parent = symbol.parent_symbol.node; - if (parent is Type_) { - cname = "%s_%s".printf (((Type_) parent).get_lower_case_cname (null), name); + if (parent is DataType) { + cname = "%s_%s".printf (((DataType) parent).get_lower_case_cname (null), name); } else if (parent is Namespace) { cname = "%s%s".printf (((Namespace) parent).get_lower_case_cprefix (), name); } else { diff --git a/vala/vala/valasemanticanalyzer.vala b/vala/vala/valasemanticanalyzer.vala index 4a492145b..139847033 100644 --- a/vala/vala/valasemanticanalyzer.vala +++ b/vala/vala/valasemanticanalyzer.vala @@ -34,20 +34,20 @@ namespace Vala { TypeReference bool_type; TypeReference string_type; - Type_ initially_unowned_type; + DataType initially_unowned_type; public void analyze (CodeContext context) { root_symbol = context.root; bool_type = new TypeReference (); - bool_type.type = (Type_) root_symbol.lookup ("bool").node; + bool_type.type = (DataType) root_symbol.lookup ("bool").node; string_type = new TypeReference (); - string_type.type = (Type_) root_symbol.lookup ("string").node; + string_type.type = (DataType) root_symbol.lookup ("string").node; var glib_ns = root_symbol.lookup ("GLib"); - initially_unowned_type = (Type_) glib_ns.lookup ("InitiallyUnowned").node; + initially_unowned_type = (DataType) glib_ns.lookup ("InitiallyUnowned").node; current_symbol = root_symbol; context.accept (this); @@ -266,17 +266,17 @@ namespace Vala { public override void visit_character_literal (CharacterLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.type = (Type_) root_symbol.lookup ("char").node; + expr.static_type.type = (DataType) root_symbol.lookup ("char").node; } public override void visit_integer_literal (IntegerLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.type = (Type_) root_symbol.lookup ("int").node; + expr.static_type.type = (DataType) root_symbol.lookup ("int").node; } public override void visit_real_literal (IntegerLiteral! expr) { expr.static_type = new TypeReference (); - expr.static_type.type = (Type_) root_symbol.lookup ("double").node; + expr.static_type.type = (DataType) root_symbol.lookup ("double").node; } public override void visit_string_literal (StringLiteral! expr) { @@ -315,7 +315,7 @@ namespace Vala { return decl.type_reference; } else if (node is EnumValue) { var type = new TypeReference (); - type.type = (Type_) node.symbol.parent_symbol.node; + type.type = (DataType) node.symbol.parent_symbol.node; return type; } return null; @@ -374,7 +374,7 @@ namespace Vala { } if (expr.inner.static_type == null) { - if (expr.inner.symbol_reference.node is Namespace || expr.inner.symbol_reference.node is Type_) { + if (expr.inner.symbol_reference.node is Namespace || expr.inner.symbol_reference.node is DataType) { expr.symbol_reference = expr.inner.symbol_reference.lookup (expr.member_name); } } diff --git a/vala/vala/valasourcefile.vala b/vala/vala/valasourcefile.vala index aaf02c813..510c168ff 100644 --- a/vala/vala/valasourcefile.vala +++ b/vala/vala/valasourcefile.vala @@ -104,18 +104,18 @@ namespace Vala { public int mark; // used for cycle detection, 0 = white (not yet visited), 1 = gray (currently visiting), 2 = black (already visited) public void add_symbol_dependency (Symbol sym, SourceFileDependencyType dep_type) { - Type_ t; + DataType t; - if (sym.node is Type_) { - t = (Type_) sym.node; + if (sym.node is DataType) { + t = (DataType) sym.node; } else if (sym.node is Method || sym.node is Field) { - if (sym.parent_symbol.node is Type_) { - t = (Type_) sym.parent_symbol.node; + if (sym.parent_symbol.node is DataType) { + t = (DataType) sym.parent_symbol.node; } else { return; } } else if (sym.node is Property) { - t = (Type_) sym.parent_symbol.node; + t = (DataType) sym.parent_symbol.node; } else if (sym.node is FormalParameter) { var fp = (FormalParameter) sym.node; t = fp.type_reference.type; diff --git a/vala/vala/valastatement.vala b/vala/vala/valastatement.vala index 0a6cc2ee9..4db130fa7 100644 --- a/vala/vala/valastatement.vala +++ b/vala/vala/valastatement.vala @@ -24,6 +24,6 @@ using GLib; namespace Vala { public abstract class Statement : CodeNode { - public SourceReference source_reference { get; construct; } + public SourceReference source_reference { get; set; } } } diff --git a/vala/vala/valastruct.vala b/vala/vala/valastruct.vala index fb795583e..4d21ba0bc 100644 --- a/vala/vala/valastruct.vala +++ b/vala/vala/valastruct.vala @@ -23,7 +23,7 @@ using GLib; namespace Vala { - public class Struct : Type_ { + public class Struct : DataType { List type_parameters; List constants; List fields; @@ -143,7 +143,7 @@ namespace Vala { if (lit is StringLiteral) { var val = ((StringLiteral) lit).eval (); foreach (string filename in val.split (",", 0)) { - cheader_filenames.append (filename); + add_cheader_filename (filename); } } } diff --git a/vala/vala/valasymbolbuilder.vala b/vala/vala/valasymbolbuilder.vala index 752b48c60..3835bad6d 100644 --- a/vala/vala/valasymbolbuilder.vala +++ b/vala/vala/valasymbolbuilder.vala @@ -192,7 +192,7 @@ namespace Vala { if (m.instance) { m.this_parameter = new FormalParameter (name = "this", type_reference = new TypeReference ()); - m.this_parameter.type_reference.type = (Type_) m.symbol.parent_symbol.node; + m.this_parameter.type_reference.type = (DataType) m.symbol.parent_symbol.node; m.this_parameter.symbol = new Symbol (node = m.this_parameter); current_symbol.add (m.this_parameter.name, m.this_parameter.symbol); } @@ -225,7 +225,7 @@ namespace Vala { current_symbol = prop.symbol; prop.this_parameter = new FormalParameter (name = "this", type_reference = new TypeReference ()); - prop.this_parameter.type_reference.type = (Type_) prop.symbol.parent_symbol.node; + prop.this_parameter.type_reference.type = (DataType) prop.symbol.parent_symbol.node; prop.this_parameter.symbol = new Symbol (node = prop.this_parameter); current_symbol.add (prop.this_parameter.name, prop.this_parameter.symbol); } diff --git a/vala/vala/valasymbolresolver.vala b/vala/vala/valasymbolresolver.vala index 953ab9265..300014086 100644 --- a/vala/vala/valasymbolresolver.vala +++ b/vala/vala/valasymbolresolver.vala @@ -118,7 +118,7 @@ namespace Vala { if (sym.node is TypeParameter) { type.type_parameter = (TypeParameter) sym.node; } else { - type.type = (Type_) sym.node; + type.type = (DataType) sym.node; } } else { var ns_symbol = root_symbol.lookup (type.namespace_name); @@ -132,7 +132,7 @@ namespace Vala { Report.error (type.source_reference, "The type name `%s' does not exist in the namespace `%s'".printf (type.type_name, type.namespace_name)); return; } - type.type = (Type_) sym.node; + type.type = (DataType) sym.node; } if (type.type != null && !type.type.is_reference_type ()) { diff --git a/vala/vala/valatypeparameter.vala b/vala/vala/valatypeparameter.vala index fbeb8cecd..8069577e0 100644 --- a/vala/vala/valatypeparameter.vala +++ b/vala/vala/valatypeparameter.vala @@ -26,7 +26,7 @@ namespace Vala { public class TypeParameter : CodeNode { public string name { get; construct; } public SourceReference source_reference { get; construct; } - public weak Type_ type; + public weak DataType type; public static ref TypeParameter new (string name, SourceReference source) { return (new TypeParameter (name = name, source_reference = source)); diff --git a/vala/vala/valatypereference.vala b/vala/vala/valatypereference.vala index 65ff4085a..eed8ec6bb 100644 --- a/vala/vala/valatypereference.vala +++ b/vala/vala/valatypereference.vala @@ -34,7 +34,7 @@ namespace Vala { public bool array { get; set; } public bool array_own { get; set; } public bool non_null { get; set; } - public weak Type_ type; + public weak DataType type; public TypeParameter type_parameter; public bool floating_reference { get; set; } diff --git a/vala/vala/valatyperegisterfunction.vala b/vala/vala/valatyperegisterfunction.vala index 63bc274bc..5ecfd0968 100644 --- a/vala/vala/valatyperegisterfunction.vala +++ b/vala/vala/valatyperegisterfunction.vala @@ -54,7 +54,7 @@ namespace Vala { block = type_block; } - public abstract Type_ get_type_declaration (); + public abstract DataType get_type_declaration (); public abstract ref string get_type_struct_name (); public abstract ref string get_class_init_func_name (); public abstract ref string get_instance_struct_size ();