Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[c#] support for global using directives in CSharpProgramSummary #5187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
update typesInScope instead of findGlobalTypes
  • Loading branch information
xavierpinho committed Dec 17, 2024
commit 3e016b44c995c91a2394b12f831a6a86f79ebf2c
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@ type NamespaceToTypeMap = mutable.Map[String, mutable.Set[CSharpType]]
case class CSharpProgramSummary(namespaceToType: NamespaceToTypeMap, imports: Set[String], globalImports: Set[String])
extends ProgramSummary[CSharpType, CSharpMethod, CSharpField] {

def findGlobalTypes: Set[CSharpType] =
(globalImports ++ Set(Constants.Global)).flatMap(namespaceToType.getOrElse(_, Set.empty))
def findGlobalTypes: Set[CSharpType] = namespaceToType.getOrElse(Constants.Global, Set.empty).toSet

@targetName("appendAll")
def ++=(other: CSharpProgramSummary): CSharpProgramSummary = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class CSharpScope(summary: CSharpProgramSummary)
with TypedScope[CSharpMethod, CSharpField, CSharpType](summary)
with OverloadableScope[CSharpMethod] {

override val typesInScope: mutable.Set[CSharpType] = mutable.Set.empty[CSharpType].addAll(summary.findGlobalTypes)
override val typesInScope: mutable.Set[CSharpType] = mutable.Set
.empty[CSharpType]
.addAll(summary.findGlobalTypes)
.addAll(summary.globalImports.flatMap(summary.namespaceToType.getOrElse(_, Set.empty)))

/** @return
* the surrounding type declaration if one exists.
Expand Down
Loading