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

Swift: Move the Unit class to its own file #11096

Merged
merged 1 commit into from
Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
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
Move the Unit class to its own file
  • Loading branch information
atorralba committed Nov 3, 2022
commit 978ed03e9c07927137e6a339d90fe3e82a78d0b2
10 changes: 10 additions & 0 deletions swift/ql/lib/codeql/swift/Unit.qll
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/** Provides the `Unit` class. */

/** The unit type. */
private newtype TUnit = TMkUnit()

/** The trivial type with a single element. */
class Unit extends TUnit {
/** Gets a textual representation of this element. */
string toString() { result = "unit" }
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/**
* Provides Swift-specific definitions for use in the data flow library.
*/

// we need to export `Unit` for the DataFlowImpl* files
private import swift as Swift

module Private {
import DataFlowPrivate
import DataFlowDispatch

class Unit = Swift::Unit;
}

module Public {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,15 +603,6 @@ int accessPathLimit() { result = 5 }
*/
predicate forceHighPrecision(Content c) { none() }

/** The unit type. */
private newtype TUnit = TMkUnit()

/** The trivial type with a single element. */
class Unit extends TUnit {
/** Gets a textual representation of this element. */
string toString() { result = "unit" }
}

/**
* Holds if the node `n` is unreachable when the call context is `call`.
*/
Expand Down
1 change: 1 addition & 0 deletions swift/ql/lib/swift.qll
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import codeql.swift.elements.expr.ArithmeticOperation
import codeql.swift.elements.expr.LogicalOperation
import codeql.swift.elements.decl.MethodDecl
import codeql.swift.elements.decl.ClassOrStructDecl
import codeql.swift.Unit