mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 04:22:20 +02:00
Fixed issue with outer extension state change
This commit is contained in:
parent
04a93f0618
commit
c7e41a30e4
5 changed files with 116 additions and 5 deletions
87
IDE/mintest/src/base.cs
Normal file
87
IDE/mintest/src/base.cs
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
/*using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Allegro
|
||||||
|
{
|
||||||
|
public partial class AllegroAPI
|
||||||
|
{
|
||||||
|
//internal const string AllegroDllName = "allegro_monolith-5.2.dll";
|
||||||
|
|
||||||
|
public static string AllegroDllVersionName(string name)
|
||||||
|
{
|
||||||
|
var p = (int)Environment.OSVersion.Platform;
|
||||||
|
if ((p == 4) || (p == 6) || (p == 128))
|
||||||
|
return name; // Linux
|
||||||
|
|
||||||
|
// Windows
|
||||||
|
return name + '-' + ALLEGRO_VERSION + '.' + ALLEGRO_SUB_VERSION + ".dll";
|
||||||
|
}
|
||||||
|
|
||||||
|
//private const string AllegroDllName = "allegro";
|
||||||
|
internal const string AllegroDllName = "allegro_monolith-5.2.dll";
|
||||||
|
|
||||||
|
|
||||||
|
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
||||||
|
public delegate int AppMainDelegate(int argc, string[] argv);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public const int ALLEGRO_VERSION = 5;
|
||||||
|
public const int ALLEGRO_SUB_VERSION = 2;
|
||||||
|
public const int ALLEGRO_WIP_VERSION = 2;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Not sure we need it, but since ALLEGRO_VERSION_STR contains it:
|
||||||
|
/// 0 = GIT
|
||||||
|
/// 1 = first release
|
||||||
|
/// 2... = hotfixes?
|
||||||
|
///
|
||||||
|
/// Note x.y.z (= x.y.z.0) has release number 1, and x.y.z.1 has release
|
||||||
|
/// number 2, just to confuse you.
|
||||||
|
/// </summary>
|
||||||
|
public const int ALLEGRO_RELEASE_NUMBER = 0;
|
||||||
|
|
||||||
|
public const string ALLEGRO_VERSION_STR = "5.2.2 (GIT)";
|
||||||
|
public const string ALLEGRO_DATE_STR = "2016";
|
||||||
|
public const int ALLEGRO_DATE = 20160731; /* yyyymmdd */
|
||||||
|
public const int ALLEGRO_VERSION_INT =
|
||||||
|
((ALLEGRO_VERSION << 24) | (ALLEGRO_SUB_VERSION << 16) |
|
||||||
|
(ALLEGRO_WIP_VERSION << 8) | ALLEGRO_RELEASE_NUMBER);
|
||||||
|
|
||||||
|
//[DllImport(AllegroDllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
//[Import(AllegroDllName)]Cdecl)]
|
||||||
|
public static extern UInt32 al_get_allegro_version();
|
||||||
|
|
||||||
|
[DllImport(AllegroDllName, CallingConvention = CallingConvention.Cdecl)]
|
||||||
|
public static extern int al_run_main(int argc,
|
||||||
|
[MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0, ArraySubType = UnmanagedType.LPStr)]
|
||||||
|
string[] argv, AppMainDelegate main);
|
||||||
|
|
||||||
|
/*******************************************/
|
||||||
|
/************ Some global stuff ************/
|
||||||
|
/*******************************************/
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// ALLEGRO_PI
|
||||||
|
/// </summary>
|
||||||
|
public const double ALLEGRO_PI = 3.14159265358979323846;
|
||||||
|
|
||||||
|
public static int AL_ID(byte a, byte b, byte c, byte d)
|
||||||
|
{
|
||||||
|
return (a << 24) | (b << 16) | (c << 8) | d;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public static bool IsLinux
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
int p = (int) Environment.OSVersion.Platform;
|
||||||
|
return (p == 4) || (p == 6) || (p == 128);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}*/
|
|
@ -1064,6 +1064,16 @@ namespace IDE.ui
|
||||||
return projectItem;
|
return projectItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProjectFolder GetSelectedProjectFolder()
|
||||||
|
{
|
||||||
|
let projectItem = GetSelectedProjectItem();
|
||||||
|
if (projectItem == null)
|
||||||
|
return null;
|
||||||
|
if (let projectFolder = projectItem as ProjectFolder)
|
||||||
|
return projectFolder;
|
||||||
|
return projectItem.mParentFolder;
|
||||||
|
}
|
||||||
|
|
||||||
public void SelectItem(ListViewItem item, bool checkKeyStates = false)
|
public void SelectItem(ListViewItem item, bool checkKeyStates = false)
|
||||||
{
|
{
|
||||||
if (item.Focused)
|
if (item.Focused)
|
||||||
|
@ -2145,7 +2155,7 @@ namespace IDE.ui
|
||||||
item = menu.AddItem("New Folder");
|
item = menu.AddItem("New Folder");
|
||||||
item.mOnMenuItemSelected.Add(new (item) =>
|
item.mOnMenuItemSelected.Add(new (item) =>
|
||||||
{
|
{
|
||||||
var projectFolder = GetSelectedProjectItem() as ProjectFolder;
|
var projectFolder = GetSelectedProjectFolder();
|
||||||
if (projectFolder != null)
|
if (projectFolder != null)
|
||||||
{
|
{
|
||||||
if (CheckProjectModify(projectFolder.mProject))
|
if (CheckProjectModify(projectFolder.mProject))
|
||||||
|
@ -2156,7 +2166,7 @@ namespace IDE.ui
|
||||||
item = menu.AddItem("New Class...");
|
item = menu.AddItem("New Class...");
|
||||||
item.mOnMenuItemSelected.Add(new (item) =>
|
item.mOnMenuItemSelected.Add(new (item) =>
|
||||||
{
|
{
|
||||||
var projectFolder = GetSelectedProjectItem() as ProjectFolder;
|
var projectFolder = GetSelectedProjectFolder();
|
||||||
if (projectFolder != null)
|
if (projectFolder != null)
|
||||||
{
|
{
|
||||||
if (CheckProjectModify(projectFolder.mProject))
|
if (CheckProjectModify(projectFolder.mProject))
|
||||||
|
|
|
@ -1467,7 +1467,12 @@ void BfDefBuilder::Visit(BfTypeDeclaration* typeDeclaration)
|
||||||
{
|
{
|
||||||
if (checkTypeDef->mDefState == BfTypeDef::DefState_AwaitingNewVersion)
|
if (checkTypeDef->mDefState == BfTypeDef::DefState_AwaitingNewVersion)
|
||||||
{
|
{
|
||||||
if (isExtension == (checkTypeDef->mTypeCode == BfTypeCode_Extension))
|
// We don't allow "new revision" semantics if the 'isExtension' state changes, or
|
||||||
|
// if the outer type did not use "new revision" semantics (for isExtension change on itself or other outer type)
|
||||||
|
bool isCompatible = (isExtension == (checkTypeDef->mTypeCode == BfTypeCode_Extension)) &&
|
||||||
|
(checkTypeDef->mOuterType == actualOuterTypeDef);
|
||||||
|
|
||||||
|
if (isCompatible)
|
||||||
{
|
{
|
||||||
if (prevRevisionTypeDef == NULL)
|
if (prevRevisionTypeDef == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -259,7 +259,10 @@ void BfGNUMangler::FindOrCreateNameSub(MangleContext& mangleContext, StringImpl&
|
||||||
if (useModule == NULL)
|
if (useModule == NULL)
|
||||||
useModule = mangleContext.mModule;
|
useModule = mangleContext.mModule;
|
||||||
auto outerType = useModule->GetOuterType(typeInst);
|
auto outerType = useModule->GetOuterType(typeInst);
|
||||||
|
if (outerType != NULL)
|
||||||
FindOrCreateNameSub(mangleContext, name, outerType, curMatchIdx, matchFailed);
|
FindOrCreateNameSub(mangleContext, name, outerType, curMatchIdx, matchFailed);
|
||||||
|
else
|
||||||
|
useModule->Fail("Failed to mangle name in BfGNUMangler::FindOrCreateNameSub");
|
||||||
}
|
}
|
||||||
|
|
||||||
FindOrCreateNameSub(mangleContext, name, NameSubstitute(NameSubstitute::Kind_TypeInstName, typeInst), curMatchIdx, matchFailed);
|
FindOrCreateNameSub(mangleContext, name, NameSubstitute(NameSubstitute::Kind_TypeInstName, typeInst), curMatchIdx, matchFailed);
|
||||||
|
@ -1283,7 +1286,10 @@ void BfMSMangler::Mangle(MangleContext& mangleContext, StringImpl& name, BfTypeI
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto outerType = useModule->GetOuterType(typeInstance);
|
auto outerType = useModule->GetOuterType(typeInstance);
|
||||||
|
if (outerType != NULL)
|
||||||
Mangle(mangleContext, name, outerType, true, true);
|
Mangle(mangleContext, name, outerType, true, true);
|
||||||
|
else
|
||||||
|
useModule->Fail("Failed to mangle name in BfMSMangler::Mangle");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4902,6 +4902,9 @@ BfType* BfModule::ResolveTypeDef(BfTypeDef* typeDef, BfPopulateType populateType
|
||||||
//BF_ASSERT(typeDef->mTypeCode != BfTypeCode_Extension);
|
//BF_ASSERT(typeDef->mTypeCode != BfTypeCode_Extension);
|
||||||
BF_ASSERT(!typeDef->mIsPartial || typeDef->mIsCombinedPartial);
|
BF_ASSERT(!typeDef->mIsPartial || typeDef->mIsCombinedPartial);
|
||||||
|
|
||||||
|
BF_ASSERT(typeDef->mDefState != BfTypeDef::DefState_Deleted);
|
||||||
|
BF_ASSERT((typeDef->mOuterType == NULL) || (typeDef->mOuterType->mDefState != BfTypeDef::DefState_Deleted));
|
||||||
|
|
||||||
if (typeDef->mGenericParamDefs.size() != 0)
|
if (typeDef->mGenericParamDefs.size() != 0)
|
||||||
return ResolveTypeDef(typeDef, BfTypeVector(), populateType);
|
return ResolveTypeDef(typeDef, BfTypeVector(), populateType);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue