Skip to content

Commit

Permalink
Only add Go builtins to Go code
Browse files Browse the repository at this point in the history
  • Loading branch information
oxisto committed Sep 8, 2023
1 parent aee2b52 commit b11312d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ class GoExtraPass(ctx: TranslationContext) : ComponentPass(ctx), ScopeProvider {
get() = scopeManager.currentScope

override fun accept(component: Component) {
// Add built-int functions
component.translationUnits += addBuiltIn()
// Add built-int functions, but only if one of the components contains a GoLanguage
if (component.translationUnits.any { it.language is GoLanguage }) {
component.translationUnits += addBuiltIn()
}

val walker = SubgraphWalker.ScopedWalker(scopeManager)
walker.registerHandler { _, parent, node ->
Expand Down

0 comments on commit b11312d

Please sign in to comment.