mirror of
https://github.com/github/codeql.git
synced 2026-04-21 15:05:56 +02:00
Merge pull request #15095 from hvitved/dataflow/boolean-class
Data flow: Use `Boolean` class
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
|
||||
private import codeql.util.Unit
|
||||
private import codeql.util.Option
|
||||
private import codeql.util.Boolean
|
||||
private import codeql.dataflow.DataFlow
|
||||
|
||||
module MakeImpl<InputSig Lang> {
|
||||
@@ -1183,7 +1184,9 @@ module MakeImpl<InputSig Lang> {
|
||||
string toString();
|
||||
}
|
||||
|
||||
class Ap;
|
||||
class Ap {
|
||||
string toString();
|
||||
}
|
||||
|
||||
class ApNil extends Ap;
|
||||
|
||||
@@ -2432,9 +2435,7 @@ module MakeImpl<InputSig Lang> {
|
||||
|
||||
class Typ = Unit;
|
||||
|
||||
class Ap extends boolean {
|
||||
Ap() { this in [true, false] }
|
||||
}
|
||||
class Ap = Boolean;
|
||||
|
||||
class ApNil extends Ap {
|
||||
ApNil() { this = false }
|
||||
|
||||
@@ -5,6 +5,12 @@
|
||||
*
|
||||
* As opposed to `boolean`, this type does not require explicit binding.
|
||||
*/
|
||||
class Boolean extends boolean {
|
||||
final class Boolean extends FinalBoolean {
|
||||
Boolean() { this = [true, false] }
|
||||
|
||||
/** Returns either "true" or "false". */
|
||||
// reimplement to avoid explicit binding
|
||||
string toString() { result = super.toString() }
|
||||
}
|
||||
|
||||
final private class FinalBoolean = boolean;
|
||||
|
||||
Reference in New Issue
Block a user