Skip to content
Merged
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
149 changes: 82 additions & 67 deletions src/AXSharp.compiler/src/AXSharp.Compiler/Core/IxNodeVisitor.cs

Large diffs are not rendered by default.

42 changes: 42 additions & 0 deletions src/AXSharp.compiler/src/AXSharp.Compiler/Core/Unit.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
// AXSharp.Compiler
// Copyright (c) 2023 MTS spol. s r.o., and Contributors. All Rights Reserved.
// Contributors: https://github.com/inxton/axsharp/graphs/contributors
// See the LICENSE file in the repository root for more information.
// https://github.com/inxton/axsharp/blob/dev/LICENSE
// Third party licenses: https://github.com/inxton/axsharp/blob/master/notices.md

namespace AXSharp.Compiler.Core;

/// <summary>
/// Represents a void/unit return type for the semantic node visitor pattern.
/// Used as the TResult type parameter when the visitor doesn't need to return a meaningful value.
/// </summary>
public readonly struct Unit : IEquatable<Unit>
{
/// <summary>
/// Gets the single value of the Unit type.
/// </summary>
public static readonly Unit Default = default;

/// <inheritdoc />
public bool Equals(Unit other) => true;

/// <inheritdoc />
public override bool Equals(object? obj) => obj is Unit;

/// <inheritdoc />
public override int GetHashCode() => 0;

/// <inheritdoc />
public override string ToString() => "()";

/// <summary>
/// Determines whether two Unit values are equal (always true).
/// </summary>
public static bool operator ==(Unit left, Unit right) => true;

/// <summary>
/// Determines whether two Unit values are not equal (always false).
/// </summary>
public static bool operator !=(Unit left, Unit right) => false;
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static void SetupAssemblyResolverLegalAcrobatics(string entryAssemblyLoc

AXAssemblies = axAssemblies;

StcVersion = AXAssemblies.FirstOrDefault()?.GetName().Version?.ToString();
StcVersion = AXAssemblies.FirstOrDefault(p => p.GetName().FullName.StartsWith("AX.ST.Semantic"))?.GetName().Version?.ToString();



Expand Down
2 changes: 1 addition & 1 deletion src/AXSharp.compiler/src/ixc/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ private static void DisplayInfo()


Console.ForegroundColor = ConsoleColor.Magenta;
Console.WriteLine($"Using version '> {LegalAcrobatics.StcVersion}' of stc.");
Console.WriteLine($"Using version '{LegalAcrobatics.StcVersion}' of stc.");
Console.ForegroundColor = originalColor;

if (int.Parse(GitVersionInformation.Major) < 1 || string.IsNullOrEmpty(GitVersionInformation.PreReleaseLabel))
Expand Down
6 changes: 3 additions & 3 deletions src/AXSharp.compiler/src/ixd/Helpers/YamlHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ private string GetTextFromXml(XmlNode element, PropertyInfo? prop)
}

//create toc schema, grouped if namespace exists, or only global
public void AddToTocSchema(MyNodeVisitor visitor, TocSchema.Item tocSchemaItem, string? tocGroup)
public void AddToTocSchema(DocNodeVisitor visitor, TocSchema.Item tocSchemaItem, string? tocGroup)
{
if (tocGroup == null || tocGroup == "" || tocGroup == "$GLOBAL")
{
Expand Down Expand Up @@ -255,7 +255,7 @@ public string GetAssembly(string projectFile)
}

//add references of inherited members
public void AddReferences(string[] references, MyNodeVisitor v)
public void AddReferences(string[] references, DocNodeVisitor v)
{
foreach (var member in references)
{
Expand Down Expand Up @@ -300,7 +300,7 @@ public Reference CreateNamespaceReference(IDeclaration declaration)
};
}
//add general reference
public void AddReference(IDeclaration declaration, MyNodeVisitor v)
public void AddReference(IDeclaration declaration, DocNodeVisitor v)
{
if (v.YamlHelper.References.Where(a => a.Uid == Helpers.GetBaseUid(declaration)).Count() > 0)
return;
Expand Down
26 changes: 13 additions & 13 deletions src/AXSharp.compiler/src/ixd/Interfaces/IYamlBuiderVisitor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,91 +19,91 @@ public interface IYamlBuiderVisitor
/// </summary>
/// <param name="fileSyntax">File syntax node.</param>
/// <param name="visitor">Associated visitor.</param>
public virtual void CreateFile(IFileSyntax fileSyntax, MyNodeVisitor visitor)
public virtual void CreateFile(IFileSyntax fileSyntax, DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateNamespaceYaml(
INamespaceDeclaration namespaceDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateClassYaml(
IClassDeclaration classDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateFieldYaml(
IFieldDeclaration fieldDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateMethodYaml(
IMethodDeclaration methodDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateNamedValueTypeYaml(
INamedValueTypeDeclaration namedValueTypeDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateEnumTypeYaml(
IEnumTypeDeclaration enumTypeDeclaration,
MyNodeVisitor myNodeVisitor)
DocNodeVisitor myNodeVisitor)
{
throw new NotImplementedException();
}

void CreateNamedValueYaml(
INamedValueDeclaration namedValueDeclaration,
MyNodeVisitor myNodeVisitor)
DocNodeVisitor myNodeVisitor)
{
throw new NotImplementedException();
}

void CreateEnumValueYaml(
IEnumValueDeclaration enumValueDeclaration,
MyNodeVisitor myNodeVisitor)
DocNodeVisitor myNodeVisitor)
{
throw new NotImplementedException();
}

public virtual void CreateInterfaceYaml(
IInterfaceDeclaration InterfaceDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateMethodPrototypeYaml(
IMethodPrototypeDeclaration methodPrototypeDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

public virtual void CreateFunctionYaml(
IFunctionDeclaration functionDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}

void CreateStructuredTypeYaml(
IStructuredTypeDeclaration structuredTypeDeclaration,
MyNodeVisitor visitor)
DocNodeVisitor visitor)
{
throw new NotImplementedException();
}
Expand Down
2 changes: 1 addition & 1 deletion src/AXSharp.compiler/src/ixd/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ void GenerateYamls(Options o)
var semanticTree = compilation.Compilation.GetSemanticTree();

//visit
var myNodeVisitor = new MyNodeVisitor();
var myNodeVisitor = new DocNodeVisitor();
var yamlSerializer = new YamlSerializer(o);
var treeWalker = new YamlBuilder(yamlSerializer);

Expand Down
Loading