Пример #1
0
void Power::ResolveTypes()
{
    Operator* fst = mySubOps[0];
    fst->ResolveTypes();

    Operator* snd = mySubOps[1];
    snd->ResolveTypes();

    if( !snd->GetType()->IsScalar() )
        myType = new ErrorType(
            reinterpret_cast<GlobalContext*>( myContext->GetGlobalContext() ),
            "The exponent is not a scalar" );
    else
        myType = fst->GetType();
}
Пример #2
0
void BinaryOperator::ResolveTypes()
{
    Operator* fst = mySubOps[0];
    fst->ResolveTypes();

    Operator* snd = mySubOps[1];
    snd->ResolveTypes();

    if( fst->GetType() == snd->GetType() )
        myType = fst->GetType();
    else
        myType = new ErrorType(
            reinterpret_cast<GlobalContext*>( myContext->GetGlobalContext() ),
            "Types mismatch" );
}
Пример #3
0
void Division::ResolveTypes()
{
    Operator* fst = mySubOps[0];
    fst->ResolveTypes();

    Operator* snd = mySubOps[1];
    snd->ResolveTypes();

    GlobalContext* gctx = reinterpret_cast<GlobalContext*>( myContext->GetGlobalContext() );

    Type* fstType = fst->GetType();
    Type* sndType = snd->GetType();

    if( sndType->IsScalar() )
        myType = fstType;
    else
        myType = new ErrorType(
            reinterpret_cast<GlobalContext*>( myContext->GetGlobalContext() ),
            "Unknown multiplication" );
}