Goose  Diff

Differences From Artifact [4940c2ae8e]:

  • File bs/parse/parser.cpp — part of check-in [59ecc02baa] at 2019-08-13 00:42:47 on branch trunk — Diagnostics: use value poisoning to (hopefully) fix most cases of superfluous cascading error messages. (user: achavasse size: 6441)

To Artifact [2d7129d76a]:

  • File bs/parse/parser.cpp — part of check-in [17905bf47a] at 2019-08-13 12:14:34 on branch trunk — diagnostics: simplify the code a bit by merging the LocationManager as static methods in Location. (user: achavasse size: 6405)

140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    auto nameTerm = m_resolver->consume();
    const auto* name = get_if< StringId >( &nameTerm->first );

    // If the identifier is preceded by a TExpr or a Type,
    // then this becomes a TDecl or a Decl, respectively.
    if( IsTExpr( *leftVal ) )
    {
        auto loc = LocationManager::GetInstance().getSpanningLocation( leftVal->locationId(), nameTerm->second );

        auto texpr = ValueToIRExpr( *popValue() );
        pushValue( ToValue( TNamedDecl( move( texpr ), *name ) ).setLocationId( loc ) );
        return true;
    }
    else if( leftVal->isType() )
    {
        auto loc = LocationManager::GetInstance().getSpanningLocation( leftVal->locationId(), nameTerm->second );

        auto type = ValueToIRExpr( *popValue() );
        pushValue( ToValue( Decl( move( type ), *name ) ).setLocationId( loc ) );
        return true;
    }

    return parsePrefix( strid, prec );







|







|







140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
    auto nameTerm = m_resolver->consume();
    const auto* name = get_if< StringId >( &nameTerm->first );

    // If the identifier is preceded by a TExpr or a Type,
    // then this becomes a TDecl or a Decl, respectively.
    if( IsTExpr( *leftVal ) )
    {
        auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );

        auto texpr = ValueToIRExpr( *popValue() );
        pushValue( ToValue( TNamedDecl( move( texpr ), *name ) ).setLocationId( loc ) );
        return true;
    }
    else if( leftVal->isType() )
    {
        auto loc = Location::CreateSpanningLocation( leftVal->locationId(), nameTerm->second );

        auto type = ValueToIRExpr( *popValue() );
        pushValue( ToValue( Decl( move( type ), *name ) ).setLocationId( loc ) );
        return true;
    }

    return parsePrefix( strid, prec );