Procházet zdrojové kódy

Failed on attempted deferring of a mixin

Brian Fiete před 5 roky
rodič
revize
64af84f0de
1 změnil soubory, kde provedl 8 přidání a 3 odebrání
  1. 8 3
      IDEHelper/Compiler/BfExprEvaluator.cpp

+ 8 - 3
IDEHelper/Compiler/BfExprEvaluator.cpp

@@ -13521,6 +13521,11 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
 	if (mModule->mCurMethodState == NULL)
 	if (mModule->mCurMethodState == NULL)
 		return;
 		return;
 
 
+	if (mDeferCallRef != NULL)
+	{
+		mModule->Fail("Mixins cannot be directly deferred. Consider wrapping in a block.", targetSrc);
+	}
+
 	BfAstNode* origTargetSrc = targetSrc;
 	BfAstNode* origTargetSrc = targetSrc;
 	BfScopedInvocationTarget* scopedInvocationTarget = NULL;
 	BfScopedInvocationTarget* scopedInvocationTarget = NULL;
 
 
@@ -14230,7 +14235,7 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
 			endLocalIdx++;
 			endLocalIdx++;
 			++argExprEvaluatorItr;
 			++argExprEvaluatorItr;
 		}
 		}
-	}
+	}	
 
 
 	if (auto blockBody = BfNodeDynCast<BfBlock>(methodDef->mBody))
 	if (auto blockBody = BfNodeDynCast<BfBlock>(methodDef->mBody))
 		mModule->VisitCodeBlock(blockBody);
 		mModule->VisitCodeBlock(blockBody);
@@ -14239,7 +14244,6 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
 	{
 	{
 		if (auto exprNode = BfNodeDynCast<BfExpression>(mixinState->mResultExpr))
 		if (auto exprNode = BfNodeDynCast<BfExpression>(mixinState->mResultExpr))
 		{
 		{
-			//if ((exprNode->mTrailingSemicolon == NULL) && (!exprNode->IsA<BfBlock>()))
 			if (!exprNode->IsA<BfBlock>())
 			if (!exprNode->IsA<BfBlock>())
 			{
 			{
 				// Mixin expression result
 				// Mixin expression result
@@ -14252,7 +14256,8 @@ void BfExprEvaluator::InjectMixin(BfAstNode* targetSrc, BfTypedValue target, boo
 		}
 		}
 	}
 	}
 
 
-	GetResult();
+	GetResult();	
+
 	if (!mResult)
 	if (!mResult)
 	{
 	{
 		// If we didn't have an expression body then just make the result "void"
 		// If we didn't have an expression body then just make the result "void"