Skip to content

Commit

Permalink
Merge pull request #11096 from atorralba/atorralba/swift/unit
Browse files Browse the repository at this point in the history
Swift: Move the Unit class to its own file
  • Loading branch information
atorralba committed Nov 3, 2022
2 parents 44b0f19 + 978ed03 commit 83caf01
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
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

0 comments on commit 83caf01

Please sign in to comment.