Goose  Diff

Differences From Artifact [4d0caaeab9]:

  • File bs/builtins/types/decl.cpp — part of check-in [7d2def7b75] at 2020-12-27 14:40:24 on branch trunk — Renamed "ir" to "eir" (expression intermediate representation) and "llr" to "cir" (code intermediate representation) for clarity. (user: achavasse size: 1338)

To Artifact [866e8ec0d8]:

  • File bs/builtins/types/decl.cpp — part of check-in [0345b9f807] at 2021-01-02 18:00:11 on branch trunk — Some more renaming. (user: achavasse size: 1326)

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
#include "builtins/builtins.h"

using namespace goose::builtins;

namespace goose::builtins
{
    bool IsDecl( const Value& d )
    {
        auto typeVal = ValueFromIRExpr( d.type() );
        auto result = Decompose( typeVal->val(),
            Vec(
                Lit( "decl"_sid ),
                SubTerm()
            )
        );

        return !!result;
    }

    const Term& Decl::Pattern::GetPattern()
    {
        static auto pattern = ValueToIRExpr(
            Value( TypeType(), VEC( TSID( decl ), HOLE( "_"_sid ) ) ) );

        return pattern;
    }
}

namespace goose::eir
{
    Term Bridge< Decl >::Type( const Term& declType )
    {
        return ValueToIRExpr( Value( TypeType(), VEC( TSID( decl ), declType ) ) );
    }

    Value Bridge< Decl >::ToValue( const Decl& d )
    {
        return Value( Type( d.type() ), TERM( d.name() ) );
    }

    optional< Decl > Bridge< Decl >::FromValue( const Value& v )
    {
        auto typeVal = ValueFromIRExpr( v.type() );
        auto result = Decompose( typeVal->val(),
            Vec(
                Lit( "decl"_sid ),
                SubTerm()
            )
        );









|












|










|









|







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
#include "builtins/builtins.h"

using namespace goose::builtins;

namespace goose::builtins
{
    bool IsDecl( const Value& d )
    {
        auto typeVal = ValueFromEIR( d.type() );
        auto result = Decompose( typeVal->val(),
            Vec(
                Lit( "decl"_sid ),
                SubTerm()
            )
        );

        return !!result;
    }

    const Term& Decl::Pattern::GetPattern()
    {
        static auto pattern = ValueToEIR(
            Value( TypeType(), VEC( TSID( decl ), HOLE( "_"_sid ) ) ) );

        return pattern;
    }
}

namespace goose::eir
{
    Term Bridge< Decl >::Type( const Term& declType )
    {
        return ValueToEIR( Value( TypeType(), VEC( TSID( decl ), declType ) ) );
    }

    Value Bridge< Decl >::ToValue( const Decl& d )
    {
        return Value( Type( d.type() ), TERM( d.name() ) );
    }

    optional< Decl > Bridge< Decl >::FromValue( const Value& v )
    {
        auto typeVal = ValueFromEIR( v.type() );
        auto result = Decompose( typeVal->val(),
            Vec(
                Lit( "decl"_sid ),
                SubTerm()
            )
        );