vala r1889 - in trunk: . gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1889 - in trunk: . gobject
- Date: Fri, 24 Oct 2008 13:04:44 +0000 (UTC)
Author: juergbi
Date: Fri Oct 24 13:04:44 2008
New Revision: 1889
URL: http://svn.gnome.org/viewvc/vala?rev=1889&view=rev
Log:
2008-10-24 JÃrg Billeter <j bitron ch>
* gobject/Makefile.am:
* gobject/valaccodearraycreationexpressionbinding.vala:
* gobject/valaccodeassignmentbinding.vala:
* gobject/valaccodeelementaccessbinding.vala:
* gobject/valaccodeexpressionbinding.vala:
* gobject/valaccodeinvocationexpressionbinding.vala:
* gobject/valaccodememberaccessbinding.vala:
Remove CCodeExpressionBinding
Removed:
trunk/gobject/valaccodeexpressionbinding.vala
Modified:
trunk/ChangeLog
trunk/gobject/Makefile.am
trunk/gobject/valaccodearraycreationexpressionbinding.vala
trunk/gobject/valaccodeassignmentbinding.vala
trunk/gobject/valaccodeelementaccessbinding.vala
trunk/gobject/valaccodeinvocationexpressionbinding.vala
trunk/gobject/valaccodememberaccessbinding.vala
Modified: trunk/gobject/Makefile.am
==============================================================================
--- trunk/gobject/Makefile.am (original)
+++ trunk/gobject/Makefile.am Fri Oct 24 13:04:44 2008
@@ -20,7 +20,6 @@
valaccodedynamicpropertybinding.vala \
valaccodedynamicsignalbinding.vala \
valaccodeelementaccessbinding.vala \
- valaccodeexpressionbinding.vala \
valaccodegenerator.vala \
valaccodegeneratorsignal.vala \
valaccodegeneratorsourcefile.vala \
Modified: trunk/gobject/valaccodearraycreationexpressionbinding.vala
==============================================================================
--- trunk/gobject/valaccodearraycreationexpressionbinding.vala (original)
+++ trunk/gobject/valaccodearraycreationexpressionbinding.vala Fri Oct 24 13:04:44 2008
@@ -27,7 +27,7 @@
/**
* The link between an assignment and generated code.
*/
-public class Vala.CCodeArrayCreationExpressionBinding : CCodeExpressionBinding {
+public class Vala.CCodeArrayCreationExpressionBinding : CCodeBinding {
public ArrayCreationExpression array_creation_expression { get; set; }
public CCodeArrayCreationExpressionBinding (CCodeGenerator codegen, ArrayCreationExpression array_creation_expression) {
@@ -97,11 +97,9 @@
ce.append_expression (name_cnode);
- codenode = ce;
+ expr.ccodenode = ce;
} else {
- codenode = gnew;
+ expr.ccodenode = gnew;
}
-
- expr.ccodenode = codenode;
}
}
Modified: trunk/gobject/valaccodeassignmentbinding.vala
==============================================================================
--- trunk/gobject/valaccodeassignmentbinding.vala (original)
+++ trunk/gobject/valaccodeassignmentbinding.vala Fri Oct 24 13:04:44 2008
@@ -27,7 +27,7 @@
/**
* The link between an assignment and generated code.
*/
-public class Vala.CCodeAssignmentBinding : CCodeExpressionBinding {
+public class Vala.CCodeAssignmentBinding : CCodeBinding {
public Assignment assignment { get; set; }
public CCodeAssignmentBinding (CCodeGenerator codegen, Assignment assignment) {
@@ -35,13 +35,13 @@
this.codegen = codegen;
}
- private void emit_property_assignment () {
+ CCodeExpression emit_property_assignment () {
var ma = assignment.left as MemberAccess;
var prop = (Property) assignment.left.symbol_reference;
if (prop.set_accessor.construction && codegen.current_type_symbol is Class && codegen.current_class.is_subtype_of (codegen.gobject_type) && codegen.in_creation_method) {
- codenode = head.get_construct_property_assignment (prop.get_canonical_cconstant (), prop.property_type, (CCodeExpression) assignment.right.ccodenode);
+ return head.get_construct_property_assignment (prop.get_canonical_cconstant (), prop.property_type, (CCodeExpression) assignment.right.ccodenode);
} else {
CCodeExpression cexpr = (CCodeExpression) assignment.right.ccodenode;
@@ -85,14 +85,14 @@
ccomma.append_expression (ccall); // update property
ccomma.append_expression ((CCodeExpression) codegen.get_ccodenode (ma)); // current property value
- codenode = ccomma;
+ return ccomma;
} else {
- codenode = ccall;
+ return ccall;
}
}
}
- private void emit_signal_assignment () {
+ CCodeExpression? emit_signal_assignment () {
var sig = (Signal) assignment.left.symbol_reference;
var m = (Method) assignment.right.symbol_reference;
@@ -119,7 +119,7 @@
} else {
assignment.error = true;
Report.error (assignment.source_reference, "Specified compound assignment type for signals not supported.");
- return;
+ return null;
}
var ccall = new CCodeFunctionCall (new CCodeIdentifier (connect_func));
@@ -135,7 +135,7 @@
if (detail_expr == null) {
assignment.error = true;
Report.error (detail_expr.source_reference, "internal error: only literal string details supported");
- return;
+ return null;
}
signal_detail = detail_expr.eval ();
} else {
@@ -228,10 +228,10 @@
ccall.add_argument (new CCodeConstant ("NULL"));
}
- codenode = ccall;
+ return ccall;
}
- private void emit_non_array_element_access () {
+ private CCodeExpression? emit_non_array_element_access () {
// custom element access
CCodeExpression rhs = (CCodeExpression) assignment.right.ccodenode;
@@ -269,14 +269,15 @@
set_ccall.add_argument (cindex);
set_ccall.add_argument (codegen.convert_to_generic_pointer (rhs, expr.value_type));
- codenode = set_ccall;
+ return set_ccall;
} else {
Report.error (assignment.source_reference, "internal error: unsupported element access");
assignment.error = true;
+ return null;
}
}
- private void emit_simple_assignment () {
+ CCodeExpression emit_simple_assignment () {
CCodeExpression rhs = (CCodeExpression) assignment.right.ccodenode;
bool unref_old = codegen.requires_destroy (assignment.left.value_type);
@@ -342,7 +343,7 @@
cop = CCodeAssignmentOperator.SHIFT_RIGHT;
}
- codenode = new CCodeAssignment ((CCodeExpression) codegen.get_ccodenode (assignment.left), rhs, cop);
+ CCodeExpression codenode = new CCodeAssignment ((CCodeExpression) codegen.get_ccodenode (assignment.left), rhs, cop);
if (unref_old && codegen.get_ccodenode (assignment.left) is CCodeElementAccess) {
// ensure that index expression in element access doesn't get evaluated more than once
@@ -361,6 +362,8 @@
codenode = ccomma;
}
}
+
+ return codenode;
}
public override void emit () {
@@ -372,17 +375,15 @@
}
if (assignment.left.symbol_reference is Property) {
- emit_property_assignment ();
+ assignment.ccodenode = emit_property_assignment ();
} else if (assignment.left.symbol_reference is Signal) {
- emit_signal_assignment ();
+ assignment.ccodenode = emit_signal_assignment ();
} else if (assignment.left is ElementAccess
&& !(((ElementAccess) assignment.left).container.value_type is ArrayType)
&& !(((ElementAccess) assignment.left).container.value_type is PointerType)) {
- emit_non_array_element_access ();
+ assignment.ccodenode = emit_non_array_element_access ();
} else {
- emit_simple_assignment ();
+ assignment.ccodenode = emit_simple_assignment ();
}
-
- assignment.ccodenode = codenode;
}
}
Modified: trunk/gobject/valaccodeelementaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodeelementaccessbinding.vala (original)
+++ trunk/gobject/valaccodeelementaccessbinding.vala Fri Oct 24 13:04:44 2008
@@ -27,7 +27,7 @@
/**
* The link between an element access and generated code.
*/
-public class Vala.CCodeElementAccessBinding : CCodeExpressionBinding {
+public class Vala.CCodeElementAccessBinding : CCodeBinding {
public ElementAccess element_access { get; set; }
public CCodeElementAccessBinding (CCodeGenerator codegen, ElementAccess element_access) {
@@ -51,7 +51,7 @@
var memberaccess = expr.container as MemberAccess;
if (lit != null && memberaccess != null) {
int dim = lit.value.to_int ();
- codenode = codegen.get_array_length_cexpression (memberaccess.inner, dim + 1);
+ expr.ccodenode = codegen.get_array_length_cexpression (memberaccess.inner, dim + 1);
}
} else if (container_type == codegen.string_type.data_type) {
// access to unichar in a string
@@ -62,7 +62,7 @@
var ccall = new CCodeFunctionCall (new CCodeIdentifier ("g_utf8_get_char"));
ccall.add_argument (coffsetcall);
- codenode = ccall;
+ expr.ccodenode = ccall;
} else if (container_type != null && codegen.list_type != null && codegen.map_type != null &&
(container_type.is_subtype_of (codegen.list_type) || container_type.is_subtype_of (codegen.map_type))) {
TypeSymbol collection_iface = null;
@@ -86,7 +86,7 @@
get_ccall.add_argument (new CCodeCastExpression (ccontainer, collection_iface.get_cname () + "*"));
get_ccall.add_argument (cindex);
- codenode = codegen.convert_from_generic_pointer (get_ccall, expr.value_type);
+ expr.ccodenode = codegen.convert_from_generic_pointer (get_ccall, expr.value_type);
} else if (expr.container is MemberAccess && expr.container.symbol_reference is Signal) {
// detailed signal emission
var sig = (Signal) expr.symbol_reference;
@@ -104,16 +104,14 @@
ccall.add_argument (sig.get_canonical_cconstant (signal_detail));
- codenode = ccall;
+ expr.ccodenode = ccall;
} else {
// access to element in an array
for (int i = 1; i < rank; i++) {
var cmul = new CCodeBinaryExpression (CCodeBinaryOperator.MUL, new CCodeParenthesizedExpression (cindex), codegen.get_array_length_cexpression (expr.container, i + 1));
cindex = new CCodeBinaryExpression (CCodeBinaryOperator.PLUS, cmul, new CCodeParenthesizedExpression ((CCodeExpression) indices[i].ccodenode));
}
- codenode = new CCodeElementAccess (ccontainer, cindex);
+ expr.ccodenode = new CCodeElementAccess (ccontainer, cindex);
}
-
- expr.ccodenode = codenode;
}
}
Modified: trunk/gobject/valaccodeinvocationexpressionbinding.vala
==============================================================================
--- trunk/gobject/valaccodeinvocationexpressionbinding.vala (original)
+++ trunk/gobject/valaccodeinvocationexpressionbinding.vala Fri Oct 24 13:04:44 2008
@@ -24,7 +24,7 @@
using GLib;
using Gee;
-public class Vala.CCodeInvocationExpressionBinding : CCodeExpressionBinding {
+public class Vala.CCodeInvocationExpressionBinding : CCodeBinding {
public InvocationExpression invocation_expression { get; set; }
public CCodeInvocationExpressionBinding (CCodeGenerator codegen, InvocationExpression invocation_expression) {
Modified: trunk/gobject/valaccodememberaccessbinding.vala
==============================================================================
--- trunk/gobject/valaccodememberaccessbinding.vala (original)
+++ trunk/gobject/valaccodememberaccessbinding.vala Fri Oct 24 13:04:44 2008
@@ -23,7 +23,7 @@
using GLib;
-public class Vala.CCodeMemberAccessBinding : CCodeExpressionBinding {
+public class Vala.CCodeMemberAccessBinding : CCodeBinding {
public MemberAccess member_access { get; set; }
public CCodeMemberAccessBinding (CCodeGenerator codegen, MemberAccess member_access) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]