Procházet zdrojové kódy

Fixed build paths, added comparison warnings, other misc fixes

Brian Fiete před 5 roky
rodič
revize
f4c252048e

+ 2 - 2
BeefLibs/MiniZ/src/Zip.bf

@@ -1695,7 +1695,7 @@ namespace IDE.Util
 
 		static void tdefl_start_dynamic_block(tdefl_compressor* d)
 		{
-			uint32 num_lit_codes, num_dist_codes, num_bit_lengths; uint32 i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, rle_repeat_count, packed_code_sizes_index;
+			int32 num_lit_codes, num_dist_codes, num_bit_lengths; int32 i, total_code_sizes_to_pack, num_packed_code_sizes, rle_z_count, rle_repeat_count, packed_code_sizes_index;
 			uint8[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1] code_sizes_to_pack = ?;
 			uint8[TDEFL_MAX_HUFF_SYMBOLS_0 + TDEFL_MAX_HUFF_SYMBOLS_1] packed_code_sizes = ?;
 			uint8 prev_code_size = 0xFF;
@@ -3068,7 +3068,7 @@ namespace IDE.Util
 						ZIP_ARRAY_ELEMENT!<uint32>(&pZip.m_pState.m_sorted_central_dir_offsets, i) = (uint32)i;
 					comp_size = (int32)ReadLE32!(p + ZIP_CDH_COMPRESSED_SIZE_OFS);
 					decomp_size = (int32)ReadLE32!(p + ZIP_CDH_DECOMPRESSED_SIZE_OFS);
-					if (((ReadLE32!(p + ZIP_CDH_METHOD_OFS) == 0) && (decomp_size != comp_size)) || ((decomp_size != 0) && (comp_size == 0)) || (decomp_size == 0xFFFFFFFF) || (comp_size == 0xFFFFFFFF))
+					if (((ReadLE32!(p + ZIP_CDH_METHOD_OFS) == 0) && (decomp_size != comp_size)) || ((decomp_size != 0) && (comp_size == 0)) || (decomp_size == -1) || (comp_size == -1))
 						return false;
 					disk_index = ReadLE16!(p + ZIP_CDH_DISK_START_OFS);
 					if ((disk_index != num_this_disk) && (disk_index != 1))

+ 4 - 4
BeefLibs/corlib/src/Reflection/Convert.bf

@@ -39,14 +39,14 @@ namespace System.Reflection
 			case .Int8: return (val >= -0x80) && (val <= 0x7F);
 			case .Int16: return (val >= -0x8000) && (val <= 0x7FFF);
 			case .Int32: return (val >= -0x80000000) && (val <= 0x7FFF'FFFF);
-			case .Int64: return (val >= -0x80000000'00000000) && (val <= 0x7FFFFFFF'FFFFFFFF);
+			case .Int64: return true;
 			case .UInt8, .Char8: return (val >= 0) && (val <= 0xFF);
 			case .UInt16, .Char16: return (val >= 0) && (val <= 0xFFFF);
 			case .UInt32, .Char32: return (val >= 0) && (val <= 0xFFFFFFFF);
-			case .UInt64: return (val >= 0) && (val <= 0x7FFFFFFF'FFFFFFFF);
+			case .UInt64: return (val >= 0);
 #if BF_64_BIT
-			case .Int: return (val >= -0x80000000'00000000) && (val <= 0x7FFFFFFF'FFFFFFFF);
-			case .UInt: return (val >= 0) && (val <= 0x7FFFFFFF'FFFFFFFF);
+			case .Int: return true;
+			case .UInt: return (val >= 0);
 #else
 			case .Int: return (val >= -0x80000000) && (val <= 0x7FFF'FFFF);
 			case .UInt: return (val >= 0) && (val <= 0xFFFFFFFF);

+ 17 - 17
BeefTools/BeefMem/BeefMem.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug Static|Win32">
@@ -231,32 +231,32 @@
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
     <TargetName>$(ProjectName)64_d</TargetName>
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
     <TargetName>$(ProjectName)64_d</TargetName>
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <TargetName>$(ProjectName)64</TargetName>
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
     <TargetName>$(ProjectName)64</TargetName>
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|Win32'">
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|Win32'">
-    <OutDir>$(SolutionDir)\dist\</OutDir>
+    <OutDir>$(SolutionDir)\IDE\dist\</OutDir>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -301,8 +301,8 @@
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>DebugFull</GenerateDebugInformation>
-      <OutputFile>$(SolutionDir)\dist\$(TargetName).dll</OutputFile>
-      <ImportLibrary>$(SolutionDir)\dist\$(TargetName).lib</ImportLibrary>
+      <OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
+      <ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug Static|x64'">
@@ -320,8 +320,8 @@
     <Link>
       <SubSystem>Windows</SubSystem>
       <GenerateDebugInformation>DebugFull</GenerateDebugInformation>
-      <OutputFile>$(SolutionDir)\dist\$(TargetName).dll</OutputFile>
-      <ImportLibrary>$(SolutionDir)\dist\$(TargetName).lib</ImportLibrary>
+      <OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
+      <ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
@@ -377,8 +377,8 @@
       <GenerateDebugInformation>Debug</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <OutputFile>$(SolutionDir)\dist\$(TargetName).dll</OutputFile>
-      <ImportLibrary>$(SolutionDir)\dist\$(TargetName).lib</ImportLibrary>
+      <OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
+      <ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
     </Link>
   </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release Static|x64'">
@@ -397,8 +397,8 @@
       <GenerateDebugInformation>DebugFull</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <OutputFile>$(SolutionDir)\dist\$(TargetName).dll</OutputFile>
-      <ImportLibrary>$(SolutionDir)\dist\$(TargetName).lib</ImportLibrary>
+      <OutputFile>$(SolutionDir)\IDE\dist\$(TargetName).dll</OutputFile>
+      <ImportLibrary>$(SolutionDir)\IDE\dist\$(TargetName).lib</ImportLibrary>
     </Link>
   </ItemDefinitionGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />

+ 2 - 2
BeefTools/BeefMem/gperftools/vsprojects/libtcmalloc_minimal/libtcmalloc_minimal.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -39,7 +39,7 @@
     <_ProjectFileVersion>12.0.21005.1</_ProjectFileVersion>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Configuration)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Configuration)\</IntDir>
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>

+ 2 - 0
BeefySysLib/BeefySysLib_static.vcxproj

@@ -79,6 +79,7 @@
     <TargetName>$(ProjectName)_d</TargetName>
     <LibraryPath>third_party\AK\lib\debug;C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2007%29\Lib\x86;$(LibraryPath);$(WindowsSDK_LibraryPath_x86)</LibraryPath>
     <IntDir>$(Platform)\$(Configuration)_static\</IntDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
@@ -90,6 +91,7 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <LinkIncremental>false</LinkIncremental>
     <IntDir>$(Platform)\$(Configuration)_static\</IntDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>

+ 2 - 2
BeefySysLib/gfx/FTFont.cpp

@@ -120,6 +120,7 @@ void FTFontManager::ClearCache()
 
 FTFontManager::Page::~Page()
 {
+	mTexture->Release();
 	//delete mTexture;
 }
 
@@ -266,8 +267,7 @@ FTFontManager::Glyph* FTFont::AllocGlyph(int charCode, bool allowDefault)
 			else
 				img.mBits[i] = 0xFF0000FF;
 		}
-		page->mTexture = gBFApp->mRenderDevice->LoadTexture(&img, TextureFlag_NoPremult);
-		page->mTexture->mRefCount = 0;
+		page->mTexture = gBFApp->mRenderDevice->LoadTexture(&img, TextureFlag_NoPremult);		
 	}
 
 	if (bitmap.width > 0)

+ 1 - 1
BeefySysLib/util/BeefPerf.cpp

@@ -1781,4 +1781,4 @@ BP_EXPORT const char* BP_CALLTYPE BpDynStr(const char* str)
 	return str;
 }
 
-#endif
+#endif

+ 5 - 3
Debugger32/Debugger32.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
@@ -106,19 +106,21 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

+ 3 - 1
Debugger64/Debugger64.vcxproj

@@ -106,7 +106,7 @@
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Platform)\$(Configuration)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Platform)\$(Configuration)\</IntDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(IncludePath)</IncludePath>
   </PropertyGroup>
@@ -116,9 +116,11 @@
     <IncludePath>$(VSInstallDir)\DIA SDK\include;;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(IncludePath)</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+	<OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+	<OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IncludePath>$(VSInstallDir)\DIA SDK\include;C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Include;$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">

+ 10 - 8
IDE/src/BuildContext.bf

@@ -831,19 +831,23 @@ namespace IDE
 		        return true;
 
 		    Workspace.Options workspaceOptions = gApp.GetCurWorkspaceOptions();
-		    BfCompiler bfCompiler = gApp.mBfBuildCompiler;            
+		    BfCompiler bfCompiler = gApp.mBfBuildCompiler;
 		    var bfProject = gApp.mBfBuildSystem.mProjectMap[project];
-		    bool bfHadOutputChanges;
+		    bool bfHadOutputChanges = false;
 		    List<String> bfFileNames = scope List<String>();
-			bfCompiler.GetOutputFileNames(bfProject, true, out bfHadOutputChanges, bfFileNames);
-			defer ClearAndDeleteItems(bfFileNames);//DeleteAndClearItems!(bfFileNames);
+			if (project.mCurBfOutputFileNames == null)
+			{
+				project.mCurBfOutputFileNames = new .();
+				bfCompiler.GetOutputFileNames(bfProject, true, out bfHadOutputChanges, project.mCurBfOutputFileNames);
+			}
+			for (var fileName in project.mCurBfOutputFileNames)
+				bfFileNames.Add(fileName);
 		    if (bfHadOutputChanges)
 		        project.mNeedsTargetRebuild = true;
 
 		    List<ProjectSource> allFileNames = scope List<ProjectSource>();
 		    List<String> clangAllObjNames = scope List<String>();
-		    //List<String> clangObjNames = scope List<String>();            
-
+		    
 		    gApp.GetClangFiles(project.mRootFolder, allFileNames);
 
 		    String workspaceBuildDir = scope String();
@@ -853,8 +857,6 @@ namespace IDE
 			if (!projectBuildDir.IsEmpty)
 		    	Directory.CreateDirectory(projectBuildDir).IgnoreError();
 
-		    //List<String> buildFileNames = new List<String>();
-
 			String targetPath = scope String();
 
 		    String outputDir = scope String();

+ 2 - 0
IDE/src/Project.bf

@@ -1188,6 +1188,8 @@ namespace IDE
 		public bool mFailed;
 		public bool mNeedsCreate;
 
+		public List<String> mCurBfOutputFileNames ~ DeleteContainerAndItems!(_);
+
         public String ProjectFileName
         {
             get

+ 1 - 1
IDE/src/ui/WelcomePanel.bf

@@ -111,7 +111,7 @@ namespace IDE.ui
 		public override void Draw(Graphics g)
 		{
 			using (g.PushColor(0x40000000))
-				g.FillRect(mWidth/2 - GS!(500), YOfs - GS!(24), GS!(500)*2, 570);
+				g.FillRect(mWidth/2 - GS!(500), YOfs - GS!(24), GS!(500)*2, GS!(570));
 
 			g.SetFont(mLargeFont);
 			using (g.PushColor(0xFFE0E0FF))

+ 148 - 1
IDEHelper/Compiler/BfExprEvaluator.cpp

@@ -16230,11 +16230,158 @@ void BfExprEvaluator::PerformBinaryOperation(BfExpression* leftExpression, BfExp
 	return PerformBinaryOperation(leftExpression, rightExpression, binaryOp, opToken, flags, leftValue);	
 }
 
+bool BfExprEvaluator::CheckConstCompare(BfBinaryOp binaryOp, BfAstNode* opToken, const BfTypedValue& leftValue, const BfTypedValue& rightValue)
+{
+	if ((binaryOp < BfBinaryOp_Equality) || (binaryOp > BfBinaryOp_LessThanOrEqual))
+		return false;
+
+	// LHS is expected to be a value and RHS is expected to be a const
+	if (!leftValue.mType->IsIntegral())
+		return false;
+
+	BF_ASSERT(rightValue.mValue.IsConst());
+	auto rightConst = mModule->mBfIRBuilder->GetConstant(rightValue.mValue);
+
+	BfType* checkType = leftValue.mType;
+	if (checkType->IsTypedPrimitive())
+		checkType = checkType->GetUnderlyingType();
+	if (!checkType->IsPrimitiveType())
+		return false;
+
+	BfTypeCode typeCode = ((BfPrimitiveType*)checkType)->mTypeDef->mTypeCode;
+		
+	int64 minValue = 0;
+	int64 maxValue = 0;
+	switch (typeCode)
+	{
+	case BfTypeCode_Int8:
+		minValue = -0x80;
+		maxValue =  0x7F;
+		break;
+	case BfTypeCode_Int16:
+		minValue = -0x8000;
+		maxValue =  0x7FFF;
+		break;
+	case BfTypeCode_Int32:
+		minValue = -0x80000000LL;
+		maxValue =  0x7FFFFFFF;
+		break;
+	case BfTypeCode_Int64:
+		minValue = -0x8000000000000000LL;
+		maxValue =  0x7FFFFFFFFFFFFFFFLL;
+		break;
+	case BfTypeCode_UInt8:		
+		maxValue = 0xFF;
+		break;
+	case BfTypeCode_UInt16:
+		maxValue = 0xFFFF;
+		break;
+	case BfTypeCode_UInt32:
+		maxValue = 0xFFFFFFFF;
+		break;
+	default:
+		return false;
+	}	
+
+	int constResult = -1;
+	if (typeCode == BfTypeCode_UInt64)
+	{		
+		switch (binaryOp)
+		{
+		case BfBinaryOp_Equality:
+			if (rightConst->mInt64 < minValue)
+				constResult = 0;			
+			break;
+		case BfBinaryOp_InEquality:
+			if (rightConst->mInt64 < minValue)
+				constResult = 1;			
+			break;
+		case BfBinaryOp_LessThan:
+			if (rightConst->mInt64 <= minValue)
+				constResult = 0;			
+			break;
+		case BfBinaryOp_LessThanOrEqual:
+			if (rightConst->mInt64 < minValue)
+				constResult = 0;			
+			break;		
+		}
+		return false;
+	}
+	else
+	{
+		switch (binaryOp)
+		{
+		case BfBinaryOp_Equality:
+			if (rightConst->mInt64 < minValue)
+				constResult = 0;
+			else if (rightConst->mInt64 > maxValue)
+				constResult = 0;
+			break;
+		case BfBinaryOp_InEquality:
+			if (rightConst->mInt64 < minValue)
+				constResult = 1;
+			else if (rightConst->mInt64 > maxValue)
+				constResult = 1;
+			break;
+		case BfBinaryOp_LessThan:
+			if (rightConst->mInt64 <= minValue)
+				constResult = 0;
+			else if (rightConst->mInt64 > maxValue)
+				constResult = 1;
+			break;
+		case BfBinaryOp_LessThanOrEqual:
+			if (rightConst->mInt64 < minValue)
+				constResult = 0;
+			else if (rightConst->mInt64 >= maxValue)
+				constResult = 1;
+			break;
+		case BfBinaryOp_GreaterThan:
+			if (rightConst->mInt64 >= maxValue)
+				constResult = 0;
+			else if (rightConst->mInt64 < minValue)
+				constResult = 1;
+			break;
+		case BfBinaryOp_GreaterThanOrEqual:
+			if (rightConst->mInt64 > maxValue)
+				constResult = 0;
+			else if (rightConst->mInt64 <= minValue)
+				constResult = 1;
+			break;
+		}
+	}
+	
+	if (constResult == 0)
+	{
+		mModule->Warn(0, "The result of this operation is always 'false'", opToken);
+		mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 1), mModule->GetPrimitiveType(BfTypeCode_Boolean));
+		return true;
+	}
+	else  if (constResult == 1)
+	{
+		mModule->Warn(0, "The result of this operation is always 'true'", opToken);
+		mResult = BfTypedValue(mModule->mBfIRBuilder->CreateConst(BfTypeCode_Boolean, 1), mModule->GetPrimitiveType(BfTypeCode_Boolean));
+		return true;
+	}
+	
+	return false;
+}
+
 void BfExprEvaluator::PerformBinaryOperation(BfAstNode* leftExpression, BfAstNode* rightExpression, BfBinaryOp binaryOp, BfAstNode* opToken, BfBinOpFlags flags, BfTypedValue leftValue, BfTypedValue rightValue)
 {
 	bool noClassify = (flags & BfBinOpFlag_NoClassify) != 0;
 	bool forceLeftType = (flags & BfBinOpFlag_ForceLeftType) != 0;
 
+	if ((rightValue.mValue.IsConst()) && (!leftValue.mValue.IsConst()))
+	{
+		if (CheckConstCompare(binaryOp, opToken, leftValue, rightValue))
+			return;
+	}
+	else if ((leftValue.mValue.IsConst()) && (!rightValue.mValue.IsConst()))
+	{
+		if (CheckConstCompare(GetOppositeBinaryOp(binaryOp), opToken, rightValue, leftValue))
+			return;
+	}
+
 	if ((binaryOp == BfBinaryOp_NullCoalesce) && ((leftValue.mType->IsPointer()) || (leftValue.mType->IsObject())))
 	{
 		auto prevBB = mModule->mBfIRBuilder->GetInsertBlock();
@@ -17261,7 +17408,7 @@ void BfExprEvaluator::PerformBinaryOperation(BfType* resultType, BfIRValue convL
 		mResult = BfTypedValue(mModule->mBfIRBuilder->CreateCmpNE(convLeftValue, convRightValue),
 			mModule->GetPrimitiveType(BfTypeCode_Boolean));	
 		break;
-	case BfBinaryOp_LessThan:	
+	case BfBinaryOp_LessThan:			
 		mResult = BfTypedValue(mModule->mBfIRBuilder->CreateCmpLT(convLeftValue, convRightValue, resultType->IsSignedInt()),
 			mModule->GetPrimitiveType(BfTypeCode_Boolean));	
 		break;

+ 1 - 0
IDEHelper/Compiler/BfExprEvaluator.h

@@ -336,6 +336,7 @@ public:
 	void LookupQualifiedName(BfAstNode* nameNode, BfIdentifierNode* nameLeft, BfIdentifierNode* nameRight, bool ignoreInitialError, bool* hadError = NULL);
 	void LookupQualifiedStaticField(BfQualifiedNameNode* nameNode, bool ignoreIdentifierNotFoundError);	
 	void LookupQualifiedStaticField(BfAstNode* nameNode, BfIdentifierNode* nameLeft, BfIdentifierNode* nameRight, bool ignoreIdentifierNotFoundError);
+	bool CheckConstCompare(BfBinaryOp binaryOp, BfAstNode* opToken, const BfTypedValue& leftValue, const BfTypedValue& rightValue);
 	void PerformBinaryOperation(BfType* resultType, BfIRValue convLeftValue, BfIRValue convRightValue, BfBinaryOp binaryOp, BfAstNode* opToken);
 	void PerformBinaryOperation(BfAstNode* leftExpression, BfAstNode* rightExpression, BfBinaryOp binaryOp, BfAstNode* opToken, BfBinOpFlags flags, BfTypedValue leftValue, BfTypedValue rightValue);
 	void PerformBinaryOperation(BfExpression* leftNode, BfExpression* rightNode, BfBinaryOp binaryOp, BfTokenNode* opToken, BfBinOpFlags flags, BfTypedValue leftValue);

+ 3 - 2
IDEHelper/Compiler/BfStmtEvaluator.cpp

@@ -1631,7 +1631,8 @@ BfLocalVariable* BfModule::HandleVariableDeclaration(BfVariableDeclaration* varD
 			localDef->mValue = initValue.mValue;
 			if ((localDef->mAddr) && (!localDef->mResolvedType->IsValuelessType()))
 			{
-				wantsStore = true;				
+				if (!initValue.mType->IsVar())
+					wantsStore = true;
 			}
 			else
 			{
@@ -5448,7 +5449,7 @@ void BfModule::Visit(BfForEachStatement* forEachStmt)
 	else if (isVarEnumerator)
 	{
 		// Generic method or mixin decl
-		BF_ASSERT(mBfIRBuilder->mIgnoreWrites);
+		BF_ASSERT(mBfIRBuilder->mIgnoreWrites || mHadVarUsage);
 	}		
 	else if (!target.mType->IsTypeInstance())
 	{		

+ 1 - 1
IDEHelper/WinDebugger.cpp

@@ -6543,7 +6543,7 @@ String WinDebugger::DbgTypedValueToString(const DbgTypedValue& origTypedValue, c
 		break;
 	case DbgType_UChar:
 		if (language != DbgLanguage_Beef)
-			return IntTypeToString<int8>(typedValue.mUInt8, WrapWithModifiers("uint8_t", origValueType, language), displayInfo, formatInfo);
+			return IntTypeToString<uint8>(typedValue.mUInt8, WrapWithModifiers("uint8_t", origValueType, language), displayInfo, formatInfo);
 	case DbgType_SChar:
 		{						
 			if (typedValue.mInt8 != 0)

+ 5 - 0
bin/build.bat

@@ -10,6 +10,11 @@ PUSHD %~dp0..\
 @ECHO Performing clean build
 :BUILD
 
+@IF EXIST extern\llvm-project_8_0_1 GOTO LLVM_HAS
+call extern\llvm_build.bat
+@IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
+:LLVM_HAS
+
 CALL bin/msbuild.bat BeefySysLib\BeefySysLib.vcxproj /p:Configuration=Debug /p:Platform=x64 /p:SolutionDir=%cd%\ /v:m %MSBUILD_FLAGS%
 @IF %ERRORLEVEL% NEQ 0 GOTO HADERROR
 

+ 9 - 3
extern/hunspell/src/win_api/libhunspell.vcxproj

@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug_dll|Win32">
@@ -125,11 +125,11 @@
     <_ProjectFileVersion>14.0.22823.1</_ProjectFileVersion>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
-    <OutDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <OutDir>$(SolutionDir)$(Configuration)\$(ProjectName)\</OutDir>
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
     <IntDir>$(Configuration)\$(ProjectName)\</IntDir>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_dll|Win32'">
@@ -148,6 +148,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_dll|x64'">
     <LinkIncremental>true</LinkIncremental>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
+  </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <OutDir>$(SolutionDir)\ide\dist\$(Platform)\$(Configuration)\</OutDir>
+  </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>

+ 13 - 1
extern/llvm_build.bat

@@ -1,4 +1,6 @@
-@IF EXIST llvm-project GOTO LLVM_HAS
+PUSHD %~dp0..\
+
+@IF EXIST llvm-project_8_0_1 GOTO LLVM_HAS
 git clone --config core.autocrlf=false https://github.com/llvm/llvm-project.git llvm-project_8_0_1
 pushd llvm-project_8_0_1
 GOTO :LLVM_SET
@@ -24,3 +26,13 @@ cd llvm_win64_8_0_1
 :DOBUILD
 cmake --build . --config Debug 
 cmake --build . --config Release
+
+:SUCCESS
+@ECHO SUCCESS!
+@POPD
+@EXIT /b 0
+
+:HADERROR
+@ECHO =================FAILED=================
+@POPD
+@EXIT /b %ERRORLEVEL%