Skip to content

Instantly share code, notes, and snippets.

@ionoy
Created February 25, 2016 02:26
Show Gist options
  • Save ionoy/8a117af70b42c26d4da5 to your computer and use it in GitHub Desktop.
Save ionoy/8a117af70b42c26d4da5 to your computer and use it in GitHub Desktop.
diff --git a/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n b/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n
index b533192..27471a9 100644
--- a/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n
+++ b/Nitra/DotNetLang/Collectors/BaseTypeReferenceSet.n
@@ -33,8 +33,9 @@ namespace DotNet
private mutable _ancestorTypes : HashSet[TypeSymbol];
private mutable _parentClassScope : Scope;
private mutable _parentFullScope : Scope;
+ private mutable _ancestorsFullScope : Scope;
private _parentTypes : HashSet[TypeSymbol];
-
+
public CreatedOnStage : int { get; }
public CreatedOnPass : int { get; }
public IsCycled : bool { get { TryEvaluateHierarchy(); _isCycled } }
@@ -44,6 +45,7 @@ namespace DotNet
public ParentStructScope : Scope { get { EmptyScope.Instance } } //TODO: use scope of System.ValueType type
public ParentInterfaceScope : Scope { get { ParentFullScope } } //TODO: gather only Interface types from parent type lists and System.Object
public ParentFullScope : Scope { get { TryEvaluateHierarchy(); _parentFullScope } }
+ public AncestorsFullScope : Scope { get { TryEvaluateHierarchy(); _ancestorsFullScope } }
[Collect]
public AddParent(type : TypeSymbol) : void
@@ -87,6 +89,8 @@ namespace DotNet
def ancestorTypes = HashSet(_parentTypes);
mutable parentClassScope;
mutable parentFullScope = EmptyScope.Instance : Scope;
+ mutable ancestorsFullScope = EmptyScope.Instance : Scope;
+
foreach (type in _parentTypes)
{
| SupportsInheritanceTypeSymbol(BaseTypeSet = parentTypeSet, MemberTable = symbolScope) as symbol
@@ -102,12 +106,21 @@ namespace DotNet
| _ => ()
}
-
+
+ foreach (type in ancestorTypes)
+ {
+ | SupportsInheritanceTypeSymbol(MemberTable = symbolScope)
+ | ConstructedTypeSymbol(IsTypeInfoEvaluated = true, TypeInfo = GenericContainerTypeSymbol(MemberTable = symbolScope)) =>
+ ancestorsFullScope = ancestorsFullScope.HideWith(symbolScope);
+ | _ => ()
+ }
+
unless (_isCycled)
{
_ancestorTypes = ancestorTypes;
_parentClassScope = parentClassScope ?? EmptyScope.Instance;
_parentFullScope = parentFullScope;
+ _ancestorsFullScope = ancestorsFullScope;
}
_isEvaluationInProgress = false;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment