Skip to content

Commit

Permalink
Filter libraries where name match with the module name
Browse files Browse the repository at this point in the history
  • Loading branch information
fjtrujy committed May 9, 2020
1 parent 5de13b9 commit 88e83c4
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions Sources/orbis-parser/OrbisLibrary.swift
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ struct OrbisLibrary: Codable {
let is_export: Bool
let symbols: [OrbisSymbol]

var assembly: String { symbols.reduce("") { is_export ? $0 + $1.assembly : $0 }}
}
var assembly: String { is_export ? symbols.reduce("") { $0 + $1.assembly } : "" }
}
8 changes: 5 additions & 3 deletions Sources/orbis-parser/OrbisModule.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,13 @@ struct OrbisModule: Codable {
let libraries: [OrbisLibrary]

var assembly: String {
libraries.reduce("") { $1.is_export ? """
libraries.reduce("") {
guard name == $1.name else { return $0 }
return """
\($0)
.section .orbis.fstubs.\(name).\(version_major).\(version_minor).\($1.name).\($1.version),\"ax\",%progbits
\($1.assembly)
""".trimmingCharacters(in: .whitespaces) : $0
""".trimmingCharacters(in: .whitespaces)
}
}
}
}

0 comments on commit 88e83c4

Please sign in to comment.