Skip to content

Commit 61b3720

Browse files
committed
unified: Support @_exported imports
1 parent 5d7e64e commit 61b3720

3 files changed

Lines changed: 7 additions & 7 deletions

File tree

unified/ql/lib/codeql/unified/internal/NameBindingPluginSwift.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,9 @@ class NameBindingPluginSwift extends NameBindingPlugin {
1818
member = any(TopLevel top).getBody().getAStmt() and
1919
member.hasModifier(["private", "fileprivate"])
2020
or
21-
// Imports are always file-local
22-
member instanceof ImportDeclaration
21+
// Imports are always file-local, except `@_exported` import which re-export everything
22+
member instanceof ImportDeclaration and
23+
not member.hasModifier("@_exported")
2324
//
2425
// Note: Private class members can be seen within type-extensions in the same file,
2526
// so we can't declare those private to their local scope.

unified/ql/lib/codeql/unified/internal/StaticNameBinding.qll

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ predicate valueStep(NameBindingNode node1, NameBindingNode node2) {
212212
|
213213
node2 = getNodeFromUncertainScope(scope)
214214
or
215-
// TODO: Add support for '@_exported' with tests, so this gets exercised
216215
// Bulk re-exporting declarations
217216
exists(TopLevel top |
218217
declaration = top.getBody().getAStmt() and
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import Target3 // re-exports Target2
22

33
private protocol P {
4-
let x1: A; // $ MISSING: access=Target2.A
5-
let x2: B.C; // $ MISSING: access=Target2.B access=Target2.B.C
4+
let x1: A; // $ access=Target2.A
5+
let x2: B.C; // $ access=Target2.B access=Target2.B.C
66
let x3: C; // $ access=Target3.C
77

8-
let x4: Target3.A; // $ MISSING: access=Target2.A
9-
let x5: Target3.B.C; // $ MISSING: access=Target2.B access=Target2.B.C
8+
let x4: Target3.A; // $ access=Target2.A
9+
let x5: Target3.B.C; // $ access=Target2.B access=Target2.B.C
1010
let x6: Target3.C; // $ access=Target3.C
1111
}

0 commit comments

Comments
 (0)