Example #1
0
/**********
 * Temporary &Temporarymanager::GetTemporary(Variable*)
 *  Return the Temporary struct for the specified temporary
***********/
Temporary *
TemporaryManager::GetTemporary(BCSYM_Variable *var)
{
    ThrowIfNull(var);
    ThrowIfFalse(var->IsTemporary());

    for (Temporary *cur = m_Temporaries; cur; cur = cur->Next)
    {
        if ( cur->Symbol == var )
        {
            return cur;
        }
    }

    return NULL;
}
Example #2
0
ContactPair::ContactPair(PxContactPair* pair)
{
	ThrowIfNull(pair, "pair");

	_pair = pair;

	this->Shape0 = ObjectTable::TryGetObject<Shape^>((intptr_t)pair->shapes[0]);
	this->Shape1 = ObjectTable::TryGetObject<Shape^>((intptr_t)pair->shapes[1]);

	this->ContactData = (pair->contactStream == NULL) ?
		nullptr :
		Util::AsManagedArray<Byte>(pair->contactStream, pair->contactStreamSize);

	this->RequiredBufferSize = pair->requiredBufferSize;
	this->ContactCount = pair->contactCount;
	this->Flags = ToManagedEnum(ContactPairFlag, pair->flags);
}
Example #3
0
void LineMarkerTable::AddCodeBlock(
    TrackedCodeBlock *pblock,
    BCSYM *pSymbolForLocation
)
{
    ThrowIfNull(pblock);
    CompilerIdeLock lock(m_lock);
    pblock->m_pSymbolForLocation = pSymbolForLocation;
    
#if DEBUG
    bool inserted = m_trackedCodeBlockLocations.insert(pblock).second;
    ThrowIfFalse(inserted);
#else
    m_trackedCodeBlockLocations.push_back(pblock);
#endif
    pblock->m_locType = CodeBlockLoc;
}
Example #4
0
void LineMarkerTable::AddDeclLocation(
    _Out_ TrackedLocation *ploc,
    BCSYM *pSymbolForLocation
)
{
    ThrowIfNull(ploc);
    CompilerIdeLock lock(m_lock);
    ploc->m_pSymbolForLocation = pSymbolForLocation;

#if DEBUG
    bool inserted = m_declLocations.insert(ploc).second;
    ThrowIfFalse(inserted);
#else
    m_declLocations.push_back(ploc);
#endif

    ploc->m_locType = TrackedLoc;
}
Example #5
0
void LineMarkerTable::AddErrorLocation(
    _Out_ ErrorLocation * pErrorLocation,
    CompilationState state)
{
    ThrowIfNull(pErrorLocation);
    CompilerIdeLock lock(m_lock);

#if DEBUG
    bool inserted = m_errorLocations.insert(pErrorLocation).second;
    ThrowIfFalse(inserted);
#else
    m_errorLocations.push_back(pErrorLocation);
#endif

    pErrorLocation->m_locType = ErrorLoc;
    pErrorLocation->m_state = (state > CS_Bound) ? CS_Bound : CS_NoState;
    pErrorLocation->m_fForceRemove = false;
}
Example #6
0
/**********
*TemporaryManager::ChangeContainingProcedure
*       Changes the procedure containing the temporary manager.  Will also reset the
*       parent on all of the temporary variables
***********/
void
TemporaryManager::ChangeContainingProcedure(BCSYM_Proc *proc)
{
    ThrowIfNull(proc);
    if ( proc == m_ContainingProcedure )
    {
        return;
    }

    m_ContainingProcedure = proc;

    Temporary *temporary;
    TemporaryIterator tempIt;
    tempIt.Init(this, true);
    while ( (temporary = tempIt.GetNext()) )
    {
        Symbols::ClearParent(temporary->Symbol);
        Symbols::SetParent(temporary->Symbol, proc);
    }
}
Example #7
0
DLRExpressionTree*
ETSemanticsForLambdas::ConvertLambda
(
    ILTree::Expression* Input,
    ExpressionFlags Flags,
    Type* TargetType
)
{
    ThrowIfNull(Input);
    ThrowIfFalse(Input->bilop == SX_LAMBDA);

    // Don't allow Sub lambdas to be converted to expression trees.
    if (Input->ResultType->IsDelegate())
    {
        BCSYM_NamedRoot* proc = GetInvokeFromDelegate(Input->ResultType, m_Compiler);
        if(proc && proc->PProc() && (!proc->PProc()->GetType() || TypeHelpers::IsVoidType(proc->PProc()->GetType())))
        {
            ReportErrorForExpressionTree( ERRID_StatementLambdaInExpressionTree, Input->Loc );
            return NULL;
        }
    }

    return ExpressionTreeSemantics<DLRExpressionTree>::ConvertLambda(Input, Flags, TargetType);
}
Example #8
0
	Window* WindowPointer::operator->() const {
		ThrowIfNull();
		return ptr_;
	}
Example #9
0
BCSYM_Variable *TemporaryManager::AllocateLongLivedTemporary(BCSYM *type, const Location *textSpan, ILTree::ExecutableBlock *block, _Out_opt_ bool *existingVariableReused )
{
    ThrowIfNull(block);
    return AllocateTemporary(type, LifetimeLongLived, textSpan, block, existingVariableReused);
}
Example #10
0
LinuxGtkMenuBar::LinuxGtkMenuBar()
{
    _menuBar = ThrowIfNull( gtk_menu_bar_new() );
}
Example #11
0
void LinuxGtkMenu::AddSeparator()
{
    auto newSeparatorWidget = ThrowIfNull( gtk_separator_menu_item_new() );
    gtk_menu_shell_append( GTK_MENU_SHELL(_menuObject), newSeparatorWidget );
}
	: PxControllerBehaviorCallback()
{
	ThrowIfNull(behaviorCallback, "behaviorCallback");

	_behaviorCallback = behaviorCallback;
}
	: PxUserControllerHitReport()
{
	ThrowIfNull(hitReport, "hitReport");

	_hitReport = hitReport;
}
Example #14
0
DLRExpressionTree*
ETSemanticsForLambdas::ConvertConstantValueHelper
(
    ILTree::Expression* Input,
    ExpressionFlags Flags,
    Type* TargetType,
    DLRTreeETGenerator *ExprTreeGenerator,
    FX::FXSymbolProvider *FXSymbolProvider
)
{
    ThrowIfNull(Input);
    ThrowIfNull(ExprTreeGenerator);
    ThrowIfNull(FXSymbolProvider);

    DLRExpressionTree *Result = NULL;

    switch (Input->bilop)
    {
    case SX_NOTHING:

        Result = ExprTreeGenerator->CreateNothingConstantExpr(
            Input->ResultType,
            TargetType,
            Input->Loc
            );

        break;

    case SX_CNS_INT:

        if (TypeHelpers::IsIntegralType(Input->ResultType))
        {
            Result = ExprTreeGenerator->CreateIntegralConstantExpr(
                Input->AsIntegralConstantExpression().Value,
                Input->ResultType,
                TargetType,
                Input->Loc
                );
        }
        else if (TypeHelpers::IsBooleanType(Input->ResultType))
        {
            Result = ExprTreeGenerator->CreateBooleanConstantExpr(
                (bool)Input->AsIntegralConstantExpression().Value,
                TargetType,
                Input->Loc
                );

        }
        else if (TypeHelpers::IsCharType(Input->ResultType))
        {
            Result = ExprTreeGenerator->CreateCharConstantExpr(
                (WCHAR)Input->AsIntegralConstantExpression().Value,
                TargetType,
                Input->Loc
                );                
        }
        else if (TypeHelpers::IsDateType(Input->ResultType))
        {
            Result = ExprTreeGenerator->CreateDateConstantExpr(
                Input->AsIntegralConstantExpression().Value,
                TargetType,
                Input->Loc
                );
        }

        break;

    case SX_CNS_FLT:

        Result = ExprTreeGenerator->CreateFloatingPointConstantExpr(
            Input->AsFloatConstantExpression().Value,
            Input->ResultType,
            TargetType,
            Input->Loc
            );

        break;

    case SX_CNS_DEC:

        Result = ExprTreeGenerator->CreateDecimalConstantExpr(
            Input->AsDecimalConstantExpression().Value,
            TargetType,
            Input->Loc
            );

        break;

    case SX_CNS_STR:

        Result = ExprTreeGenerator->CreateStringConstantExpr(
            Input->AsStringConstant().Spelling,
            (unsigned int)Input->AsStringConstant().Length, //Cast on this line for 64bit compilation. Cast is safe because string will be truncated in the worst case. Only happens for 4GB+ strings.
            Input->ResultType,
            Input->Loc
            );

        break;

    case SX_METATYPE:

        VSASSERT(
            Input->AsExpressionWithChildren().Left->bilop == SX_SYM ||
                Input->AsExpressionWithChildren().Left->bilop == SX_NOTHING,
            "How did this metatype node get here?"
            );

        ILTree::Expression *SymbolRef = Input->AsExpressionWithChildren().Left;

        if (SymbolRef->bilop == SX_NOTHING)
        {
            // Type reference

            ThrowIfFalse(FXSymbolProvider->GetTypeType() == Input->ResultType);

            Result = ExprTreeGenerator->CreateTypeRefExpr(
                SymbolRef->ResultType,
                TargetType,
                Input->Loc
                );
        }
        else if (SymbolRef->AsSymbolReferenceExpression().Symbol->IsVariable())
        {
            // Field reference

            ThrowIfFalse(FXSymbolProvider->GetFieldInfoType() == Input->ResultType);

            Result = ExprTreeGenerator->CreateFieldRefExpr(
                SymbolRef->AsSymbolReferenceExpression().Symbol->PVariable(),
                SymbolRef->AsSymbolReferenceExpression().GenericBindingContext->PGenericTypeBinding(),
                TargetType,
                Input->Loc
                );
        }
        else
        {
            // Method reference

            ThrowIfFalse(FXSymbolProvider->GetMethodInfoType() == Input->ResultType ||
                         FXSymbolProvider->GetConstructorInfoType() == Input->ResultType);

            Result = ExprTreeGenerator->CreateMethodRefExpr(
                SymbolRef->AsSymbolReferenceExpression().Symbol->PProc(),
                SymbolRef->AsSymbolReferenceExpression().GenericBindingContext,
                TargetType,
                Input->Loc
                );
        }

        break;
    }

    if (Result == NULL)
    {
        ASSERT(false,"[ETSemanticsForLambdas::ConvertConstant] non-constant expression unexpected");
        ThrowIfFalse(false);
    }

    return Result;
}
Example #15
0
Declaration * ExtensionMethodOverloadIterator::Current()
{
    ThrowIfNull(m_pCurrent);
    Assume(m_pCurrent->IsProc(), L"How can m_pCurrent not be a procedure?");
    return m_pCurrent;
}
Example #16
0
//	////////////////////////////////////////////////////////////////////////////
inline API_UTILITY const char *ThrowIfNullOrEmpty(const char *test_string,
	const char *name_string = NULL)
{
	return(ThrowIfEmpty(ThrowIfNull(test_string, name_string), name_string));
}