Skip to content

Commit cbabfb4

Browse files
committed
<AssemblyAttribute>
emitted as `[assembly:]` attribute, not module
1 parent 7699c78 commit cbabfb4

File tree

3 files changed

+13
-12
lines changed

3 files changed

+13
-12
lines changed

src/Peachpie.CodeAnalysis/Emitter/Model/PEModuleBuilder.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
using Pchp.CodeAnalysis.Emitter;
1919
using Pchp.CodeAnalysis.Utilities;
2020
using Pchp.CodeAnalysis.CodeGen;
21+
using Pchp.CodeAnalysis.Semantics;
2122

2223
namespace Pchp.CodeAnalysis.Emit
2324
{
@@ -222,6 +223,17 @@ public ArrayMethods ArrayMethods
222223
}
223224
}
224225

226+
// [assembly: ...]
227+
if (Compilation.Options.AssemblyAttributes != null)
228+
{
229+
var binder = new SemanticsBinder(Compilation, file: null);
230+
231+
foreach (var attr in Compilation.Options.AssemblyAttributes)
232+
{
233+
yield return binder.BindAttribute(attr);
234+
}
235+
}
236+
225237
//
226238
yield break;
227239
}

src/Peachpie.CodeAnalysis/Semantics/SemanticsBinder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ public ImmutableArray<AttributeData> BindAttributes(IReadOnlyList<AST.IAttribute
328328
return attrs.ToImmutableArray();
329329
}
330330

331-
public AttributeData BindAttribute(AST.IAttributeElement a)
331+
public SourceCustomAttribute BindAttribute(AST.IAttributeElement a)
332332
{
333333
return new SourceCustomAttribute(
334334
DeclaringCompilation,

src/Peachpie.CodeAnalysis/Symbols/Source/SourceModuleSymbol.cs

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -164,17 +164,6 @@ IEnumerable<AttributeData> CreateAttributesToEmit()
164164
}
165165
}
166166

167-
// user assembly attributes
168-
if (DeclaringCompilation.Options.AssemblyAttributes != null)
169-
{
170-
var binder = new SemanticsBinder(DeclaringCompilation, file: null);
171-
172-
foreach (var attr in DeclaringCompilation.Options.AssemblyAttributes)
173-
{
174-
yield return binder.BindAttribute(attr);
175-
}
176-
}
177-
178167
//
179168
yield break;
180169
}

0 commit comments

Comments
 (0)