Page Menu
Home
Xreate
Search
Configure Global Search
Log In
Docs
Questions
Repository
Issues
Patches
Internal API
Files
F4818554
typehints.cpp
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, Aug 23, 7:10 PM
Size
1 KB
Mime Type
text/x-c++
Expires
Tue, Aug 25, 7:10 PM (1 h, 42 m)
Engine
blob
Format
Raw Data
Handle
286593
Attached To
rXR Xreate
typehints.cpp
View Options
//
// Created by pgess on 24/03/2020.
//
#include "analysis/typehints.h"
#include "analysis/predefinedanns.h"
#include "analysis/utils.h"
#include "aux/expressions.h"
namespace xreate{namespace typehints{
namespace impl {
template<class Hint>
inline Hint getHint(const Expression& e, const Hint& def, unsigned annId, const ExpandedType& hintT){
const std::list<Expression>& hintsL = getAnnotations(e);
auto predefined = analysis::PredefinedAnns::instance();
const Expression& hintActual = analysis::findAnnById(annId, hintT, hintsL);
if (!hintActual.isValid()){
return def;
}
return parse<Hint>(hintActual);
}
}
template<> IntBits
parse(const Expression& e){
return {(unsigned) e.operands.at(0).getValueDouble()};
}
template<> ArrayHint
parse(const Expression& e){
return {(unsigned) e.operands.at(0).getValueDouble()};
}
template<> FlyHint
parse(const Expression& e){
return {e.operands.at(0)};
}
template<> IntBits
find(const Expression& e, const IntBits& def){
auto predefined = analysis::PredefinedAnns::instance();
return impl::getHint<IntBits>(e, def,
(unsigned) analysis::PredefinedAnns::IntHints::SIZE,
ExpandedType(predefined.hintsIntT)
);
}
template<> ArrayHint
find(const Expression& e, const ArrayHint& def){
auto predefined = analysis::PredefinedAnns::instance();
return impl::getHint<ArrayHint>(e, def,
(unsigned) analysis::PredefinedAnns::ContHints::ARRAY,
ExpandedType(predefined.hintsContT)
);
}
template<> FlyHint
find(const Expression& e, const FlyHint& def){
auto predefined = analysis::PredefinedAnns::instance();
return impl::getHint<FlyHint>(e, def,
(unsigned) analysis::PredefinedAnns::ContHints::FLY,
ExpandedType(predefined.hintsContT));
}
}}
Event Timeline
Log In to Comment