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
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
<ProjectReference Include="..\Appegy.Union.Generator\Appegy.Union.Generator.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>

<ItemGroup>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=shapes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=attributes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=shapes_005Cattributes/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=shapes_005Cvariants/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Appegy.Union
{
[AttributeUsage(AttributeTargets.Struct | AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class ExposeAttribute : Attribute
{
public Type[] Interfaces { get; }

public ExposeAttribute(params Type[] interfaces)
{
Interfaces = interfaces;
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Appegy.Union
{
[AttributeUsage(System.AttributeTargets.Struct | AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
public class UnionAttribute : System.Attribute
{
public System.Type[] Types { get; }

public UnionAttribute(params System.Type[] types)
{
Types = types;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

public static class AttributesNames
{
public static readonly string GeneratedCodeAttribute = $@"[global::System.CodeDom.Compiler.GeneratedCodeAttribute(""Appegy.Union"", ""{typeof(AttributesNames).Assembly.GetName().Version}"")]";
public const string UnionAttributeName = "Appegy.Union.UnionAttribute";
public const string ExposeAttributeName = "Appegy.Union.ExposeAttribute";
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using static Appegy.Union.Generator.AttributesSource;
using static Appegy.Union.Generator.AttributesNames;

namespace Appegy.Union.Generator;
Expand All @@ -33,8 +32,6 @@ public class ExposeAttributeGenerator : IIncrementalGenerator

public void Initialize(IncrementalGeneratorInitializationContext context)
{
context.RegisterPostInitializationOutput(c => c.AddSource("ExposeAttribute.g.cs", ExposeAttribute));

var exposeSources = context
.SyntaxProvider
.ForAttributeWithMetadataName(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ public override void Generate(IndentedTextWriter codeWriter, UnionAttributePartI
{
var (syntax, types) = input;

codeWriter.WriteLine(AttributesSource.GeneratedCodeAttribute);
codeWriter.WriteLine(AttributesNames.GeneratedCodeAttribute);
codeWriter.WriteLine("[global::System.Runtime.InteropServices.StructLayout(global::System.Runtime.InteropServices.LayoutKind.Explicit, Pack = 1)]");
codeWriter.Write("partial struct ");
codeWriter.WriteLine(syntax.Identifier.Text);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using Microsoft.CodeAnalysis.CSharp;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.Text;
using static Appegy.Union.Generator.AttributesSource;
using static Appegy.Union.Generator.AttributesNames;

namespace Appegy.Union.Generator;
Expand Down Expand Up @@ -37,8 +36,6 @@ public class UnionAttributeGenerator : IIncrementalGenerator

public void Initialize(IncrementalGeneratorInitializationContext context)
{
context.RegisterPostInitializationOutput(c => c.AddSource("UnionAttribute.g.cs", UnionAttribute));

var sources = context
.SyntaxProvider
.ForAttributeWithMetadataName(
Expand Down
4 changes: 2 additions & 2 deletions Runtime/Appegy.Union.Generator.dll
Git LFS file not shown
Binary file modified Runtime/Appegy.Union.Generator.pdb
Binary file not shown.
14 changes: 14 additions & 0 deletions Runtime/Appegy.Union.asmdef
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"name": "Appegy.Union",
"rootNamespace": "Appegy.Union",
"references": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [],
"noEngineReferences": false
}
3 changes: 3 additions & 0 deletions Runtime/Appegy.Union.asmdef.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Runtime/ExposeAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Appegy.Union
{
[AttributeUsage(AttributeTargets.Struct)]
public class ExposeAttribute : Attribute
{
public Type[] Interfaces { get; }

public ExposeAttribute(params Type[] interfaces)
{
Interfaces = interfaces;
}
}
}
3 changes: 3 additions & 0 deletions Runtime/ExposeAttribute.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions Runtime/UnionAttribute.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
using System;

namespace Appegy.Union
{
[AttributeUsage(AttributeTargets.Struct)]
public class UnionAttribute : Attribute
{
public Type[] Types { get; }

public UnionAttribute(params Type[] types)
{
Types = types;
}
}
}
3 changes: 3 additions & 0 deletions Runtime/UnionAttribute.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.