1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-30 05:15:59 +02:00

Added error/warning panel, region support

This commit is contained in:
Brian Fiete 2020-01-06 13:49:35 -08:00
parent c63edcbf87
commit 8970ebcd93
33 changed files with 454 additions and 130 deletions

View file

@ -10,6 +10,13 @@ namespace IDE.Compiler
{
public class BfPassInstance
{
public enum PassKind
{
None,
Parse,
Classify
}
[StdCall, CLink]
static extern void BfPassInstance_Delete(void* bfSystem);
@ -23,12 +30,12 @@ namespace IDE.Compiler
static extern int32 BfPassInstance_GetErrorCount(void* mNativeResolvePassData);
[StdCall, CLink]
static extern char8* BfPassInstance_GetErrorData(void* mNativeResolvePassData, int32 errorIdx, out bool isWarning,
out bool isAfter, out bool isDeferred, out bool isWhileSpecializing,
out bool isPersistent, out int32 srcStart, out int32 srcEnd, out int32 moreInfoCount);
static extern char8* BfPassInstance_GetErrorData(void* mNativeResolvePassData, int32 errorIdx, out int32 code, out bool isWarning,
out bool isAfter, out bool isDeferred, out bool isWhileSpecializing, out bool isPersistent, out char8* projectName,
out char8* fileName, out int32 srcStart, out int32 srcEnd, int32* srcLine, int32* srcColumn, out int32 moreInfoCount);
[StdCall, CLink]
static extern char8* BfPassInstance_Error_GetMoreInfoData(void* mNativeResolvePassData, int32 errorIdx, int32 moreInfoIdx, out char8* fileName, out int32 srcStart, out int32 srcEnd);
static extern char8* BfPassInstance_Error_GetMoreInfoData(void* mNativeResolvePassData, int32 errorIdx, int32 moreInfoIdx, out char8* fileName, out int32 srcStart, out int32 srcEnd, int32* srcLine, int32* srcColumn);
[StdCall, CLink]
static extern bool BfPassInstance_HadSignatureChanges(void* mNativeResolvePassData);
@ -36,18 +43,22 @@ namespace IDE.Compiler
public class BfError
{
public bool mIsWarning;
public int32 mCode;
public bool mIsAfter;
public bool mIsDeferred;
public bool mIsWhileSpecializing;
public bool mIsPersistent;
public String mProject ~ delete _;
public String mError ~ delete _;
public int32 mSrcStart;
public int32 mSrcEnd;
public int32 mLine = -1;
public int32 mColumn = -1;
public int32 mMoreInfoCount;
public bool mOwnsSpan;
public IdSpan mIdSpan ~ { if (mOwnsSpan) _.Dispose(); };
public int32 mErrorIdx = -1;
public String mFileName ~ delete _;
public String mFilePath ~ delete _;
public List<BfError> mMoreInfo ~ DeleteContainerAndItems!(_);
}
@ -110,21 +121,30 @@ namespace IDE.Compiler
return BfPassInstance_GetErrorCount(mNativeBfPassInstance);
}
public void GetErrorData(int32 errorIdx, BfError bfError)
public void GetErrorData(int32 errorIdx, BfError bfError, bool getLine = false)
{
Debug.Assert(bfError.mError == null);
bfError.mErrorIdx = errorIdx;
bfError.mError = new String(BfPassInstance_GetErrorData(mNativeBfPassInstance, errorIdx, out bfError.mIsWarning, out bfError.mIsAfter, out bfError.mIsDeferred,
out bfError.mIsWhileSpecializing, out bfError.mIsPersistent, out bfError.mSrcStart, out bfError.mSrcEnd, out bfError.mMoreInfoCount));
char8* projectName = null;
char8* fileName = null;
bfError.mError = new String(BfPassInstance_GetErrorData(mNativeBfPassInstance, errorIdx, out bfError.mCode, out bfError.mIsWarning, out bfError.mIsAfter, out bfError.mIsDeferred,
out bfError.mIsWhileSpecializing, out bfError.mIsPersistent, out projectName, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd,
getLine ? &bfError.mLine : null, getLine ? &bfError.mColumn : null,
out bfError.mMoreInfoCount));
if (projectName != null)
bfError.mProject = new String(projectName);
if (fileName != null)
bfError.mFilePath = new String(fileName);
}
public void GetMoreInfoErrorData(int32 errorIdx, int32 moreInfoIdx, BfError bfError)
public void GetMoreInfoErrorData(int32 errorIdx, int32 moreInfoIdx, BfError bfError, bool getLine = false)
{
char8* fileName = null;
char8* errorStr = BfPassInstance_Error_GetMoreInfoData(mNativeBfPassInstance, errorIdx, moreInfoIdx, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd);
Debug.Assert(bfError.mFileName == null);
char8* errorStr = BfPassInstance_Error_GetMoreInfoData(mNativeBfPassInstance, errorIdx, moreInfoIdx, out fileName, out bfError.mSrcStart, out bfError.mSrcEnd,
getLine ? &bfError.mLine : null, getLine ? &bfError.mColumn : null);
Debug.Assert(bfError.mFilePath == null);
if (fileName != null)
bfError.mFileName = new String(fileName);
bfError.mFilePath = new String(fileName);
if (bfError.mError == null)
bfError.mError = new String(errorStr);
else