Commit 4b8375f8 authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Add GObjectClassModule and GObjectInterfaceModule

2008-10-24  Jürg Billeter  <j@bitron.ch>

	* vala/valaclass.vala:
	* vala/valacodegenerator.vala:
	* vala/valainterface.vala:
	* gobject/Makefile.am:
	* gobject/valaccodegenerator.vala:
	* gobject/valaccodemodule.vala:
	* gobject/valagobjectclassmodule.vala:
	* gobject/valagobjectinterfacemodule.vala:

	Add GObjectClassModule and GObjectInterfaceModule

svn path=/trunk/; revision=1888
parent e168983c
2008-10-24 Jürg Billeter <j@bitron.ch>
* vala/valaclass.vala:
* vala/valacodegenerator.vala:
* vala/valainterface.vala:
* gobject/Makefile.am:
* gobject/valaccodegenerator.vala:
* gobject/valaccodemodule.vala:
* gobject/valagobjectclassmodule.vala:
* gobject/valagobjectinterfacemodule.vala:
Add GObjectClassModule and GObjectInterfaceModule
2008-10-24 Jürg Billeter <j@bitron.ch>
* gobject/Makefile.am:
......
......@@ -16,7 +16,6 @@ libvala_la_VALASOURCES = \
valaccodeassignmentbinding.vala \
valaccodebasemodule.vala \
valaccodebinding.vala \
valaccodeclassbinding.vala \
valaccodecompiler.vala \
valaccodedynamicpropertybinding.vala \
valaccodedynamicsignalbinding.vala \
......@@ -26,7 +25,6 @@ libvala_la_VALASOURCES = \
valaccodegeneratorsignal.vala \
valaccodegeneratorsourcefile.vala \
valaccodegeneratorstruct.vala \
valaccodeinterfacebinding.vala \
valaccodeinvocationexpressionbinding.vala \
valaccodememberaccessbinding.vala \
valaccodemethodmodule.vala \
......@@ -34,6 +32,8 @@ libvala_la_VALASOURCES = \
valaclassregisterfunction.vala \
valadbusmodule.vala \
valagirwriter.vala \
valagobjectclassmodule.vala \
valagobjectinterfacemodule.vala \
valagobjectmodule.vala \
valainterfaceregisterfunction.vala \
valatyperegisterfunction.vala \
......
......@@ -144,6 +144,8 @@ public class Vala.CCodeGenerator : CodeGenerator {
head = new CCodeBaseModule (this, head);
head = new CCodeMethodModule (this, head);
head = new GObjectModule (this, head);
head = new GObjectClassModule (this, head);
head = new GObjectInterfaceModule (this, head);
head = new DBusModule (this, head);
predefined_marshal_set = new HashSet<string> (str_hash, str_equal);
......@@ -291,11 +293,11 @@ public class Vala.CCodeGenerator : CodeGenerator {
}
public override void visit_class (Class cl) {
code_binding (cl).emit ();
head.visit_class (cl);
}
public override void visit_interface (Interface iface) {
code_binding (iface).emit ();
head.visit_interface (iface);
}
public override void visit_enum (Enum en) {
......@@ -4362,14 +4364,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
return node.ccodenode;
}
public override CodeBinding? create_class_binding (Class node) {
return new CCodeClassBinding (this, node);
}
public override CodeBinding? create_interface_binding (Interface node) {
return new CCodeInterfaceBinding (this, node);
}
public override CodeBinding? create_dynamic_property_binding (DynamicProperty node) {
return new CCodeDynamicPropertyBinding (this, node);
}
......
......@@ -52,6 +52,14 @@ public abstract class Vala.CCodeModule {
next.emit (context);
}
public virtual void visit_class (Class cl) {
next.visit_class (cl);
}
public virtual void visit_interface (Interface iface) {
next.visit_interface (iface);
}
public virtual void visit_method (Method m) {
next.visit_method (m);
}
......
/* valaccodeclassbinding.vala
/* valagobjectclassmodule.vala
*
* Copyright (C) 2006-2008 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,15 +23,12 @@
using GLib;
public class Vala.CCodeClassBinding : CCodeBinding {
public Class cl { get; set; }
public CCodeClassBinding (CCodeGenerator codegen, Class cl) {
this.cl = cl;
this.codegen = codegen;
public class Vala.GObjectClassModule : CCodeModule {
public GObjectClassModule (CCodeGenerator codegen, CCodeModule? next) {
base (codegen, next);
}
public override void emit () {
public override void visit_class (Class cl) {
var old_symbol = codegen.current_symbol;
var old_type_symbol = codegen.current_type_symbol;
var old_class = codegen.current_class;
......
/* valaccodeinterfacebinding.vala
/* valagobjectinterfacemodule.vala
*
* Copyright (C) 2006-2008 Jürg Billeter, Raffaele Sandrini
*
......@@ -23,15 +23,12 @@
using GLib;
public class Vala.CCodeInterfaceBinding : CCodeBinding {
public Interface iface { get; set; }
public CCodeInterfaceBinding (CCodeGenerator codegen, Interface iface) {
this.iface = iface;
this.codegen = codegen;
public class Vala.GObjectInterfaceModule : CCodeModule {
public GObjectInterfaceModule (CCodeGenerator codegen, CCodeModule? next) {
base (codegen, next);
}
public override void emit () {
public override void visit_interface (Interface iface) {
codegen.current_symbol = iface;
codegen.current_type_symbol = iface;
......
......@@ -817,9 +817,5 @@ public class Vala.Class : ObjectTypeSymbol {
}
}
}
public override CodeBinding? create_code_binding (CodeGenerator codegen) {
return codegen.create_class_binding (this);
}
}
......@@ -34,14 +34,6 @@ public class Vala.CodeGenerator : CodeVisitor {
public virtual void emit (CodeContext context) {
}
public virtual CodeBinding? create_class_binding (Class node) {
return null;
}
public virtual CodeBinding? create_interface_binding (Interface node) {
return null;
}
public virtual CodeBinding? create_dynamic_property_binding (DynamicProperty node) {
return null;
}
......
......@@ -530,10 +530,6 @@ public class Vala.Interface : ObjectTypeSymbol {
}
}
public override CodeBinding? create_code_binding (CodeGenerator codegen) {
return codegen.create_interface_binding (this);
}
public override string? get_param_spec_function () {
foreach (DataType prerequisite in prerequisites) {
var prereq = prerequisite as ObjectType;
......
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