[vala] Do not depend on uint64 in semantic analyzer



commit 9a509bce2e652fe085cba8fa5d5598394e2187c6
Author: Jürg Billeter <j bitron ch>
Date:   Tue May 5 23:21:30 2009 +0200

    Do not depend on uint64 in semantic analyzer
---
 vala/valaarraycreationexpression.vala |    2 +-
 vala/valaelementaccess.vala           |    2 +-
 vala/valasemanticanalyzer.vala        |    2 --
 vala/valaswitchstatement.vala         |    5 +++--
 4 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala
index 6ed9d0c..8b8049c 100644
--- a/vala/valaarraycreationexpression.vala
+++ b/vala/valaarraycreationexpression.vala
@@ -193,7 +193,7 @@ public class Vala.ArrayCreationExpression : Expression {
 				if (e.value_type == null) {
 					/* return on previous error */
 					return false;
-				} else if (!e.value_type.compatible (analyzer.uint64_type)) {
+				} else if (!(e.value_type is IntegerType)) {
 					error = true;
 					Report.error (e.source_reference, "Expression of integer type expected");
 				}
diff --git a/vala/valaelementaccess.vala b/vala/valaelementaccess.vala
index b651686..2097efa 100644
--- a/vala/valaelementaccess.vala
+++ b/vala/valaelementaccess.vala
@@ -187,7 +187,7 @@ public class Vala.ElementAccess : Expression {
 				}
 
 				/* check if the index is of type integer */
-				if (!e.value_type.compatible (analyzer.uint64_type)) {
+				if (!(e.value_type is IntegerType)) {
 					error = true;
 					Report.error (e.source_reference, "Expression of integer type expected");
 				}
diff --git a/vala/valasemanticanalyzer.vala b/vala/valasemanticanalyzer.vala
index 3655916..45de1a9 100644
--- a/vala/valasemanticanalyzer.vala
+++ b/vala/valasemanticanalyzer.vala
@@ -51,7 +51,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 	public DataType ulong_type;
 	public DataType size_t_type;
 	public DataType ssize_t_type;
-	public DataType uint64_type;
 	public DataType int8_type;
 	public DataType unichar_type;
 	public DataType double_type;
@@ -93,7 +92,6 @@ public class Vala.SemanticAnalyzer : CodeVisitor {
 		ulong_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ulong"));
 		size_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("size_t"));
 		ssize_t_type = new IntegerType ((Struct) root_symbol.scope.lookup ("ssize_t"));
-		uint64_type = new IntegerType ((Struct) root_symbol.scope.lookup ("uint64"));
 		int8_type = new IntegerType ((Struct) root_symbol.scope.lookup ("int8"));
 		unichar_type = new IntegerType ((Struct) root_symbol.scope.lookup ("unichar"));
 		double_type = new FloatingType ((Struct) root_symbol.scope.lookup ("double"));
diff --git a/vala/valaswitchstatement.vala b/vala/valaswitchstatement.vala
index 0fd5b83..a66a284 100644
--- a/vala/valaswitchstatement.vala
+++ b/vala/valaswitchstatement.vala
@@ -1,6 +1,6 @@
 /* valaswitchstatement.vala
  *
- * Copyright (C) 2006-2007  Jürg Billeter
+ * Copyright (C) 2006-2009  Jürg Billeter
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -106,7 +106,8 @@ public class Vala.SwitchStatement : CodeNode, Statement {
 			return false;
 		}
 
-		if (!expression.value_type.compatible (analyzer.uint64_type)
+		if (!(expression.value_type is IntegerType)
+		    && !(expression.value_type is EnumValueType)
 		    && !expression.value_type.compatible (analyzer.string_type)) {
 			Report.error (expression.source_reference, "Integer or string expression expected");
 			error = true;



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