Prechádzať zdrojové kódy

Added string addition

Brian Fiete 4 rokov pred
rodič
commit
840a60697d

+ 38 - 0
BeefLibs/corlib/src/String.bf

@@ -941,6 +941,44 @@ namespace System
 			}
 			}
 		}
 		}
 
 
+		public void operator+=(String str)
+		{
+			Append(str);
+		}
+
+		public void operator+=(StringView sv)
+		{
+			Append(sv);
+		}
+
+		public void operator+=(char8 c)
+		{
+			Append(c);
+		}
+
+		public void operator+=(char32 c)
+		{
+			Append(c);
+		}
+
+		[Error("String addition is not supported. Consider allocating a new string and using Append, Concat, or +=")]
+		public static String operator+(String lhs, String rhs)
+		{
+			return lhs;
+		}
+
+		[Error("String addition is not supported. Consider allocating a new string and using Append, Concat, or +=")]
+		public static String operator+(String lhs, StringView rhs)
+		{
+			return lhs;
+		}
+
+		[Error("String addition is not supported. Consider allocating a new string and using Append, Concat, or +=")]
+		public static String operator+(String lhs, char32 rhs)
+		{
+			return lhs;
+		}
+
 		public void EnsureNullTerminator()
 		public void EnsureNullTerminator()
 		{
 		{
 			int allocSize = AllocSize;
 			int allocSize = AllocSize;

+ 3 - 0
IDEHelper/Compiler/BfExprEvaluator.cpp

@@ -5528,6 +5528,9 @@ BfTypedValue BfExprEvaluator::CreateCall(BfMethodMatcher* methodMatcher, BfTyped
 		BF_ASSERT(castedTarget);
 		BF_ASSERT(castedTarget);
 		target = castedTarget;
 		target = castedTarget;
 	}	
 	}	
+
+	PerformCallChecks(moduleMethodInstance.mMethodInstance, methodMatcher->mTargetSrc);
+
 	return CreateCall(methodMatcher->mTargetSrc, target, BfTypedValue(), methodMatcher->mBestMethodDef, moduleMethodInstance, false, methodMatcher->mArguments);
 	return CreateCall(methodMatcher->mTargetSrc, target, BfTypedValue(), methodMatcher->mBestMethodDef, moduleMethodInstance, false, methodMatcher->mArguments);
 }
 }