From 3625d76cc75c843ba4b781f0b8b19b88d8c6bb85 Mon Sep 17 00:00:00 2001 From: Brian Fiete Date: Thu, 29 Aug 2019 17:40:17 -0700 Subject: [PATCH] Fixed cascade error, switched minidump test to use symbols.beeflang.org --- IDE/BeefProj.toml | 2 +- IDE/Tests/EmptyTest/scripts/Minidump.txt | 2 +- IDE/mintest/src/main3.bf | 4 ++ IDE/src/IDEApp.bf | 90 +++++++++++++----------- IDE/src/Settings.bf | 13 +++- IDEHelper/Compiler/BfExprEvaluator.cpp | 9 ++- IDEHelper/Compiler/BfExprEvaluator.h | 1 + IDEHelper/Compiler/BfSystem.h | 2 +- IDEHelper/DebugManager.cpp | 2 + 9 files changed, 78 insertions(+), 47 deletions(-) diff --git a/IDE/BeefProj.toml b/IDE/BeefProj.toml index 553c34fe..c2ab63f0 100644 --- a/IDE/BeefProj.toml +++ b/IDE/BeefProj.toml @@ -27,7 +27,7 @@ TargetDirectory = "$(WorkspaceDir)/dist" TargetName = "BeefIDE_d" OtherLinkFlags = "$(LinkFlags) Comdlg32.lib kernel32.lib user32.lib advapi32.lib shell32.lib IDEHelper64_d.lib" CLibType = "Dynamic" -DebugCommandArguments = "-proddir=C:\\Beef\\IDE\\Tests\\Test1 -test=scripts\\HotSwap_VirtualRemap.txt -platform=Win64 -testNoExit" +DebugCommandArguments = "-test=scripts\\Minidump.txt -testNoExit" DebugWorkingDirectory = "c:\\Beef\\IDE\\Tests\\EmptyTest" EnvironmentVars = ["_NO_DEBUG_HEAP=1"] diff --git a/IDE/Tests/EmptyTest/scripts/Minidump.txt b/IDE/Tests/EmptyTest/scripts/Minidump.txt index 6d9503ce..43a83879 100644 --- a/IDE/Tests/EmptyTest/scripts/Minidump.txt +++ b/IDE/Tests/EmptyTest/scripts/Minidump.txt @@ -1,4 +1,4 @@ -SetSymSrvOptions("C:/SymCache", "http://linux.beefy2d.com/symbols\nhttps://msdl.microsoft.com/download/symbols", "TempCache") +SetSymSrvOptions("C:/SymCache", "http://symbols.beeflang.org/\nhttps://msdl.microsoft.com/download/symbols", "TempCache") #SetSymSrvOptions("C:/SymCache", "https://msdl.microsoft.com/download/symbols\nhttps://chromium-browser-symsrv.commondatastorage.googleapis.com", "TempCache") #SetSymSrvOptions("C:/SymCache", "https://msdl.microsoft.com/download/symbols\nhttps://chromium-browser-symsrv.commondatastorage.googleapis.com", "None") diff --git a/IDE/mintest/src/main3.bf b/IDE/mintest/src/main3.bf index 3b46cb02..2e9424e4 100644 --- a/IDE/mintest/src/main3.bf +++ b/IDE/mintest/src/main3.bf @@ -130,6 +130,10 @@ class Blurg public static void Hey() { + TestStruct ts = .(); + //int val = ts..mA; + ts.mA = 123; + VoidCall(); int val0 = GetInt(); diff --git a/IDE/src/IDEApp.bf b/IDE/src/IDEApp.bf index 57cdb551..8c176bce 100644 --- a/IDE/src/IDEApp.bf +++ b/IDE/src/IDEApp.bf @@ -4737,11 +4737,13 @@ namespace IDE mViewWhiteSpace.mMenu = AddMenuItem(advancedEditMenu, "View White Space", "View White Space", null, null, true, mViewWhiteSpace.Bool ? 1 : 0); AddMenuItem(advancedEditMenu, "Reformat Document", "Reformat Document"); - subMenu.AddMenuItem(null); - - var internalEditMenu = subMenu.AddMenuItem("Internal"); - internalEditMenu.AddMenuItem("Hilight Cursor References", null, new (menu) => { ToggleCheck(menu, ref gApp.mSettings.mEditorSettings.mHiliteCursorReferences); }, null, null, true, gApp.mSettings.mEditorSettings.mHiliteCursorReferences ? 1 : 0); - internalEditMenu.AddMenuItem("Delayed Autocomplete", null, new (menu) => { ToggleCheck(menu, ref gApp.mDbgDelayedAutocomplete); }, null, null, true, gApp.mDbgDelayedAutocomplete ? 1 : 0); + if (mSettings.mEnableDevMode) + { + subMenu.AddMenuItem(null); + var internalEditMenu = subMenu.AddMenuItem("Internal"); + internalEditMenu.AddMenuItem("Hilight Cursor References", null, new (menu) => { ToggleCheck(menu, ref gApp.mSettings.mEditorSettings.mHiliteCursorReferences); }, null, null, true, gApp.mSettings.mEditorSettings.mHiliteCursorReferences ? 1 : 0); + internalEditMenu.AddMenuItem("Delayed Autocomplete", null, new (menu) => { ToggleCheck(menu, ref gApp.mDbgDelayedAutocomplete); }, null, null, true, gApp.mDbgDelayedAutocomplete ? 1 : 0); + } ////////// @@ -4774,10 +4776,13 @@ namespace IDE //subMenu.AddMenuItem("Compile Current File", null, new (menu) => { CompileCurrentFile(); }); AddMenuItem(subMenu, "Cancel Build", "Cancel Build", new (menu) => { menu.SetDisabled(!IsCompiling); }); - var internalBuildMenu = subMenu.AddMenuItem("Internal"); - internalBuildMenu.AddMenuItem("Autobuild (Debug)", null, new (menu) => { mDebugAutoBuild = !mDebugAutoBuild; }); - internalBuildMenu.AddMenuItem("Autorun (Debug)", null, new (menu) => { mDebugAutoRun = !mDebugAutoRun; }); - internalBuildMenu.AddMenuItem("Disable Compiling", null, new (menu) => { ToggleCheck(menu, ref mDisableBuilding); }, null, null, true, mDisableBuilding ? 1 : 0); + if (mSettings.mEnableDevMode) + { + var internalBuildMenu = subMenu.AddMenuItem("Internal"); + internalBuildMenu.AddMenuItem("Autobuild (Debug)", null, new (menu) => { mDebugAutoBuild = !mDebugAutoBuild; }); + internalBuildMenu.AddMenuItem("Autorun (Debug)", null, new (menu) => { mDebugAutoRun = !mDebugAutoRun; }); + internalBuildMenu.AddMenuItem("Disable Compiling", null, new (menu) => { ToggleCheck(menu, ref mDisableBuilding); }, null, null, true, mDisableBuilding ? 1 : 0); + } ////////// @@ -4803,38 +4808,41 @@ namespace IDE AddMenuItem(newBreakpointMenu, "&Memory Breakpoint...", "Breakpoint Memory"); AddMenuItem(newBreakpointMenu, "&Symbol Breakpoint...", "Breakpoint Symbol"); - var internalDebugMenu = subMenu.AddMenuItem("Internal"); - internalDebugMenu.AddMenuItem("Error Test", null, new (menu) => { DoErrorTest(); } ); - internalDebugMenu.AddMenuItem("Reconnect BeefPerf", null, new (menu) => { BeefPerf.RetryConnect(); } ); - AddMenuItem(internalDebugMenu, "Report Memory", "Report Memory"); - internalDebugMenu.AddMenuItem("Crash", null, new (menu) => { Runtime.FatalError("Bad"); }); - internalDebugMenu.AddMenuItem("Exit Test", null, new (menu) => { ExitTest(); }); - internalDebugMenu.AddMenuItem("Run Test", null, new (menu) => { mRunTest = !mRunTest; }); - internalDebugMenu.AddMenuItem("GC Collect", null, new (menu) => - { - var profileId = Profiler.StartSampling().GetValueOrDefault(); - for (int i < 10) - GC.Collect(false); - if (profileId != 0) - profileId.Dispose(); - }); - internalDebugMenu.AddMenuItem("Enable GC Collect", null, new (menu) => { ToggleCheck(menu, ref mEnableGCCollect); EnableGCCollect = mEnableGCCollect; }, null, null, true, mEnableGCCollect ? 1 : 0); - internalDebugMenu.AddMenuItem("Fast Updating", null, new (menu) => { ToggleCheck(menu, ref mDbgFastUpdate); EnableGCCollect = mDbgFastUpdate; }, null, null, true, mDbgFastUpdate ? 1 : 0); - internalDebugMenu.AddMenuItem("Alloc String", null, new (menu) => { new String("Alloc String"); }); - internalDebugMenu.AddMenuItem("Perform Long Update Checks", null, new (menu) => - { - bool wantsLongUpdateCheck = mLongUpdateProfileId != 0; - ToggleCheck(menu, ref wantsLongUpdateCheck); - mLastLongUpdateCheck = 0; - mLastLongUpdateCheckError = 0; - if (wantsLongUpdateCheck) - mLongUpdateProfileId = Profiler.StartSampling("LongUpdate"); - else - { - mLongUpdateProfileId.Dispose(); - mLongUpdateProfileId = 0; - } - }, null, null, true, (mLongUpdateProfileId != 0) ? 1 : 0); + if (mSettings.mEnableDevMode) + { + var internalDebugMenu = subMenu.AddMenuItem("Internal"); + internalDebugMenu.AddMenuItem("Error Test", null, new (menu) => { DoErrorTest(); } ); + internalDebugMenu.AddMenuItem("Reconnect BeefPerf", null, new (menu) => { BeefPerf.RetryConnect(); } ); + AddMenuItem(internalDebugMenu, "Report Memory", "Report Memory"); + internalDebugMenu.AddMenuItem("Crash", null, new (menu) => { Runtime.FatalError("Bad"); }); + internalDebugMenu.AddMenuItem("Exit Test", null, new (menu) => { ExitTest(); }); + internalDebugMenu.AddMenuItem("Run Test", null, new (menu) => { mRunTest = !mRunTest; }); + internalDebugMenu.AddMenuItem("GC Collect", null, new (menu) => + { + var profileId = Profiler.StartSampling().GetValueOrDefault(); + for (int i < 10) + GC.Collect(false); + if (profileId != 0) + profileId.Dispose(); + }); + internalDebugMenu.AddMenuItem("Enable GC Collect", null, new (menu) => { ToggleCheck(menu, ref mEnableGCCollect); EnableGCCollect = mEnableGCCollect; }, null, null, true, mEnableGCCollect ? 1 : 0); + internalDebugMenu.AddMenuItem("Fast Updating", null, new (menu) => { ToggleCheck(menu, ref mDbgFastUpdate); EnableGCCollect = mDbgFastUpdate; }, null, null, true, mDbgFastUpdate ? 1 : 0); + internalDebugMenu.AddMenuItem("Alloc String", null, new (menu) => { new String("Alloc String"); }); + internalDebugMenu.AddMenuItem("Perform Long Update Checks", null, new (menu) => + { + bool wantsLongUpdateCheck = mLongUpdateProfileId != 0; + ToggleCheck(menu, ref wantsLongUpdateCheck); + mLastLongUpdateCheck = 0; + mLastLongUpdateCheckError = 0; + if (wantsLongUpdateCheck) + mLongUpdateProfileId = Profiler.StartSampling("LongUpdate"); + else + { + mLongUpdateProfileId.Dispose(); + mLongUpdateProfileId = 0; + } + }, null, null, true, (mLongUpdateProfileId != 0) ? 1 : 0); + } ////////// diff --git a/IDE/src/Settings.bf b/IDE/src/Settings.bf index aaf01060..5495725c 100644 --- a/IDE/src/Settings.bf +++ b/IDE/src/Settings.bf @@ -638,6 +638,7 @@ namespace IDE public KeySettings mKeySettings = new .() ~ delete _; public RecentFiles mRecentFiles = new RecentFiles() ~ delete _; public String mWakaTimeKey = new .() ~ delete _; + public bool mEnableDevMode; public this() { @@ -691,7 +692,11 @@ namespace IDE } } - sd.Add("WakaTimeKey", mWakaTimeKey); + using (sd.CreateObject("Options")) + { + sd.Add("WakaTimeKey", mWakaTimeKey); + sd.Add("EnableDevMode", mEnableDevMode); + } String dataStr = scope String(); sd.ToTOML(dataStr); @@ -736,7 +741,11 @@ namespace IDE } } - sd.Get("WakaTimeKey", mWakaTimeKey); + using (sd.Open("Options")) + { + sd.Get("WakaTimeKey", mWakaTimeKey); + sd.Get("EnableDevMode", ref mEnableDevMode); + } } public void Apply() diff --git a/IDEHelper/Compiler/BfExprEvaluator.cpp b/IDEHelper/Compiler/BfExprEvaluator.cpp index 9a253a96..5ba15b76 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.cpp +++ b/IDEHelper/Compiler/BfExprEvaluator.cpp @@ -14824,12 +14824,19 @@ BfTypedValue BfExprEvaluator::SetupNullConditional(BfTypedValue thisValue, BfTok return thisValue; } +void BfExprEvaluator::CheckDotToken(BfTokenNode* tokenNode) +{ + if ((tokenNode != NULL) && (tokenNode->mToken == BfToken_DotDot)) + mModule->Fail("Unexpected cascade operation. Chaining can only be used for method invocations", tokenNode); +} + void BfExprEvaluator::DoMemberReference(BfMemberReferenceExpression* memberRefExpr, BfTypedValue* outCascadeValue) { + CheckDotToken(memberRefExpr->mDotToken); + BfAttributeState attributeState; attributeState.mTarget = (BfAttributeTargets)(BfAttributeTargets_MemberAccess); - String findName; BfAstNode* nameRefNode = memberRefExpr->mMemberName; if (auto attrIdentifierExpr = BfNodeDynCast(memberRefExpr->mMemberName)) diff --git a/IDEHelper/Compiler/BfExprEvaluator.h b/IDEHelper/Compiler/BfExprEvaluator.h index 7b618487..5a4d363c 100644 --- a/IDEHelper/Compiler/BfExprEvaluator.h +++ b/IDEHelper/Compiler/BfExprEvaluator.h @@ -383,6 +383,7 @@ public: void DoTypeIntAttr(BfTypeReference* typeRef, BfToken token); //void InitializedSizedArray(BfTupleExpression* createExpr, BfSizedArrayType* arrayType); void InitializedSizedArray(BfSizedArrayType* sizedArrayType, BfTokenNode* openToken, const BfSizedArray& values, const BfSizedArray& commas, BfTokenNode* closeToken, BfTypedValue* receivingValue = NULL); + void CheckDotToken(BfTokenNode* tokenNode); void DoMemberReference(BfMemberReferenceExpression* memberRefExpr, BfTypedValue* outCascadeValue); ////////////////////////////////////////////////////////////////////////// diff --git a/IDEHelper/Compiler/BfSystem.h b/IDEHelper/Compiler/BfSystem.h index 8895f9d5..1c6f3ce4 100644 --- a/IDEHelper/Compiler/BfSystem.h +++ b/IDEHelper/Compiler/BfSystem.h @@ -1387,7 +1387,7 @@ public: //#define BF_WANTS_LOG_CLANG //#define BF_WANTS_LOG_DBGEXPR //#define BF_WANTS_LOG_CV -#define BF_WANTS_LOG_DBG +//#define BF_WANTS_LOG_DBG #endif #ifdef BF_WANTS_LOG diff --git a/IDEHelper/DebugManager.cpp b/IDEHelper/DebugManager.cpp index e0057294..256c1b21 100644 --- a/IDEHelper/DebugManager.cpp +++ b/IDEHelper/DebugManager.cpp @@ -840,6 +840,8 @@ BF_EXPORT void BF_CALLTYPE Debugger_SetSymSrvOptions(const char* symCacheDir, co { String symStr = String(startStr, cPtr - startStr); symStr.Trim(); + if (symStr.EndsWith('/')) + symStr.Remove((int)symStr.length() - 1, 1); if (!symStr.IsEmpty()) symServers.Add(symStr); startStr = cPtr;