From: Jürg Billeter Date: Tue, 5 May 2009 21:21:30 +0000 (+0200) Subject: Do not depend on uint64 in semantic analyzer X-Git-Tag: 0.7.2~22 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9a509bce2e652fe085cba8fa5d5598394e2187c6;p=thirdparty%2Fvala.git Do not depend on uint64 in semantic analyzer --- diff --git a/vala/valaarraycreationexpression.vala b/vala/valaarraycreationexpression.vala index 6ed9d0c38..8b8049c4f 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 b65168668..2097efa18 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 3655916e7..45de1a9b6 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 0fd5b8383..a66a284b7 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;