Goose  Artifact [61ed2096c5]

Artifact 61ed2096c5ac23df3db36d94fdd8ca8d387d6dc79480ab4bc457b33615f5cad5:

  • File bs/builtins/types/template/tfunc.cpp — part of check-in [054862b9f5] at 2019-02-16 16:48:49 on branch trunk — Some reorganization of template types. (user: achavasse size: 822)
  • File bs/builtins/types/tfunc/tfunc.cpp — part of check-in [aec44da323] at 2019-02-14 23:11:46 on branch trunk — Templates: added TFunc type. (user: achavasse size: 822)

#include "builtins/builtins.h"
#include "lex/lex.h"
#include "parse/parse.h"

using namespace empathy::builtins;
using namespace empathy::parse;

namespace empathy::ir
{
    const Term& Bridge< TFunc >::Type( const builtins::TFunc& tf )
    {
        static auto type = ValueToIRExpr( ::ToValue( tf.type() ) );
        return type;
    }

    Value Bridge< TFunc >::ToValue( const TFunc& tf )
    {
        // TODO build and include the signature
        return Value( Type( tf ), TERM( tf.toks() ) );
    }

    optional< TFunc > Bridge< TFunc >::FromValue( const Value& v )
    {
        auto typeVal = ValueFromIRExpr( v.type() );
        auto type = ::FromValue< TFuncType >( *typeVal );
        if( !type )
            return nullopt;

        return TFunc( move( *type ), get< pvec >( v.val().content() ) );
    }
}