Goose  Artifact [bb5c879811]

Artifact bb5c879811e4e29249ab85ab22e62521205c3f5c3f32d57b5c31b6de15213313:

  • 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)

#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 );
            } );
    }
}