Commit ad1918cb authored by Jürg Billeter's avatar Jürg Billeter Committed by Jürg Billeter

Add CCodeArrayModule

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

	* vala/valaarraycreationexpression.vala:
	* vala/valacodegenerator.vala:
	* gobject/Makefile.am:
	* gobject/valaccodearraymodule.vala:
	* gobject/valaccodebinding.vala:
	* gobject/valaccodegenerator.vala:
	* gobject/valaccodemodule.vala:

	Add CCodeArrayModule

svn path=/trunk/; revision=1890
parent afccf51c
2008-10-24 Jürg Billeter <j@bitron.ch>
* vala/valaarraycreationexpression.vala:
* vala/valacodegenerator.vala:
* gobject/Makefile.am:
* gobject/valaccodearraymodule.vala:
* gobject/valaccodebinding.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodemodule.vala:
Add CCodeArrayModule
2008-10-24 Jürg Billeter <j@bitron.ch>
* gobject/Makefile.am:
......
......@@ -12,7 +12,7 @@ lib_LTLIBRARIES = \
$(NULL)
libvala_la_VALASOURCES = \
valaccodearraycreationexpressionbinding.vala \
valaccodearraymodule.vala \
valaccodeassignmentbinding.vala \
valaccodebasemodule.vala \
valaccodebinding.vala \
......
/* valaccodearraycreationexpressionbinding.vala
/* valaccodearraymodule.vala
*
* Copyright (C) 2006-2008 Jürg Billeter, Raffaele Sandrini
*
......@@ -27,17 +27,12 @@ using Gee;
/**
* The link between an assignment and generated code.
*/
public class Vala.CCodeArrayCreationExpressionBinding : CCodeBinding {
public ArrayCreationExpression array_creation_expression { get; set; }
public CCodeArrayCreationExpressionBinding (CCodeGenerator codegen, ArrayCreationExpression array_creation_expression) {
this.array_creation_expression = array_creation_expression;
this.codegen = codegen;
public class Vala.CCodeArrayModule : CCodeModule {
public CCodeArrayModule (CCodeGenerator codegen, CCodeModule? next) {
base (codegen, next);
}
public override void emit () {
var expr = array_creation_expression;
public override void visit_array_creation_expression (ArrayCreationExpression expr) {
expr.accept_children (codegen);
var gnew = new CCodeFunctionCall (new CCodeIdentifier ("g_new0"));
......
......@@ -45,10 +45,6 @@ public abstract class Vala.CCodeBinding : CodeBinding {
return (CCodeBinding) node.get_code_binding (codegen);
}
public CCodeArrayCreationExpressionBinding array_creation_expression_binding (ArrayCreationExpression node) {
return (CCodeArrayCreationExpressionBinding) node.get_code_binding (codegen);
}
public CCodeElementAccessBinding element_access_binding (ElementAccess node) {
return (CCodeElementAccessBinding) node.get_code_binding (codegen);
}
......
......@@ -143,6 +143,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
public CCodeGenerator () {
head = new CCodeBaseModule (this, head);
head = new CCodeMethodModule (this, head);
head = new CCodeArrayModule (this, head);
head = new GObjectModule (this, head);
head = new GObjectClassModule (this, head);
head = new GObjectInterfaceModule (this, head);
......@@ -2782,7 +2783,7 @@ public class Vala.CCodeGenerator : CodeGenerator {
}
public override void visit_array_creation_expression (ArrayCreationExpression expr) {
code_binding (expr).emit ();
head.visit_array_creation_expression (expr);
}
public override void visit_boolean_literal (BooleanLiteral expr) {
......@@ -4372,10 +4373,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
return new CCodeDynamicSignalBinding (this, node);
}
public override CodeBinding? create_array_creation_expression_binding (ArrayCreationExpression node) {
return new CCodeArrayCreationExpressionBinding (this, node);
}
public override CodeBinding? create_member_access_binding (MemberAccess node) {
return new CCodeMemberAccessBinding (this, node);
}
......@@ -4404,10 +4401,6 @@ public class Vala.CCodeGenerator : CodeGenerator {
return (CCodeDynamicSignalBinding) node.get_code_binding (this);
}
public CCodeArrayCreationExpressionBinding array_creation_expression_binding (ArrayCreationExpression node) {
return (CCodeArrayCreationExpressionBinding) node.get_code_binding (this);
}
public CCodeElementAccessBinding element_access_binding (ElementAccess node) {
return (CCodeElementAccessBinding) node.get_code_binding (this);
}
......
......@@ -68,6 +68,10 @@ public abstract class Vala.CCodeModule {
next.visit_creation_method (m);
}
public virtual void visit_array_creation_expression (ArrayCreationExpression expr) {
next.visit_array_creation_expression (expr);
}
public virtual void generate_cparameters (Method m, DataType creturn_type, bool in_gtypeinstance_creation_method, Map<int,CCodeFormalParameter> cparam_map, CCodeFunction func, CCodeFunctionDeclarator? vdeclarator = null, Map<int,CCodeExpression>? carg_map = null, CCodeFunctionCall? vcall = null) {
next.generate_cparameters (m, creturn_type, in_gtypeinstance_creation_method, cparam_map, func, vdeclarator, carg_map, vcall);
}
......
......@@ -106,8 +106,4 @@ public class Vala.ArrayCreationExpression : Expression {
element_type = new_type;
}
}
public override CodeBinding? create_code_binding (CodeGenerator codegen) {
return codegen.create_array_creation_expression_binding (this);
}
}
......@@ -42,10 +42,6 @@ public class Vala.CodeGenerator : CodeVisitor {
return null;
}
public virtual CodeBinding? create_array_creation_expression_binding (ArrayCreationExpression node) {
return null;
}
public virtual CodeBinding? create_member_access_binding (MemberAccess node) {
return null;
}
......
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