mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-09 20:12:21 +02:00
Added errors panel
This commit is contained in:
parent
aa0277485f
commit
9d1b85cceb
8 changed files with 234 additions and 90 deletions
|
@ -4,14 +4,22 @@ namespace System.IO
|
|||
{
|
||||
class FolderBrowserDialog : CommonDialog
|
||||
{
|
||||
public enum FolderKind
|
||||
{
|
||||
Open,
|
||||
Save
|
||||
}
|
||||
|
||||
String mSelectedPath = new String() ~ delete _;
|
||||
public bool ShowNewFolderButton;
|
||||
String mDescriptionText = new String() ~ delete _;
|
||||
bool mSelectedPathNeedsCheck;
|
||||
static FolderBrowserDialog sCurrentThis;
|
||||
FolderKind mFolderKind;
|
||||
|
||||
public this()
|
||||
public this(FolderKind kind = .Open)
|
||||
{
|
||||
mFolderKind = kind;
|
||||
Reset();
|
||||
}
|
||||
|
||||
|
@ -51,6 +59,51 @@ namespace System.IO
|
|||
|
||||
protected Result<DialogResult> RunDialog_New(Windows.HWnd hWndOwner, FolderBrowserDialog.COM_IFileDialog* fileDialog)
|
||||
{
|
||||
//COM_IFileDialogEvents evts;
|
||||
/*COM_IFileDialogEvents.VTable funcs;
|
||||
funcs.QueryInterface = (self, riid, result) =>
|
||||
{
|
||||
return .E_FAIL;
|
||||
};
|
||||
funcs.AddRef = (self) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.Release = (self) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnFileOk = (self, fileDialog) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnFolderChanging = (self, fileDialog, folder) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnFolderChange = (self, fileDialog) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnSelectionChange = (self, fileDialog) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnShareViolation = (self, fileDialog, result) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnTypeChange = (self, fileDialog) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
funcs.OnOverwrite = (self, fileDialog, item, result) =>
|
||||
{
|
||||
return .OK;
|
||||
};
|
||||
evts.[Friend]mVT = &funcs;
|
||||
fileDialog.VT.Advise(fileDialog, &evts, var adviseCookie);*/
|
||||
|
||||
if (!mSelectedPath.IsEmpty)
|
||||
{
|
||||
COM_IShellItem* folderShellItem = null;
|
||||
|
@ -90,7 +143,11 @@ namespace System.IO
|
|||
protected override Result<DialogResult> RunDialog(Windows.HWnd hWndOwner)
|
||||
{
|
||||
FolderBrowserDialog.COM_IFileDialog* fileDialog = null;
|
||||
let hr = Windows.COM_IUnknown.CoCreateInstance(ref FolderBrowserDialog.COM_IFileDialog.sCLSID, null, .INPROC_SERVER, ref FolderBrowserDialog.COM_IFileDialog.sIID, (void**)&fileDialog);
|
||||
Windows.COM_IUnknown.HResult hr;
|
||||
//if (mFolderKind == .Open)
|
||||
hr = Windows.COM_IUnknown.CoCreateInstance(ref FolderBrowserDialog.COM_IFileDialog.sCLSID, null, .INPROC_SERVER, ref FolderBrowserDialog.COM_IFileDialog.sIID, (void**)&fileDialog);
|
||||
//else
|
||||
//hr = Windows.COM_IUnknown.CoCreateInstance(ref FolderBrowserDialog.COM_FileSaveDialog.sCLSID, null, .INPROC_SERVER, ref FolderBrowserDialog.COM_FileSaveDialog.sIID, (void**)&fileDialog);
|
||||
if (hr == 0)
|
||||
return RunDialog_New(hWndOwner, fileDialog);
|
||||
|
||||
|
@ -163,9 +220,22 @@ namespace System.IO
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct COM_IFileDialogEvents
|
||||
{
|
||||
struct FDE_SHAREVIOLATION_RESPONSE;
|
||||
struct FDE_OVERWRITE_RESPONSE;
|
||||
|
||||
struct COM_IFileDialogEvents : Windows.COM_IUnknown
|
||||
{
|
||||
public struct VTable : Windows.COM_IUnknown.VTable
|
||||
{
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog) OnFileOk;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog, COM_IShellItem* psiFolder) OnFolderChanging;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog) OnFolderChange;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog) OnSelectionChange;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog, FDE_SHAREVIOLATION_RESPONSE* pResponse) OnShareViolation;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog) OnTypeChange;
|
||||
public function HResult(COM_IFileDialogEvents* self, COM_IFileDialog* fileDialog, COM_IShellItem* shellItem, FDE_OVERWRITE_RESPONSE* response) OnOverwrite;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
struct COM_IShellItem : Windows.COM_IUnknown
|
||||
|
@ -280,6 +350,12 @@ namespace System.IO
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public struct COM_FileSaveDialog : COM_IFileDialog
|
||||
{
|
||||
public static new Guid sIID = .(0x84bccd23, 0x5fde, 0x4cdb, 0xae, 0xa4, 0xaf, 0x64, 0xb8, 0x3d, 0x78, 0xab);
|
||||
public static new Guid sCLSID = .(0xC0B4E2F3, 0xBA21, 0x4773, 0x8D, 0xBA, 0x33, 0x5E, 0xC9, 0x46, 0xEB, 0x8B);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
|
@ -633,6 +633,7 @@ namespace IDE
|
|||
RemoveAndDelete!(mWatchPanel);
|
||||
RemoveAndDelete!(mMemoryPanel);
|
||||
RemoveAndDelete!(mCallStackPanel);
|
||||
RemoveAndDelete!(mErrorsPanel);
|
||||
RemoveAndDelete!(mBreakpointPanel);
|
||||
RemoveAndDelete!(mModulePanel);
|
||||
RemoveAndDelete!(mThreadPanel);
|
||||
|
@ -705,6 +706,26 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
void WithStandardPanels(delegate void(Panel panel) dlg)
|
||||
{
|
||||
dlg(mProjectPanel);
|
||||
dlg(mClassViewPanel);
|
||||
dlg(mOutputPanel);
|
||||
dlg(mImmediatePanel);
|
||||
dlg(mFindResultsPanel);
|
||||
dlg(mAutoWatchPanel);
|
||||
dlg(mWatchPanel);
|
||||
dlg(mMemoryPanel);
|
||||
dlg(mCallStackPanel);
|
||||
dlg(mErrorsPanel);
|
||||
dlg(mBreakpointPanel);
|
||||
dlg(mModulePanel);
|
||||
dlg(mThreadPanel);
|
||||
dlg(mProfilePanel);
|
||||
dlg(mPropertiesPanel);
|
||||
dlg(mAutoCompletePanel);
|
||||
}
|
||||
|
||||
public override void ShutdownCompleted()
|
||||
{
|
||||
base.ShutdownCompleted();
|
||||
|
@ -804,7 +825,7 @@ namespace IDE
|
|||
FinishShowingNewWorkspace();
|
||||
}
|
||||
|
||||
public void DoOpenWorkspace()
|
||||
public void DoOpenWorkspace(bool isCreating = false)
|
||||
{
|
||||
#if !CLI
|
||||
if (mDeferredOpenFileName != null)
|
||||
|
@ -817,12 +838,13 @@ namespace IDE
|
|||
return;
|
||||
}
|
||||
|
||||
var folderDialog = scope FolderBrowserDialog();
|
||||
var folderDialog = scope FolderBrowserDialog(isCreating ? .Save : .Open);
|
||||
var initialDir = scope String();
|
||||
if (mInstallDir.Length > 0)
|
||||
Path.GetDirectoryPath(.(mInstallDir, 0, mInstallDir.Length - 1), initialDir);
|
||||
initialDir.Concat(Path.DirectorySeparatorChar, "Samples");
|
||||
folderDialog.SelectedPath = initialDir;
|
||||
//folderDialog.
|
||||
if (folderDialog.ShowDialog(GetActiveWindow()).GetValueOrDefault() == .OK)
|
||||
{
|
||||
var selectedPath = scope String..AppendF(folderDialog.SelectedPath);
|
||||
|
@ -1607,7 +1629,17 @@ namespace IDE
|
|||
|
||||
using (sd.CreateObject("MainWindow"))
|
||||
{
|
||||
if (mMainWindow != null)
|
||||
SerializeWindow(sd, mMainWindow);
|
||||
else
|
||||
{
|
||||
|
||||
sd.Add("X", mRequestedWindowRect.mX);
|
||||
sd.Add("Y", mRequestedWindowRect.mY);
|
||||
sd.Add("Width", mRequestedWindowRect.mWidth);
|
||||
sd.Add("Height", mRequestedWindowRect.mHeight);
|
||||
sd.Add("ShowKind", mRequestedShowKind);
|
||||
}
|
||||
}
|
||||
|
||||
using (sd.CreateObject("MainDockingFrame"))
|
||||
|
@ -2123,21 +2155,10 @@ namespace IDE
|
|||
if (!mRunningTestScript)
|
||||
{
|
||||
mActiveDocumentsTabbedView = null;
|
||||
ResetPanel(mProjectPanel);
|
||||
ResetPanel(mClassViewPanel);
|
||||
ResetPanel(mOutputPanel);
|
||||
ResetPanel(mImmediatePanel);
|
||||
ResetPanel(mFindResultsPanel);
|
||||
ResetPanel(mAutoWatchPanel);
|
||||
ResetPanel(mWatchPanel);
|
||||
ResetPanel(mMemoryPanel);
|
||||
ResetPanel(mCallStackPanel);
|
||||
ResetPanel(mBreakpointPanel);
|
||||
ResetPanel(mModulePanel);
|
||||
ResetPanel(mThreadPanel);
|
||||
ResetPanel(mProfilePanel);
|
||||
ResetPanel(mPropertiesPanel);
|
||||
ResetPanel(mAutoCompletePanel);
|
||||
WithStandardPanels(scope (panel) =>
|
||||
{
|
||||
ResetPanel(panel);
|
||||
});
|
||||
mMainFrame.Reset();
|
||||
}
|
||||
|
||||
|
@ -2158,6 +2179,8 @@ namespace IDE
|
|||
delete mWorkspace;
|
||||
mWorkspace = new Workspace();
|
||||
|
||||
mErrorsPanel.Clear();
|
||||
|
||||
OutputLine("Workspace closed.");
|
||||
}
|
||||
|
||||
|
@ -2332,9 +2355,9 @@ namespace IDE
|
|||
}
|
||||
|
||||
//Directory.CreateDirectory(mWorkspace.mDir).IgnoreError();
|
||||
|
||||
int lastSlashPos = mWorkspace.mDir.LastIndexOf(IDEUtils.cNativeSlash);
|
||||
String projectName = scope String(mWorkspace.mDir, lastSlashPos + 1);
|
||||
//int lastSlashPos = mWorkspace.mDir.LastIndexOf(IDEUtils.cNativeSlash);
|
||||
String projectName = mWorkspace.mName;
|
||||
Debug.Assert(!projectName.IsWhiteSpace);
|
||||
|
||||
String projectPath = scope String(mWorkspace.mDir);
|
||||
Utils.GetDirWithSlash(projectPath);
|
||||
|
@ -3085,10 +3108,12 @@ namespace IDE
|
|||
|
||||
if (!mRunningTestScript)
|
||||
{
|
||||
#if !CLI
|
||||
if (!mWorkspace.IsDebugSession)
|
||||
success &= SaveWorkspaceUserData();
|
||||
if (mSettings.mLoadedSettings)
|
||||
mSettings.Save();
|
||||
#endif
|
||||
}
|
||||
|
||||
MarkDirty();
|
||||
|
@ -6639,6 +6664,8 @@ namespace IDE
|
|||
outStr = scope:: String(format);
|
||||
outStr.Replace("\r", "");
|
||||
#if CLI
|
||||
if (outStr.StartsWith("ERROR:"))
|
||||
mFailed = true;
|
||||
Console.WriteLine(outStr);
|
||||
#else
|
||||
outStr.Append("\n");
|
||||
|
@ -9491,6 +9518,7 @@ namespace IDE
|
|||
return;
|
||||
|
||||
OnWatchedFileChanged(project.mRootFolder, .FileCreated, srcPath);
|
||||
|
||||
if (project.IsEmpty)
|
||||
return;
|
||||
|
||||
|
@ -9509,10 +9537,9 @@ namespace IDE
|
|||
{
|
||||
if (mWorkspace.mStartupProject.IsEmpty)
|
||||
{
|
||||
#if !CLI
|
||||
DarkDialog dlg = new DarkDialog("Initialize Project?",
|
||||
"""
|
||||
This project does not contain any source code. Do you want to auto-generate some startup code?
|
||||
"""
|
||||
scope String("The project does not contain any source code. Do you want to auto-generate some startup code?", mWorkspace.mStartupProject.mProjectName)
|
||||
, DarkTheme.sDarkTheme.mIconError);
|
||||
dlg.mWindowFlags |= .Modal;
|
||||
dlg.AddYesNoButtons(new (dlg) =>
|
||||
|
@ -9524,7 +9551,9 @@ namespace IDE
|
|||
|
||||
});
|
||||
dlg.PopupWindow(GetActiveWindow());
|
||||
|
||||
#else
|
||||
OutputErrorLine("The project '{}' does not contain any source code. Run with '-generate' to auto-generate some startup code.", mWorkspace.mStartupProject.mProjectName);
|
||||
#endif
|
||||
OutputLine("Aborted - no startup project code found.");
|
||||
return false;
|
||||
}
|
||||
|
@ -11692,8 +11721,8 @@ namespace IDE
|
|||
{
|
||||
CompilerLog("IDEApp.OnWatchedFileChanged {} {} {}", projectItem.mName, changeType, newPath);
|
||||
|
||||
ProjectListViewItem listViewItem;
|
||||
mProjectPanel.mProjectToListViewMap.TryGetValue(projectItem, out listViewItem);
|
||||
ProjectListViewItem listViewItem = null;
|
||||
mProjectPanel?.mProjectToListViewMap.TryGetValue(projectItem, out listViewItem);
|
||||
|
||||
String newName = null;
|
||||
if (newPath != null)
|
||||
|
@ -11708,6 +11737,7 @@ namespace IDE
|
|||
{
|
||||
let projectFileItem = projectItem as ProjectFileItem;
|
||||
|
||||
if (listViewItem != null)
|
||||
listViewItem.Label = newName;
|
||||
|
||||
String oldPath = scope String();
|
||||
|
@ -11715,14 +11745,14 @@ namespace IDE
|
|||
projectFileItem.Rename(newName);
|
||||
|
||||
FileRenamed(projectFileItem, oldPath, newPath);
|
||||
mProjectPanel.SortItem((ProjectListViewItem)listViewItem.mParentItem);
|
||||
mProjectPanel?.SortItem((ProjectListViewItem)listViewItem.mParentItem);
|
||||
}
|
||||
}
|
||||
else if (changeType == .Deleted)
|
||||
{
|
||||
if (projectItem.mIncludeKind == .Auto)
|
||||
{
|
||||
mProjectPanel.DoDeleteItem(listViewItem, null, true);
|
||||
mProjectPanel?.DoDeleteItem(listViewItem, null, true);
|
||||
}
|
||||
}
|
||||
else if (changeType == .FileCreated)
|
||||
|
@ -11742,11 +11772,14 @@ namespace IDE
|
|||
projectFolder.AddChild(projectSource);
|
||||
projectFolder.MarkAsUnsorted();
|
||||
|
||||
if (mProjectPanel != null)
|
||||
{
|
||||
mProjectPanel.AddProjectItem(projectSource);
|
||||
mProjectPanel.QueueSortItem(listViewItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (changeType == .DirectoryCreated)
|
||||
{
|
||||
let projectFolder = projectItem as ProjectFolder;
|
||||
|
@ -11764,20 +11797,27 @@ namespace IDE
|
|||
projectFolder.AddChild(newFolder);
|
||||
projectFolder.MarkAsUnsorted();
|
||||
|
||||
if (mProjectPanel != null)
|
||||
{
|
||||
mProjectPanel.AddProjectItem(newFolder);
|
||||
mProjectPanel.QueueSortItem(listViewItem);
|
||||
}
|
||||
|
||||
newFolder.mAutoInclude = true;
|
||||
if (mProjectPanel != null)
|
||||
mProjectPanel.QueueRehupFolder(newFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (changeType == .Failed)
|
||||
{
|
||||
if (mProjectPanel != null)
|
||||
{
|
||||
if (let projectFolder = projectItem as ProjectFolder)
|
||||
mProjectPanel.QueueRehupFolder(projectFolder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWorkspace()
|
||||
{
|
||||
|
@ -12091,7 +12131,7 @@ namespace IDE
|
|||
DarkTheme.sDarkTheme.mIconWarning);
|
||||
dialog.mDefaultButton = dialog.AddButton("Yes", new (evt) =>
|
||||
{
|
||||
DoOpenWorkspace();
|
||||
DoOpenWorkspace(true);
|
||||
});
|
||||
dialog.AddButton("No", new (evt) =>
|
||||
{
|
||||
|
@ -12107,7 +12147,7 @@ namespace IDE
|
|||
DarkTheme.sDarkTheme.mIconWarning);
|
||||
dialog.mDefaultButton = dialog.AddButton("Yes", new (evt) =>
|
||||
{
|
||||
DoOpenWorkspace();
|
||||
DoOpenWorkspace(true);
|
||||
});
|
||||
dialog.AddButton("No", new (evt) =>
|
||||
{
|
||||
|
@ -12118,7 +12158,7 @@ namespace IDE
|
|||
}
|
||||
}
|
||||
|
||||
DoOpenWorkspace();
|
||||
DoOpenWorkspace(true);
|
||||
if (mDeferredOpen != .None)
|
||||
mDeferredOpen = _;
|
||||
case .Workspace:
|
||||
|
|
|
@ -222,6 +222,18 @@ namespace IDE.ui
|
|||
}
|
||||
}
|
||||
|
||||
public void Clear()
|
||||
{
|
||||
using (mMonitor.Enter())
|
||||
{
|
||||
ClearParserErrors(null);
|
||||
ClearAndDeleteItems(mResolveErrors);
|
||||
mErrorsDirty = true;
|
||||
mErrorCount = 0;
|
||||
mWarningCount = 0;
|
||||
}
|
||||
}
|
||||
|
||||
void ProcessErrors()
|
||||
{
|
||||
using (mMonitor.Enter())
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace IDE.ui
|
|||
"Library",
|
||||
"Dynamic Library",
|
||||
"Custom Build");
|
||||
public bool mDirChanged;
|
||||
public bool mNameChanged;
|
||||
public String mDirBase ~ delete _;
|
||||
|
||||
public this()
|
||||
|
@ -155,15 +155,16 @@ namespace IDE.ui
|
|||
return true;
|
||||
}
|
||||
|
||||
public void UpdateProjectDir()
|
||||
public void UpdateProjectName()
|
||||
{
|
||||
if ((!mDirChanged) && (!mDirBase.IsEmpty))
|
||||
if (!mNameChanged)
|
||||
{
|
||||
String dirPath = scope .();
|
||||
dirPath.Append(mDirBase);
|
||||
dirPath.Append(Path.DirectorySeparatorChar);
|
||||
mNameEdit.GetText(dirPath);
|
||||
mDirectoryEdit.SetText(dirPath);
|
||||
String path = scope .();
|
||||
mDirectoryEdit.GetText(path);
|
||||
|
||||
String projName = scope .();
|
||||
Path.GetFileName(path, projName);
|
||||
mNameEdit.SetText(projName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -171,11 +172,6 @@ namespace IDE.ui
|
|||
{
|
||||
mDefaultButton = AddButton("Create", new (evt) => { if (!CreateProject()) evt.mCloseDialog = false; });
|
||||
mEscButton = AddButton("Cancel", new (evt) => Close());
|
||||
mNameEdit = AddEdit("");
|
||||
mNameEdit.mOnContentChanged.Add(new (dlg) =>
|
||||
{
|
||||
UpdateProjectDir();
|
||||
});
|
||||
|
||||
if (gApp.mWorkspace.IsInitialized)
|
||||
mDirBase = new String(gApp.mWorkspace.mDir);
|
||||
|
@ -185,10 +181,16 @@ namespace IDE.ui
|
|||
AddEdit(mDirectoryEdit);
|
||||
mDirectoryEdit.mOnContentChanged.Add(new (dlg) =>
|
||||
{
|
||||
if (mDirectoryEdit.mHasFocus)
|
||||
mDirChanged = true;
|
||||
UpdateProjectName();
|
||||
});
|
||||
UpdateProjectDir();
|
||||
|
||||
mNameEdit = AddEdit("");
|
||||
mNameEdit.mOnContentChanged.Add(new (dlg) =>
|
||||
{
|
||||
if (mNameEdit.mHasFocus)
|
||||
mNameChanged = true;
|
||||
});
|
||||
UpdateProjectName();
|
||||
|
||||
mTargetComboBox = new DarkComboBox();
|
||||
mTargetComboBox.Label = sApplicationTypeNames[0];
|
||||
|
@ -211,7 +213,7 @@ namespace IDE.ui
|
|||
public override void PopupWindow(WidgetWindow parentWindow, float offsetX = 0, float offsetY = 0)
|
||||
{
|
||||
base.PopupWindow(parentWindow, offsetX, offsetY);
|
||||
mNameEdit.SetFocus();
|
||||
mDirectoryEdit.SetFocus();
|
||||
}
|
||||
|
||||
public override void ResizeComponents()
|
||||
|
@ -222,18 +224,18 @@ namespace IDE.ui
|
|||
mTargetComboBox.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(28));
|
||||
|
||||
curY -= GS!(40);
|
||||
mDirectoryEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
mNameEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
|
||||
curY -= GS!(50);
|
||||
mNameEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
mDirectoryEdit.Resize(GS!(16), curY - GS!(36), mWidth - GS!(16) * 2, GS!(24));
|
||||
}
|
||||
|
||||
public override void Draw(Graphics g)
|
||||
{
|
||||
base.Draw(g);
|
||||
|
||||
g.DrawString("Project Name", mNameEdit.mX, mNameEdit.mY - GS!(20));
|
||||
g.DrawString("Project Directory", mDirectoryEdit.mX, mDirectoryEdit.mY - GS!(20));
|
||||
g.DrawString("Project Name", mNameEdit.mX, mNameEdit.mY - GS!(20));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2248,7 +2248,7 @@ BeMCOperand BeMCContext::GetOperand(BeValue* value, bool allowMetaResult, bool a
|
|||
mcOperand.mKind = BeMCOperandKind_Immediate_i64;
|
||||
break;
|
||||
default:
|
||||
NotImpl();
|
||||
Fail("Unhandled constant type");
|
||||
}
|
||||
mcOperand.mImmediate = constant->mInt64;
|
||||
return mcOperand;
|
||||
|
@ -3585,7 +3585,7 @@ void BeMCContext::CreatePhiAssign(BeMCBlock* mcBlock, const BeMCOperand& testVal
|
|||
}
|
||||
else
|
||||
{
|
||||
NotImpl();
|
||||
SoftFail("Unhandled CreatePhiAssign value");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6080,7 +6080,7 @@ void BeMCContext::EmitModRM_XMM_IMM(int rx, BeMCOperand & imm)
|
|||
sym = mCOFFObject->GetCOMDAT(name, data, 16, 16);
|
||||
}
|
||||
else
|
||||
NotImpl();
|
||||
SoftFail("Unhandled value type in EmitModRM_XMM_IMM");
|
||||
|
||||
BeMCRelocation reloc;
|
||||
reloc.mKind = BeMCRelocationKind_REL32;
|
||||
|
@ -9993,6 +9993,14 @@ bool BeMCContext::DoLegalization()
|
|||
}
|
||||
}
|
||||
break;
|
||||
case BeMCInstKind_DefPhi:
|
||||
{
|
||||
// This is from a PHI whose value was not used
|
||||
RemoveInst(mcBlock, instIdx);
|
||||
instIdx--;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
if ((pendingInitKind != BfIRInitType_NotNeeded) && (pendingInitKind != BfIRInitType_NotNeeded_AliveOnDecl))
|
||||
|
@ -13860,7 +13868,8 @@ void BeMCContext::DoCodeEmission()
|
|||
//mOut.Write((uint8)0xC3);
|
||||
break;
|
||||
default:
|
||||
NotImpl();
|
||||
SoftFail("Unhandled instruction in DoCodeEmission", inst->mDbgLoc);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -14747,7 +14756,7 @@ void BeMCContext::Generate(BeFunction* function)
|
|||
mDbgPreferredRegs[32] = X64Reg_R8;*/
|
||||
|
||||
//mDbgPreferredRegs[8] = X64Reg_RAX;
|
||||
//mDebugging = function->mName ==
|
||||
//mDebugging = function->mName == "?Do@ClassA@bf@@QEAAXXZ";
|
||||
//"?ColorizeCodeString@IDEUtils@IDE@bf@@SAXPEAVString@System@3@W4CodeKind@123@@Z";
|
||||
//"?Main@Program@bf@@CAHPEAV?$Array1@PEAVString@System@bf@@@System@2@@Z";
|
||||
|
||||
|
@ -15674,7 +15683,7 @@ void BeMCContext::Generate(BeFunction* function)
|
|||
|
||||
}
|
||||
else
|
||||
SoftFail("Invalid GEP");
|
||||
SoftFail("Invalid GEP", inst->mDbgLoc);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -16350,7 +16359,7 @@ void BeMCContext::Generate(BeFunction* function)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
NotImpl();
|
||||
Fail("Unhandled BeInst type");
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -6890,11 +6890,14 @@ BfTypedValue BfModule::FlushNullConditional(BfTypedValue result, bool ignoreNull
|
|||
if (nullableTypedValue)
|
||||
{
|
||||
auto elementType = nullableType->GetUnderlyingType();
|
||||
if (elementType->IsValuelessType())
|
||||
if (elementType->IsVar())
|
||||
{
|
||||
// Do nothing
|
||||
}
|
||||
else if (elementType->IsValuelessType())
|
||||
{
|
||||
BfIRValue ptrValue = mBfIRBuilder->CreateInBoundsGEP(nullableTypedValue.mValue, 0, 1); // mHasValue
|
||||
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
|
||||
result = nullableTypedValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -6902,8 +6905,8 @@ BfTypedValue BfModule::FlushNullConditional(BfTypedValue result, bool ignoreNull
|
|||
mBfIRBuilder->CreateStore(result.mValue, ptrValue);
|
||||
ptrValue = mBfIRBuilder->CreateInBoundsGEP(nullableTypedValue.mValue, 0, 2); // mHasValue
|
||||
mBfIRBuilder->CreateStore(GetConstValue(1, GetPrimitiveType(BfTypeCode_Boolean)), ptrValue);
|
||||
result = nullableTypedValue;
|
||||
}
|
||||
result = nullableTypedValue;
|
||||
}
|
||||
mBfIRBuilder->CreateBr(pendingNullCond->mDoneBB);
|
||||
|
||||
|
|
|
@ -652,12 +652,13 @@ void BfModule::TypeFailed(BfTypeInstance* typeInstance)
|
|||
{
|
||||
BfLogSysM("TypeFailed: %p\n", typeInstance);
|
||||
typeInstance->mTypeFailed = true;
|
||||
// Punt on field types - just substitute System.Object where we have NULLs
|
||||
// Punt on field types - just substitute 'var' where we have NULLs
|
||||
for (auto& fieldInstance : typeInstance->mFieldInstances)
|
||||
{
|
||||
if ((fieldInstance.mResolvedType == NULL) || (fieldInstance.mResolvedType->IsNull()))
|
||||
{
|
||||
fieldInstance.mResolvedType = mContext->mBfObjectType;
|
||||
if (fieldInstance.mDataIdx >= 0)
|
||||
fieldInstance.mResolvedType = GetPrimitiveType(BfTypeCode_Var);
|
||||
}
|
||||
if (fieldInstance.mOwner == NULL)
|
||||
fieldInstance.mOwner = typeInstance;
|
||||
|
@ -2268,6 +2269,8 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
if ((fieldInstance->mResolvedType != NULL) || (!fieldInstance->mFieldIncluded))
|
||||
continue;
|
||||
|
||||
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, field);
|
||||
|
||||
BfType* resolvedFieldType = NULL;
|
||||
|
||||
if (field->IsEnumCaseEntry())
|
||||
|
@ -2305,7 +2308,6 @@ bool BfModule::DoPopulateType(BfType* resolvedTypeRef, BfPopulateType populateTy
|
|||
}
|
||||
else
|
||||
{
|
||||
SetAndRestoreValue<BfFieldDef*> prevTypeRef(mContext->mCurTypeState->mCurFieldDef, field);
|
||||
resolvedFieldType = ResolveTypeRef(field->mTypeRef, BfPopulateType_Declaration, BfResolveTypeRefFlag_NoResolveGenericParam);
|
||||
if (resolvedFieldType == NULL)
|
||||
{
|
||||
|
|
|
@ -198,7 +198,7 @@ BfAstNode* BfReducer::Fail(const StringImpl& errorMsg, BfAstNode* refNode)
|
|||
if (mPassInstance->HasLastFailedAt(refNode)) // No duplicate failures
|
||||
return NULL;
|
||||
auto error = mPassInstance->Fail(errorMsg, refNode);
|
||||
if (error != NULL)
|
||||
if ((error != NULL) && (mSource != NULL))
|
||||
error->mProject = mSource->mProject;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -207,7 +207,7 @@ BfAstNode* BfReducer::FailAfter(const StringImpl& errorMsg, BfAstNode* prevNode)
|
|||
{
|
||||
mStmtHasError = true;
|
||||
auto error = mPassInstance->FailAfter(errorMsg, prevNode);
|
||||
if (error != NULL)
|
||||
if ((error != NULL) && (mSource != NULL))
|
||||
error->mProject = mSource->mProject;
|
||||
return NULL;
|
||||
}
|
||||
|
@ -4299,7 +4299,7 @@ BfAstNode* BfReducer::CreateStatement(BfAstNode* node, CreateStmtFlags createStm
|
|||
return stmt;
|
||||
|
||||
auto error = mPassInstance->FailAfterAt("Semicolon expected", node->GetSourceData(), stmt->GetSrcEnd() - 1);
|
||||
if (error != NULL)
|
||||
if ((error != NULL) && (mSource != NULL))
|
||||
error->mProject = mSource->mProject;
|
||||
mPrevStmtHadError = true;
|
||||
return stmt;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue