Move Domain class to Utils header

This commit is contained in:
2018-04-22 14:43:15 +02:00
parent 529aec15af
commit 2b62c6227d
7 changed files with 41 additions and 66 deletions

View File

@@ -2,7 +2,7 @@
#define __ANTHEM__AST_H
#include <anthem/ASTForward.h>
#include <anthem/Domain.h>
#include <anthem/Utils.h>
namespace anthem
{

View File

@@ -14,7 +14,7 @@ namespace anthem
struct DefaultVariableDomainAccessor
{
ast::Domain operator()(const ast::Variable &variable)
Domain operator()(const ast::Variable &variable)
{
return variable.declaration->domain;
}
@@ -59,11 +59,11 @@ struct IsTermArithmeticVisitor
{
switch (function.declaration->domain)
{
case ast::Domain::General:
case Domain::General:
return EvaluationResult::False;
case ast::Domain::Integer:
case Domain::Integer:
return EvaluationResult::True;
case ast::Domain::Unknown:
case Domain::Unknown:
return EvaluationResult::Unknown;
}
@@ -127,11 +127,11 @@ struct IsTermArithmeticVisitor
switch (domain)
{
case ast::Domain::General:
case Domain::General:
return EvaluationResult::False;
case ast::Domain::Integer:
case Domain::Integer:
return EvaluationResult::True;
case ast::Domain::Unknown:
case Domain::Unknown:
return EvaluationResult::Unknown;
}
@@ -184,11 +184,11 @@ struct IsTermIntegerVisitor
{
switch (function.declaration->domain)
{
case ast::Domain::General:
case Domain::General:
return EvaluationResult::False;
case ast::Domain::Integer:
case Domain::Integer:
return EvaluationResult::True;
case ast::Domain::Unknown:
case Domain::Unknown:
return EvaluationResult::Unknown;
}
@@ -236,11 +236,11 @@ struct IsTermIntegerVisitor
{
switch (variable.declaration->domain)
{
case ast::Domain::General:
case Domain::General:
return EvaluationResult::False;
case ast::Domain::Integer:
case Domain::Integer:
return EvaluationResult::True;
case ast::Domain::Unknown:
case Domain::Unknown:
return EvaluationResult::Unknown;
}

View File

@@ -1,27 +0,0 @@
#ifndef __ANTHEM__DOMAIN_H
#define __ANTHEM__DOMAIN_H
namespace anthem
{
namespace ast
{
////////////////////////////////////////////////////////////////////////////////////////////////////
//
// Domain
//
////////////////////////////////////////////////////////////////////////////////////////////////////
enum class Domain
{
General,
Integer,
Unknown,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
}
#endif

View File

@@ -237,7 +237,7 @@ struct StatementVisitor
const size_t arity = aritySymbol.number();
auto functionDeclaration = context.findOrCreateFunctionDeclaration(function.name, arity);
functionDeclaration->domain = ast::Domain::Integer;
functionDeclaration->domain = Domain::Integer;
return true;
};

View File

@@ -1,13 +1,6 @@
#ifndef __ANTHEM__UTILS_H
#define __ANTHEM__UTILS_H
#include <iostream>
#include <clingo.hh>
#include <anthem/Context.h>
#include <anthem/Location.h>
namespace anthem
{
@@ -50,6 +43,15 @@ enum class OperationResult
////////////////////////////////////////////////////////////////////////////////////////////////////
enum class Domain
{
General,
Integer,
Unknown,
};
////////////////////////////////////////////////////////////////////////////////////////////////////
}
#endif