Skip to content

Commit

Permalink
149 bug in some instances class is not correctly extended (#151)
Browse files Browse the repository at this point in the history
* Create draft PR for #149

* [ixc] takes extened type from ExtendedTypeAccess instead of ExtendedType

* updates to stc 4.2.19
implements missing docComment visitor methods

---------

Co-authored-by: PTKu <[email protected]>
  • Loading branch information
PTKu and PTKu authored Apr 12, 2023
1 parent 4cd6431 commit 63b6578
Show file tree
Hide file tree
Showing 21 changed files with 265 additions and 151 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ public virtual void CreateScalarTypeDeclaration(IScalarTypeDeclaration scalarTyp
throw new NotImplementedException();
}


/// <summary>
/// Creates string type declaration.
/// </summary>
Expand All @@ -274,9 +273,16 @@ public virtual void CreateStringTypeDeclaration(IStringTypeDeclaration stringTyp
}

/// <summary>
/// Created array type declaration.
/// Creates array type declaration.
/// </summary>
/// <param name="arrayTypeDeclaration">Array type semantics</param>
/// <param name="visitor">Associated visitor.</param>
void CreateArrayTypeDeclaration(IArrayTypeDeclaration arrayTypeDeclaration, IxNodeVisitor visitor);

/// <summary>
/// Creates documentation for
/// </summary>
/// <param name="docComment">Documentation comment</param>
/// <param name="data">Associated visitor</param>
void CreateDocComment(IDocComment docComment, ICombinedThreeVisitor data);
}
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,11 @@ void ISemanticNodeVisitor<ICombinedThreeVisitor>.Visit(ISemanticTypeAccess seman
data.CreateSemanticTypeAccess(semanticTypeAccess, this);
}

public void Visit(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
data.CreateDocComment(semanticTypeAccess, data);
}

void ISemanticNodeVisitor<ICombinedThreeVisitor>.Visit(ISemanticInstructionList instrList,
ICombinedThreeVisitor data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,15 @@ public static bool IsMemberEligibleForConstructor(this IArrayTypeDeclaration arr
{
return arrayTypeDeclaration.ElementTypeAccess.Type.IsTypeEligibleForTranspile(sourceBuilder);
}

/// <summary>
/// Create triple-slash documentation.
/// </summary>
/// <param name="docComment">Documentation comment</param>
/// <param name="sourceBuilder">Source builder</param>
/// <returns></returns>
public static string AddDocumentationComment(this IDocComment docComment, ISourceBuilder sourceBuilder)
{
return docComment.Content;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -294,4 +294,10 @@ public void AddTypeConstructionParameters(string parametersString)
{
AddToSource(parametersString);
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -220,4 +220,10 @@ public static CsOnlinerMemberBuilder Create(IxNodeVisitor visitor, IConfiguratio
semantics.Variables.ToList().ForEach(p => p.Accept(visitor, builder));
return builder;
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -152,4 +152,10 @@ public static CsOnlinerPlainerOnlineToPlainBuilder Create(IxNodeVisitor visitor,
builder.AddToSource($"}}");
return builder;
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,10 @@ public static CsOnlinerPlainerPlainToOnlineBuilder Create(IxNodeVisitor visitor,
builder.AddToSource($"}}");
return builder;
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -154,5 +154,13 @@ public static CsOnlinerPlainerPlainToShadowBuilder Create(IxNodeVisitor visitor,
builder.AddToSource($"}}");
return builder;
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -151,5 +151,11 @@ public static CsOnlinerPlainerShadowToPlainBuilder Create(IxNodeVisitor visitor,
builder.AddToSource($"}}");
return builder;
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(SourceBuilder));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,10 @@ private void AddToSource(string token, string separator = " ")
{
_sourceBuilder.Append($"{token}{separator}");
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(this));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,12 @@ public void CreateArrayTypeDeclaration(IArrayTypeDeclaration arrayTypeDeclaratio
AddToSource("[]");
}

/// <inheritdoc />
public void CreateDocComment(IDocComment semanticTypeAccess, ICombinedThreeVisitor data)
{
AddToSource(semanticTypeAccess.AddDocumentationComment(this));
}

/// <inheritdoc />
public void CreateStringTypeDeclaration(IStringTypeDeclaration stringTypeDeclaration, IxNodeVisitor visitor)
{
Expand Down
5 changes: 5 additions & 0 deletions src/AXSharp.compiler/src/ixd/Visitors/MyNodeVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,11 @@ public void Visit(ISemanticTypeAccess semanticTypeAccess, IYamlBuiderVisitor dat

}

public void Visit(IDocComment semanticTypeAccess, IYamlBuiderVisitor data)
{
throw new NotImplementedException();
}

public void Visit(ISemanticInstructionList instrList, IYamlBuiderVisitor data)
{

Expand Down
Loading

0 comments on commit 63b6578

Please sign in to comment.