Commit 9a509bce authored by Jürg Billeter's avatar Jürg Billeter

Do not depend on uint64 in semantic analyzer

parent 744e341f
......@@ -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");
}
......
......@@ -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");
}
......
......@@ -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"));
......
/* 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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment