/usr/include/Synopsis/TypeAnalysis/TypeEvaluator.hh is in libsynopsis0.12-dev 0.12-8.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | //
// Copyright (C) 2005 Stefan Seefeld
// All rights reserved.
// Licensed to the public under the terms of the GNU LGPL (>= 2),
// see the file COPYING for details.
//
#ifndef Synopsis_TypeAnalysis_TypeEvaluator_hh_
#define Synopsis_TypeAnalysis_TypeEvaluator_hh_
#include <Synopsis/PTree/Visitor.hh>
#include <Synopsis/PTree/Atoms.hh>
#include <Synopsis/PTree/Lists.hh>
#include <Synopsis/SymbolLookup/Scope.hh>
#include <Synopsis/TypeAnalysis/Type.hh>
namespace Synopsis
{
namespace TypeAnalysis
{
//. evaluate the type of an expression
class TypeEvaluator : private PTree::Visitor
{
public:
TypeEvaluator(SymbolLookup::Scope const *s) : my_scope(s) {}
Type const *evaluate(PTree::Node const *node);
private:
virtual void visit(PTree::Literal *);
virtual void visit(PTree::Identifier *);
virtual void visit(PTree::Kwd::This *);
virtual void visit(PTree::Name *);
virtual void visit(PTree::FstyleCastExpr *);
virtual void visit(PTree::AssignExpr *);
virtual void visit(PTree::CondExpr *);
virtual void visit(PTree::InfixExpr *);
virtual void visit(PTree::PmExpr *);
virtual void visit(PTree::CastExpr *);
virtual void visit(PTree::UnaryExpr *);
virtual void visit(PTree::ThrowExpr *);
virtual void visit(PTree::SizeofExpr *);
virtual void visit(PTree::TypeidExpr *);
virtual void visit(PTree::TypeofExpr *);
virtual void visit(PTree::NewExpr *);
virtual void visit(PTree::DeleteExpr *);
virtual void visit(PTree::ArrayExpr *);
virtual void visit(PTree::FuncallExpr *);
virtual void visit(PTree::PostfixExpr *);
virtual void visit(PTree::DotMemberExpr *);
virtual void visit(PTree::ArrowMemberExpr *);
virtual void visit(PTree::ParenExpr *);
SymbolLookup::Scope const *my_scope;
Type const * my_type;
};
inline Type const *type_of(PTree::Node const *node,
SymbolLookup::Scope const *s)
{
TypeEvaluator evaluator(s);
return evaluator.evaluate(node);
}
}
}
#endif
|