Skip to content

Commit

Permalink
<AssemblyAttribute>
Browse files Browse the repository at this point in the history
emitted as `[assembly:]` attribute, not module
  • Loading branch information
jakubmisek committed Apr 22, 2024
1 parent 7699c78 commit cbabfb4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
12 changes: 12 additions & 0 deletions src/Peachpie.CodeAnalysis/Emitter/Model/PEModuleBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
using Pchp.CodeAnalysis.Emitter;
using Pchp.CodeAnalysis.Utilities;
using Pchp.CodeAnalysis.CodeGen;
using Pchp.CodeAnalysis.Semantics;

namespace Pchp.CodeAnalysis.Emit
{
Expand Down Expand Up @@ -222,6 +223,17 @@ public ArrayMethods ArrayMethods
}
}

// [assembly: ...]
if (Compilation.Options.AssemblyAttributes != null)
{
var binder = new SemanticsBinder(Compilation, file: null);

foreach (var attr in Compilation.Options.AssemblyAttributes)
{
yield return binder.BindAttribute(attr);
}
}

//
yield break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ public ImmutableArray<AttributeData> BindAttributes(IReadOnlyList<AST.IAttribute
return attrs.ToImmutableArray();
}

public AttributeData BindAttribute(AST.IAttributeElement a)
public SourceCustomAttribute BindAttribute(AST.IAttributeElement a)
{
return new SourceCustomAttribute(
DeclaringCompilation,
Expand Down
11 changes: 0 additions & 11 deletions src/Peachpie.CodeAnalysis/Symbols/Source/SourceModuleSymbol.cs
Original file line number Diff line number Diff line change
Expand Up @@ -164,17 +164,6 @@ IEnumerable<AttributeData> CreateAttributesToEmit()
}
}

// user assembly attributes
if (DeclaringCompilation.Options.AssemblyAttributes != null)
{
var binder = new SemanticsBinder(DeclaringCompilation, file: null);

foreach (var attr in DeclaringCompilation.Options.AssemblyAttributes)
{
yield return binder.BindAttribute(attr);
}
}

//
yield break;
}
Expand Down

0 comments on commit cbabfb4

Please sign in to comment.