vala r1503 - in trunk: . ccode gobject
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r1503 - in trunk: . ccode gobject
- Date: Fri, 30 May 2008 23:10:33 +0000 (UTC)
Author: juergbi
Date: Fri May 30 23:10:31 2008
New Revision: 1503
URL: http://svn.gnome.org/viewvc/vala?rev=1503&view=rev
Log:
2008-05-31 JÃrg Billeter <j bitron ch>
* ccode/valaccodeunaryexpression.vala:
* gobject/valaccodegenerator.vala:
* gobject/valaccodeinvocationexpressionbinding.vala:
Improvements to nullable struct support
Modified:
trunk/ChangeLog
trunk/ccode/valaccodeunaryexpression.vala
trunk/gobject/valaccodegenerator.vala
trunk/gobject/valaccodeinvocationexpressionbinding.vala
Modified: trunk/ccode/valaccodeunaryexpression.vala
==============================================================================
--- trunk/ccode/valaccodeunaryexpression.vala (original)
+++ trunk/ccode/valaccodeunaryexpression.vala Fri May 30 23:10:31 2008
@@ -51,7 +51,7 @@
} else if (operator == CCodeUnaryOperator.BITWISE_COMPLEMENT) {
writer.write_string ("~");
} else if (operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
- writer.write_string ("*");
+ writer.write_string ("(*");
} else if (operator == CCodeUnaryOperator.ADDRESS_OF) {
writer.write_string ("&");
} else if (operator == CCodeUnaryOperator.PREFIX_INCREMENT) {
@@ -66,6 +66,8 @@
writer.write_string ("++");
} else if (operator == CCodeUnaryOperator.POSTFIX_DECREMENT) {
writer.write_string ("--");
+ } else if (operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
+ writer.write_string (")");
}
}
}
Modified: trunk/gobject/valaccodegenerator.vala
==============================================================================
--- trunk/gobject/valaccodegenerator.vala (original)
+++ trunk/gobject/valaccodegenerator.vala Fri May 30 23:10:31 2008
@@ -3426,7 +3426,11 @@
if (boxing) {
// value needs to be boxed
- if (cexpr is CCodeIdentifier) {
+ var unary = cexpr as CCodeUnaryExpression;
+ if (unary != null && unary.operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
+ // *expr => expr
+ cexpr = unary.inner;
+ } else if (cexpr is CCodeIdentifier || cexpr is CCodeMemberAccess) {
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
} else {
var decl = get_temp_variable (expression_type, expression_type.value_owned, expression_type);
@@ -3462,7 +3466,7 @@
} else if (unboxing) {
// unbox value
- cexpr = new CCodeParenthesizedExpression (new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, cexpr));
+ cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.POINTER_INDIRECTION, cexpr);
} else {
cexpr = get_implicit_cast_expression (cexpr, expression_type, target_type, expr);
}
Modified: trunk/gobject/valaccodeinvocationexpressionbinding.vala
==============================================================================
--- trunk/gobject/valaccodeinvocationexpressionbinding.vala (original)
+++ trunk/gobject/valaccodeinvocationexpressionbinding.vala Fri May 30 23:10:31 2008
@@ -80,7 +80,11 @@
if (instance_expression_type.data_type is Struct
&& !((Struct) instance_expression_type.data_type).is_simple_type ()
&& instance_expression_type.data_type != codegen.current_type_symbol) {
- if (instance is CCodeIdentifier || instance is CCodeMemberAccess) {
+ var unary = instance as CCodeUnaryExpression;
+ if (unary != null && unary.operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
+ // *expr => expr
+ instance = unary.inner;
+ } else if (instance is CCodeIdentifier || instance is CCodeMemberAccess) {
instance = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, instance);
} else {
// if instance is e.g. a function call, we can't take the address of the expression
@@ -178,7 +182,11 @@
if (!(arg.value_type is NullType) && param.parameter_type.data_type is Struct && !((Struct) param.parameter_type.data_type).is_simple_type ()) {
// we already use a reference for arguments of ref, out, and nullable parameters
if (param.direction == ParameterDirection.IN && !param.parameter_type.nullable) {
- if (cexpr is CCodeIdentifier) {
+ var unary = cexpr as CCodeUnaryExpression;
+ if (unary != null && unary.operator == CCodeUnaryOperator.POINTER_INDIRECTION) {
+ // *expr => expr
+ cexpr = unary.inner;
+ } else if (cexpr is CCodeIdentifier || cexpr is CCodeMemberAccess) {
cexpr = new CCodeUnaryExpression (CCodeUnaryOperator.ADDRESS_OF, cexpr);
} else {
// if cexpr is e.g. a function call, we can't take the address of the expression
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]