Goose  termaddr.cpp

File bs/execute/termaddr.cpp from the latest check-in


#include "execute.h"
#include "builtins/builtins.h"

using namespace goose;
using namespace goose::execute;
using namespace goose::builtins;

const Term& Bridge< eir::Term* >::Type()
{
    static auto type =
        ValueToEIR( Value( TypeType(), MkStdType( TSID( ct_type ), TSID( comptime_addr ) ) ) );
    return type;
}

Value Bridge< eir::Term* >::ToValue( eir::Term* x )
{
    return Value( Type(), TERM( static_cast< void* >( x ) ) );
}

eir::Term* Bridge< eir::Term* >::FromValue( const Value& v )
{
    if( !v.isConstant() || v.type() != Type() )
        return nullptr;

    return static_cast< Term* >( get< void* >( v.val() ) );
}