Goose  Artifact [862d35a230]

Artifact 862d35a230db7a51d3fa30fee2aaaf3192c1d630f76743e8fdf6aa87a1b4cf35:

  • File bs/parse/parser.inl — part of check-in [b4d5bdf6ec] at 2022-06-18 18:51:47 on branch cir-stack-language —
    • Added a location id to all CIR instructions (needed with the stack based approach to locate intermediate results)
    • Fixed a bunch of verifier errors
    • Re-enabled most verifier tests, other than some requiring to re-implement a few more bits
    (user: zlodo size: 1183) [more...]

#ifndef GOOSE_PARSE_PARSER_INL
#define GOOSE_PARSE_PARSER_INL

namespace goose::parse
{
    template< typename V >
    void Parser::pushValue( V&& val )
    {
        if( val.isPoison() )
        {
            DiagnosticsManager::GetInstance().setCurrentVerbosityLevel( Verbosity::Silent );
            builtins::PoisonBuilder( context() );
        }

        flushValue();

        m_lastValue = forward< V >( val );

        if( !context().locationId().invalid() )
            m_lastValue->setLocationId( context().locationId() );

        // If the value we just pushed is of void type, it was pushed only for its side effects
        // (for instance a SetVar instruction), so it should be flushed immediately.
        if( m_lastValue->type() == GetValueType< void >() )
            flushValue();
    }

    template< typename T >
    optional< uint32_t > Parser::getPrecedence( const Term&, const T& )
    {
        return nullopt;
    }

    template< typename T >
    bool Parser::parsePrefix( const T&, uint32_t )
    {
        return false;
    }

    template< typename T >
    bool Parser::parseInfix( const T&, uint32_t prec )
    {
        return false;
    }
}

#endif