vala r1956 - in trunk: . gobject vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1956 - in trunk: . gobject vala
- Date: Sun, 2 Nov 2008 18:50:38 +0000 (UTC)
Author: juergbi
Date: Sun Nov 2 18:50:38 2008
New Revision: 1956
URL: http://svn.gnome.org/viewvc/vala?rev=1956&view=rev
Log:
2008-11-02 JÃrg Billeter <j bitron ch>
* vala/valaclass.vala:
* vala/valagenieparser.vala:
* vala/valainterface.vala:
* vala/valainterfacewriter.vala:
* vala/valaparser.vala:
* vala/valasemanticanalyzer.vala:
* gobject/valaccodebasemodule.vala:
* gobject/valaccodemethodmodule.vala:
* gobject/valaclassregisterfunction.vala:
* gobject/valagobjectclassmodule.vala:
* gobject/valagobjectinterfacemodule.vala:
Drop deprecated support for static classes and interfaces
Modified:
trunk/ChangeLog
trunk/gobject/valaccodebasemodule.vala
trunk/gobject/valaccodemethodmodule.vala
trunk/gobject/valaclassregisterfunction.vala
trunk/gobject/valagobjectclassmodule.vala
trunk/gobject/valagobjectinterfacemodule.vala
trunk/vala/valaclass.vala
trunk/vala/valagenieparser.vala
trunk/vala/valainterface.vala
trunk/vala/valainterfacewriter.vala
trunk/vala/valaparser.vala
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/gobject/valaccodebasemodule.vala
==============================================================================
--- trunk/gobject/valaccodebasemodule.vala (original)
+++ trunk/gobject/valaccodebasemodule.vala Sun Nov 2 18:50:38 2008
@@ -300,16 +300,12 @@
codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (st.get_cname ()), new CCodeVariableDeclarator (st.get_cname ())));
} else if (node is Class) {
var cl = (Class) node;
- if (!cl.is_static) {
- codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (cl.get_cname ()), new CCodeVariableDeclarator (cl.get_cname ())));
- codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%sClass".printf (cl.get_cname ()), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
- }
+ codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (cl.get_cname ()), new CCodeVariableDeclarator (cl.get_cname ())));
+ codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%sClass".printf (cl.get_cname ()), new CCodeVariableDeclarator ("%sClass".printf (cl.get_cname ()))));
} else if (node is Interface) {
var iface = (Interface) node;
- if (!iface.is_static) {
- codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
- codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_type_cname ()), new CCodeVariableDeclarator (iface.get_type_cname ())));
- }
+ codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
+ codegen.header_type_declaration.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_type_cname ()), new CCodeVariableDeclarator (iface.get_type_cname ())));
}
}
}
Modified: trunk/gobject/valaccodemethodmodule.vala
==============================================================================
--- trunk/gobject/valaccodemethodmodule.vala (original)
+++ trunk/gobject/valaccodemethodmodule.vala Sun Nov 2 18:50:38 2008
@@ -157,13 +157,6 @@
codegen.current_method_inner_error = old_method_inner_error;
codegen.next_temp_var_id = old_next_temp_var_id;
- if (codegen.current_type_symbol is Interface) {
- var iface = (Interface) codegen.current_type_symbol;
- if (iface.is_static) {
- return;
- }
- }
-
codegen.function = new CCodeFunction (m.get_real_cname (), get_creturn_type (m, creturn_type.get_cname ()));
m.ccodenode = codegen.function;
Modified: trunk/gobject/valaclassregisterfunction.vala
==============================================================================
--- trunk/gobject/valaclassregisterfunction.vala (original)
+++ trunk/gobject/valaclassregisterfunction.vala Sun Nov 2 18:50:38 2008
@@ -87,7 +87,7 @@
}
public override string? get_gtype_value_table_init_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_init".printf (class_reference.get_lower_case_cname ("value_"));
@@ -95,7 +95,7 @@
}
public override string? get_gtype_value_table_free_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_free_value".printf (class_reference.get_lower_case_cname ("value_"));
@@ -103,7 +103,7 @@
}
public override string? get_gtype_value_table_copy_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_copy_value".printf (class_reference.get_lower_case_cname ("value_"));
@@ -111,7 +111,7 @@
}
public override string? get_gtype_value_table_peek_pointer_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_peek_pointer".printf (class_reference.get_lower_case_cname ("value_"));
@@ -119,7 +119,7 @@
}
public override string? get_gtype_value_table_collect_value_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_collect_value".printf (class_reference.get_lower_case_cname ("value_"));
@@ -127,7 +127,7 @@
}
public override string? get_gtype_value_table_lcopy_value_function_name () {
- bool is_fundamental = !class_reference.is_compact && !class_reference.is_static && class_reference.base_class == null;
+ bool is_fundamental = !class_reference.is_compact && class_reference.base_class == null;
if ( is_fundamental )
return "%s_lcopy_value".printf (class_reference.get_lower_case_cname ("value_"));
Modified: trunk/gobject/valagobjectclassmodule.vala
==============================================================================
--- trunk/gobject/valagobjectclassmodule.vala (original)
+++ trunk/gobject/valagobjectclassmodule.vala Sun Nov 2 18:50:38 2008
@@ -44,7 +44,7 @@
codegen.current_type_symbol = cl;
codegen.current_class = cl;
- bool is_gtypeinstance = !cl.is_compact && !cl.is_static;
+ bool is_gtypeinstance = !cl.is_compact;
bool is_gobject = cl.is_subtype_of (codegen.gobject_type);
bool is_fundamental = is_gtypeinstance && cl.base_class == null;
@@ -55,17 +55,14 @@
}
- if (!cl.is_static) {
- codegen.instance_struct = new CCodeStruct ("_%s".printf (cl.get_cname ()));
- codegen.type_struct = new CCodeStruct ("_%sClass".printf (cl.get_cname ()));
- codegen.instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (cl.get_cname ()));
- codegen.prop_enum = new CCodeEnum ();
- codegen.prop_enum.add_value (new CCodeEnumValue ("%s_DUMMY_PROPERTY".printf (cl.get_upper_case_cname (null))));
- codegen.class_init_fragment = new CCodeFragment ();
- codegen.instance_init_fragment = new CCodeFragment ();
- codegen.instance_finalize_fragment = new CCodeFragment ();
- }
-
+ codegen.instance_struct = new CCodeStruct ("_%s".printf (cl.get_cname ()));
+ codegen.type_struct = new CCodeStruct ("_%sClass".printf (cl.get_cname ()));
+ codegen.instance_priv_struct = new CCodeStruct ("_%sPrivate".printf (cl.get_cname ()));
+ codegen.prop_enum = new CCodeEnum ();
+ codegen.prop_enum.add_value (new CCodeEnumValue ("%s_DUMMY_PROPERTY".printf (cl.get_upper_case_cname (null))));
+ codegen.class_init_fragment = new CCodeFragment ();
+ codegen.instance_init_fragment = new CCodeFragment ();
+ codegen.instance_finalize_fragment = new CCodeFragment ();
CCodeFragment decl_frag;
@@ -101,7 +98,7 @@
}
- if (!cl.is_static && cl.source_reference.file.cycle == null) {
+ if (cl.source_reference.file.cycle == null) {
decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (codegen.instance_struct.name), new CCodeVariableDeclarator (cl.get_cname ())));
}
@@ -132,12 +129,10 @@
}
}
- if (!cl.is_static) {
- if (cl.source_reference.comment != null) {
- def_frag.append (new CCodeComment (cl.source_reference.comment));
- }
- def_frag.append (codegen.instance_struct);
+ if (cl.source_reference.comment != null) {
+ def_frag.append (new CCodeComment (cl.source_reference.comment));
}
+ def_frag.append (codegen.instance_struct);
if (is_gtypeinstance) {
def_frag.append (codegen.type_struct);
@@ -274,7 +269,7 @@
codegen.source_type_member_definition.append (ref_fun);
codegen.source_type_member_definition.append (unref_fun);
}
- } else if (!cl.is_static) {
+ } else {
add_instance_init_function (cl);
var function = new CCodeFunction (cl.get_lower_case_cprefix () + "free", "void");
@@ -688,7 +683,7 @@
init_block.add_statement (new CCodeExpressionStatement (parent_assignment));
- if (!cl.is_compact && !cl.is_static && !cl.is_subtype_of (codegen.gobject_type) && (cl.get_fields ().size > 0 || cl.destructor != null || cl.is_fundamental ())) {
+ if (!cl.is_compact && !cl.is_subtype_of (codegen.gobject_type) && (cl.get_fields ().size > 0 || cl.destructor != null || cl.is_fundamental ())) {
// set finalize function
var fundamental_class = cl;
while (fundamental_class.base_class != null) {
Modified: trunk/gobject/valagobjectinterfacemodule.vala
==============================================================================
--- trunk/gobject/valagobjectinterfacemodule.vala (original)
+++ trunk/gobject/valagobjectinterfacemodule.vala Sun Nov 2 18:50:38 2008
@@ -48,51 +48,47 @@
def_frag = codegen.source_type_definition;
}
- if (!iface.is_static) {
- codegen.type_struct = new CCodeStruct ("_%s".printf (iface.get_type_cname ()));
-
- decl_frag.append (new CCodeNewline ());
- var macro = "(%s_get_type ())".printf (iface.get_lower_case_cname (null));
- decl_frag.append (new CCodeMacroReplacement (iface.get_type_id (), macro));
-
- macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (iface.get_type_id (), iface.get_cname ());
- decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
-
- macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_type_id ());
- decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (codegen.get_type_check_function (iface)), macro));
-
- macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (iface.get_type_id (), iface.get_type_cname ());
- decl_frag.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
- decl_frag.append (new CCodeNewline ());
-
-
- if (iface.source_reference.file.cycle == null) {
- decl_frag.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
- decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (codegen.type_struct.name), new CCodeVariableDeclarator (iface.get_type_cname ())));
- }
-
- codegen.type_struct.add_field ("GTypeInterface", "parent_iface");
+ codegen.type_struct = new CCodeStruct ("_%s".printf (iface.get_type_cname ()));
+
+ decl_frag.append (new CCodeNewline ());
+ var macro = "(%s_get_type ())".printf (iface.get_lower_case_cname (null));
+ decl_frag.append (new CCodeMacroReplacement (iface.get_type_id (), macro));
- if (iface.source_reference.comment != null) {
- def_frag.append (new CCodeComment (iface.source_reference.comment));
- }
- def_frag.append (codegen.type_struct);
+ macro = "(G_TYPE_CHECK_INSTANCE_CAST ((obj), %s, %s))".printf (iface.get_type_id (), iface.get_cname ());
+ decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (iface.get_upper_case_cname (null)), macro));
+
+ macro = "(G_TYPE_CHECK_INSTANCE_TYPE ((obj), %s))".printf (iface.get_type_id ());
+ decl_frag.append (new CCodeMacroReplacement ("%s(obj)".printf (codegen.get_type_check_function (iface)), macro));
+
+ macro = "(G_TYPE_INSTANCE_GET_INTERFACE ((obj), %s, %s))".printf (iface.get_type_id (), iface.get_type_cname ());
+ decl_frag.append (new CCodeMacroReplacement ("%s_GET_INTERFACE(obj)".printf (iface.get_upper_case_cname (null)), macro));
+ decl_frag.append (new CCodeNewline ());
+
+
+ if (iface.source_reference.file.cycle == null) {
+ decl_frag.append (new CCodeTypeDefinition ("struct _%s".printf (iface.get_cname ()), new CCodeVariableDeclarator (iface.get_cname ())));
+ decl_frag.append (new CCodeTypeDefinition ("struct %s".printf (codegen.type_struct.name), new CCodeVariableDeclarator (iface.get_type_cname ())));
}
+
+ codegen.type_struct.add_field ("GTypeInterface", "parent_iface");
+
+ if (iface.source_reference.comment != null) {
+ def_frag.append (new CCodeComment (iface.source_reference.comment));
+ }
+ def_frag.append (codegen.type_struct);
iface.accept_children (codegen);
- if (!iface.is_static) {
- add_interface_base_init_function (iface);
+ add_interface_base_init_function (iface);
- var type_fun = new InterfaceRegisterFunction (iface, codegen);
- type_fun.init_from_type ();
- if (iface.access != SymbolAccessibility.PRIVATE) {
- codegen.header_type_member_declaration.append (type_fun.get_declaration ());
- } else {
- codegen.source_type_member_declaration.append (type_fun.get_declaration ());
- }
- codegen.source_type_member_definition.append (type_fun.get_definition ());
+ var type_fun = new InterfaceRegisterFunction (iface, codegen);
+ type_fun.init_from_type ();
+ if (iface.access != SymbolAccessibility.PRIVATE) {
+ codegen.header_type_member_declaration.append (type_fun.get_declaration ());
+ } else {
+ codegen.source_type_member_declaration.append (type_fun.get_declaration ());
}
+ codegen.source_type_member_definition.append (type_fun.get_definition ());
codegen.current_type_symbol = null;
}
Modified: trunk/vala/valaclass.vala
==============================================================================
--- trunk/vala/valaclass.vala (original)
+++ trunk/vala/valaclass.vala Sun Nov 2 18:50:38 2008
@@ -39,12 +39,6 @@
public bool is_abstract { get; set; }
/**
- * Specifies whether this class is static. Static classes may not be
- * instantiated and may only contain static members.
- */
- public bool is_static { get; set; }
-
- /**
* Instances of compact classes are fast to create and have a
* compact memory layout. Compact classes don't support runtime
* type information or virtual methods.
Modified: trunk/vala/valagenieparser.vala
==============================================================================
--- trunk/vala/valagenieparser.vala (original)
+++ trunk/vala/valagenieparser.vala Sun Nov 2 18:50:38 2008
@@ -2403,10 +2403,6 @@
if (ModifierFlags.ABSTRACT in flags) {
cl.is_abstract = true;
}
- if (ModifierFlags.STATIC in flags) {
- cl.is_static = true;
- Report.warning (get_last_src (), "static classes are deprecated, use namespaces");
- }
set_attributes (cl, attrs);
foreach (TypeParameter type_param in type_param_list) {
cl.add_type_parameter (type_param);
@@ -2421,7 +2417,7 @@
// ensure there is always a default construction method
if (!scanner.source_file.external_package
- && !cl.is_static && !cl.is_abstract
+ && !cl.is_abstract
&& cl.default_construction_method == null) {
var m = new CreationMethod (cl.name, null, cl.source_reference);
m.binding = MemberBinding.STATIC;
Modified: trunk/vala/valainterface.vala
==============================================================================
--- trunk/vala/valainterface.vala (original)
+++ trunk/vala/valainterface.vala Sun Nov 2 18:50:38 2008
@@ -27,12 +27,6 @@
* Represents a class declaration in the source code.
*/
public class Vala.Interface : ObjectTypeSymbol {
- /**
- * Specifies whether this interface is static. Static interfaces are not
- * available at run-time. They can be implemented by structs.
- */
- public bool is_static { get; set; }
-
private Gee.List<TypeParameter> type_parameters = new ArrayList<TypeParameter> ();
private Gee.List<DataType> prerequisites = new ArrayList<DataType> ();
Modified: trunk/vala/valainterfacewriter.vala
==============================================================================
--- trunk/vala/valainterfacewriter.vala (original)
+++ trunk/vala/valainterfacewriter.vala Sun Nov 2 18:50:38 2008
@@ -172,9 +172,7 @@
write_indent ();
write_accessibility (cl);
- if (cl.is_static) {
- write_string ("static ");
- } else if (cl.is_abstract) {
+ if (cl.is_abstract) {
write_string ("abstract ");
}
write_string ("class ");
Modified: trunk/vala/valaparser.vala
==============================================================================
--- trunk/vala/valaparser.vala (original)
+++ trunk/vala/valaparser.vala Sun Nov 2 18:50:38 2008
@@ -1960,10 +1960,6 @@
if (ModifierFlags.ABSTRACT in flags) {
cl.is_abstract = true;
}
- if (ModifierFlags.STATIC in flags) {
- cl.is_static = true;
- Report.warning (get_last_src (), "static classes are deprecated, use namespaces");
- }
if (ModifierFlags.EXTERN in flags || scanner.source_file.external_package) {
cl.external = true;
}
@@ -1979,7 +1975,7 @@
// ensure there is always a default construction method
if (!scanner.source_file.external_package
- && !cl.is_static && !cl.is_abstract
+ && !cl.is_abstract
&& cl.default_construction_method == null) {
var m = new CreationMethod (cl.name, null, cl.source_reference);
m.access = SymbolAccessibility.PUBLIC;
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Sun Nov 2 18:50:38 2008
@@ -2744,13 +2744,6 @@
return;
}
- if (cl.is_static) {
- expr.value_type = null;
- expr.error = true;
- Report.error (expr.source_reference, "Can't create instance of static class `%s'".printf (cl.get_full_name ()));
- return;
- }
-
if (expr.symbol_reference == null) {
expr.symbol_reference = cl.default_construction_method;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]