Goose  Diff

Differences From Artifact [bb5c879811]:

  • File bs/builtins/operators/comma.cpp — part of check-in [cde0c6d0e3] at 2019-06-19 19:49:50 on branch trunk —
    • parser: don't hardcode the builtins identity prefix in the rule helpers anymore.
    • builtins: move the common identity prefix used by all builtins into a separate function, to be able to easily change it.
    • builtins: prepend the CompileTime domain specifier to the root builtin identity.
    • sema: don't store the domain separately, extract it from the identity when needed instead.
    (user: achavasse size: 563)

To Artifact [f7de8a1f2a]:

  • File bs/builtins/operators/comma.cpp — part of check-in [39f2220e39] at 2019-07-31 22:40:59 on branch trunk — builtins: implemented some helpers to easily create builtin operators with overloadable extension points. (user: achavasse size: 590)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "builtins/builtins.h"
#include "precedence.h"
#include "builtins/helpers.h"

using namespace empathy;
using namespace empathy::ir;
using namespace empathy::parse;

namespace empathy::builtins
{
    void SetupCommaOp( Env& e )
    {
        RegisterLeftAssInfixOp( e, ","_sid, precedence::CommaOp,
            []( auto&& lhs, auto&& rhs )
            {
                if( IsOpenTuple( lhs ) )
                    return AppendToTuple( lhs, rhs );

                return AppendToTuple( AppendToTuple( EmptyTuple(), lhs ), rhs );
            } );
    }


|










|







1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include "builtins/builtins.h"
#include "precedence.h"
#include "helpers.h"

using namespace empathy;
using namespace empathy::ir;
using namespace empathy::parse;

namespace empathy::builtins
{
    void SetupCommaOp( Env& e )
    {
        RegisterLeftAssInfixOp( e, ","_sid, precedence::CommaOp,
            []( auto&& parser, auto&& lhs, auto&& rhs ) -> optional< Value >
            {
                if( IsOpenTuple( lhs ) )
                    return AppendToTuple( lhs, rhs );

                return AppendToTuple( AppendToTuple( EmptyTuple(), lhs ), rhs );
            } );
    }