vala r991 - in trunk: . vala
- From: juergbi svn gnome org
- To: svn-commits-list gnome org
- Subject: vala r991 - in trunk: . vala
- Date: Thu, 7 Feb 2008 17:36:38 +0000 (GMT)
Author: juergbi
Date: Thu Feb 7 17:36:38 2008
New Revision: 991
URL: http://svn.gnome.org/viewvc/vala?rev=991&view=rev
Log:
2008-02-07 Juerg Billeter <j bitron ch>
* vala/valasemanticanalyzer.vala: allow pointer arithmetic
Modified:
trunk/ChangeLog
trunk/vala/valasemanticanalyzer.vala
Modified: trunk/vala/valasemanticanalyzer.vala
==============================================================================
--- trunk/vala/valasemanticanalyzer.vala (original)
+++ trunk/vala/valasemanticanalyzer.vala Thu Feb 7 17:36:38 2008
@@ -2453,7 +2453,21 @@
|| expr.operator == BinaryOperator.MINUS
|| expr.operator == BinaryOperator.MUL
|| expr.operator == BinaryOperator.DIV) {
- expr.static_type = get_arithmetic_result_type (expr.left.static_type, expr.right.static_type);
+ // check for pointer arithmetic
+ if (expr.left.static_type is PointerType) {
+ var offset_type = expr.right.static_type.data_type as Struct;
+ if (offset_type != null && offset_type.is_integer_type ()) {
+ if (expr.operator == BinaryOperator.PLUS
+ || expr.operator == BinaryOperator.MINUS) {
+ // pointer arithmetic
+ expr.static_type = expr.left.static_type.copy ();
+ }
+ }
+ }
+
+ if (expr.static_type == null) {
+ expr.static_type = get_arithmetic_result_type (expr.left.static_type, expr.right.static_type);
+ }
if (expr.static_type == null) {
expr.error = true;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]