vala r1894 - in trunk: . gobject vala



Author: juergbi
Date: Fri Oct 24 13:36:45 2008
New Revision: 1894
URL: http://svn.gnome.org/viewvc/vala?rev=1894&view=rev

Log:
2008-10-24  JÃrg Billeter  <j bitron ch>

	* gobject/Makefile.am:
	* gobject/valaccodeassignmentmodule.vala:
	* gobject/valaccodebinding.vala:
	* gobject/valaccodegenerator.vala:
	* gobject/valaccodemodule.vala:
	* vala/valaassignment.vala:
	* vala/valacodegenerator.vala:

	Add CCodeAssignmentModule


Added:
   trunk/gobject/valaccodeassignmentmodule.vala   (contents, props changed)
      - copied, changed from r1889, /trunk/gobject/valaccodeassignmentbinding.vala
Removed:
   trunk/gobject/valaccodeassignmentbinding.vala
Modified:
   trunk/ChangeLog
   trunk/gobject/Makefile.am
   trunk/gobject/valaccodebinding.vala
   trunk/gobject/valaccodegenerator.vala
   trunk/gobject/valaccodemodule.vala
   trunk/vala/valaassignment.vala
   trunk/vala/valacodegenerator.vala

Modified: trunk/gobject/Makefile.am
==============================================================================
--- trunk/gobject/Makefile.am	(original)
+++ trunk/gobject/Makefile.am	Fri Oct 24 13:36:45 2008
@@ -13,7 +13,7 @@
 
 libvala_la_VALASOURCES = \
 	valaccodearraymodule.vala \
-	valaccodeassignmentbinding.vala \
+	valaccodeassignmentmodule.vala \
 	valaccodebasemodule.vala \
 	valaccodebinding.vala \
 	valaccodecompiler.vala \

Copied: trunk/gobject/valaccodeassignmentmodule.vala (from r1889, /trunk/gobject/valaccodeassignmentbinding.vala)
==============================================================================
--- /trunk/gobject/valaccodeassignmentbinding.vala	(original)
+++ trunk/gobject/valaccodeassignmentmodule.vala	Fri Oct 24 13:36:45 2008
@@ -1,4 +1,4 @@
-/* valaccodeassignmentbinding.vala
+/* valaccodeassignmentmodule.vala
  *
  * Copyright (C) 2006-2008  JÃrg Billeter, Raffaele Sandrini
  *
@@ -27,15 +27,12 @@
 /**
  * The link between an assignment and generated code.
  */
-public class Vala.CCodeAssignmentBinding : CCodeBinding {
-	public Assignment assignment { get; set; }
-
-	public CCodeAssignmentBinding (CCodeGenerator codegen, Assignment assignment) {
-		this.assignment = assignment;
-		this.codegen = codegen;
+public class Vala.CCodeAssignmentModule : CCodeModule {
+	public CCodeAssignmentModule (CCodeGenerator codegen, CCodeModule? next) {
+		base (codegen, next);
 	}
 
-	CCodeExpression emit_property_assignment () {
+	CCodeExpression emit_property_assignment (Assignment assignment) {
 		var ma = assignment.left as MemberAccess;
 
 		var prop = (Property) assignment.left.symbol_reference;
@@ -92,7 +89,7 @@
 		}
 	}
 
-	CCodeExpression? emit_signal_assignment () {
+	CCodeExpression? emit_signal_assignment (Assignment assignment) {
 		var sig = (Signal) assignment.left.symbol_reference;
 		
 		var m = (Method) assignment.right.symbol_reference;
@@ -231,7 +228,7 @@
 		return ccall;
 	}
 
-	private CCodeExpression? emit_non_array_element_access () {
+	private CCodeExpression? emit_non_array_element_access (Assignment assignment) {
 		// custom element access
 		CCodeExpression rhs = (CCodeExpression) assignment.right.ccodenode;
 
@@ -277,7 +274,7 @@
 		}
 	}
 
-	CCodeExpression emit_simple_assignment () {
+	CCodeExpression emit_simple_assignment (Assignment assignment) {
 		CCodeExpression rhs = (CCodeExpression) assignment.right.ccodenode;
 
 		bool unref_old = codegen.requires_destroy (assignment.left.value_type);
@@ -366,7 +363,7 @@
 		return codenode;
 	}
 
-	public override void emit () {
+	public override void visit_assignment (Assignment assignment) {
 		assignment.right.accept (codegen);
 
 		if (assignment.left.error || assignment.right.error) {
@@ -375,15 +372,15 @@
 		}
 
 		if (assignment.left.symbol_reference is Property) {
-			assignment.ccodenode = emit_property_assignment ();
+			assignment.ccodenode = emit_property_assignment (assignment);
 		} else if (assignment.left.symbol_reference is Signal) {
-			assignment.ccodenode = emit_signal_assignment ();
+			assignment.ccodenode = emit_signal_assignment (assignment);
 		} else if (assignment.left is ElementAccess
 		           && !(((ElementAccess) assignment.left).container.value_type is ArrayType)
 		           && !(((ElementAccess) assignment.left).container.value_type is PointerType)) {
-			assignment.ccodenode = emit_non_array_element_access ();
+			assignment.ccodenode = emit_non_array_element_access (assignment);
 		} else {
-			assignment.ccodenode = emit_simple_assignment ();
+			assignment.ccodenode = emit_simple_assignment (assignment);
 		}
 	}
 }

Modified: trunk/gobject/valaccodebinding.vala
==============================================================================
--- trunk/gobject/valaccodebinding.vala	(original)
+++ trunk/gobject/valaccodebinding.vala	Fri Oct 24 13:36:45 2008
@@ -44,8 +44,4 @@
 	public CCodeBinding? code_binding (CodeNode node) {
 		return (CCodeBinding) node.get_code_binding (codegen);
 	}
-
-	public CCodeAssignmentBinding assignment_binding (Assignment node) {
-		return (CCodeAssignmentBinding) node.get_code_binding (codegen);
-	}
 }

Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala	(original)
+++ trunk/gobject/valaccodegenerator.vala	Fri Oct 24 13:36:45 2008
@@ -145,6 +145,7 @@
 		head = new CCodeMethodModule (this, head);
 		head = new CCodeMemberAccessModule (this, head);
 		head = new CCodeElementAccessModule (this, head);
+		head = new CCodeAssignmentModule (this, head);
 		head = new CCodeInvocationExpressionModule (this, head);
 		head = new CCodeArrayModule (this, head);
 		head = new GObjectModule (this, head);
@@ -4124,7 +4125,7 @@
 	}
 
 	public override void visit_assignment (Assignment a) {
-		code_binding (a).emit ();
+		head.visit_assignment (a);
 	}
 
 	public CCodeFunctionCall get_property_set_call (Property prop, MemberAccess ma, CCodeExpression cexpr) {
@@ -4374,10 +4375,6 @@
 		return new CCodeDynamicSignalBinding (this, node);
 	}
 
-	public override CodeBinding? create_assignment_binding (Assignment node) {
-		return new CCodeAssignmentBinding (this, node);
-	}
-
 	public CCodeBinding? code_binding (CodeNode node) {
 		return (CCodeBinding) node.get_code_binding (this);
 	}
@@ -4389,8 +4386,4 @@
 	public CCodeDynamicSignalBinding dynamic_signal_binding (DynamicSignal node) {
 		return (CCodeDynamicSignalBinding) node.get_code_binding (this);
 	}
-
-	public CCodeAssignmentBinding assignment_binding (Assignment node) {
-		return (CCodeAssignmentBinding) node.get_code_binding (this);
-	}
 }

Modified: trunk/gobject/valaccodemodule.vala
==============================================================================
--- trunk/gobject/valaccodemodule.vala	(original)
+++ trunk/gobject/valaccodemodule.vala	Fri Oct 24 13:36:45 2008
@@ -76,6 +76,10 @@
 		next.visit_element_access (expr);
 	}
 
+	public virtual void visit_assignment (Assignment assignment) {
+		next.visit_assignment (assignment);
+	}
+
 	public virtual void visit_invocation_expression (InvocationExpression expr) {
 		next.visit_invocation_expression (expr);
 	}

Modified: trunk/vala/valaassignment.vala
==============================================================================
--- trunk/vala/valaassignment.vala	(original)
+++ trunk/vala/valaassignment.vala	Fri Oct 24 13:36:45 2008
@@ -97,10 +97,6 @@
 	public override bool is_pure () {
 		return false;
 	}
-
-	public override CodeBinding? create_code_binding (CodeGenerator codegen) {
-		return codegen.create_assignment_binding (this);
-	}
 }
 	
 public enum Vala.AssignmentOperator {

Modified: trunk/vala/valacodegenerator.vala
==============================================================================
--- trunk/vala/valacodegenerator.vala	(original)
+++ trunk/vala/valacodegenerator.vala	Fri Oct 24 13:36:45 2008
@@ -41,8 +41,4 @@
 	public virtual CodeBinding? create_dynamic_signal_binding (DynamicSignal node) {
 		return null;
 	}
-
-	public virtual CodeBinding? create_assignment_binding (Assignment node) {
-		return null;
-	}
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]