Skip to content

Differenciate pointers and managed pointers #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: metadata-provider
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion MetadataProvider/SignatureTypeProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ public virtual IType GetPointerType(IType targetType)

public virtual IType GetByReferenceType(IType targetType)
{
var result = new PointerType(targetType);
var result = new PointerType(targetType, true);
return result;
}

Expand Down
10 changes: 7 additions & 3 deletions Model/Types/Types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -656,10 +656,13 @@ public class PointerType : IReferenceType
public ISet<CustomAttribute> Attributes { get; private set; }
public IType TargetType { get; set; }

public PointerType(IType targetType)
public bool Managed { get; private set; }

public PointerType(IType targetType, bool managed = false)
{
this.TargetType = targetType;
this.Attributes = new HashSet<CustomAttribute>();
this.Managed = managed;
}

public TypeKind TypeKind
Expand All @@ -674,15 +677,16 @@ public override string ToString()

public override int GetHashCode()
{
return this.TargetType.GetHashCode();
return this.TargetType.GetHashCode() ^ this.Managed.GetHashCode();
}

public override bool Equals(object obj)
{
var other = obj as PointerType;

var result = other != null &&
this.TargetType.Equals(other.TargetType);
this.TargetType.Equals(other.TargetType) &&
this.Managed.Equals(other.Managed);

return result;
}
Expand Down