diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs index 1716d4a6..964e6ce3 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Onliner/CsOnlinerSourceBuilder.cs @@ -55,9 +55,7 @@ public void CreateFile(IFileSyntax fileSyntax, IxNodeVisitor visitor) AddToSource("using System.Collections.Generic;"); AddToSource("using AXSharp.Connector.Localizations;"); - - foreach (var fileSyntaxUsingDirective in fileSyntax.UsingDirectives - .Where(p => this.Compilation.GetSemanticTree().Namespaces.Select(p => p.FullyQualifiedName).Contains(p.QualifiedIdentifierList.GetText()))) + foreach (var fileSyntaxUsingDirective in fileSyntax.UsingDirectives) { AddToSource($"using {fileSyntaxUsingDirective.QualifiedIdentifierList.GetText()};"); } diff --git a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs index e38cdac0..0ed3172a 100644 --- a/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs +++ b/src/AXSharp.compiler/src/AXSharp.Cs.Compiler/Plain/CsPlainSourceBuilder.cs @@ -180,9 +180,7 @@ public void CreateFile(IFileSyntax fileSyntax, IxNodeVisitor visitor) { AddToSource("using System;"); - foreach (var fileSyntaxUsingDirective in - fileSyntax.UsingDirectives - .Where(p => this.Compilation.GetSemanticTree().Namespaces.Select(p => p.FullyQualifiedName).Contains(p.QualifiedIdentifierList.GetText()))) + foreach (var fileSyntaxUsingDirective in fileSyntax.UsingDirectives) { AddToSource($"using Pocos.{fileSyntaxUsingDirective.QualifiedIdentifierList.GetText()};"); } diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extended_by_known_type.g.cs index e296c211..da3314b6 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extended_by_known_type.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/Onliners/class_extended_by_known_type.g.cs @@ -3,6 +3,8 @@ using AXSharp.Connector.ValueTypes; using System.Collections.Generic; using AXSharp.Connector.Localizations; +using Simatic.Ax.Stateframework; +using Simatic.Ax.StatePattern; namespace Simatic.Ax.StateFramework { diff --git a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/class_extended_by_known_type.g.cs b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/class_extended_by_known_type.g.cs index d0264b84..c2efaa77 100644 --- a/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/class_extended_by_known_type.g.cs +++ b/src/AXSharp.compiler/tests/AXSharp.Compiler.CsTests/samples/units/expected/.g/POCO/class_extended_by_known_type.g.cs @@ -1,4 +1,6 @@ using System; +using Pocos.Simatic.Ax.Stateframework; +using Pocos.Simatic.Ax.StatePattern; namespace Pocos {