JS: Factor out Unit type

This commit is contained in:
Asger Feldthaus
2021-01-25 13:16:15 +00:00
parent 125d1465c8
commit c1651ad30c
5 changed files with 13 additions and 17 deletions

View File

@@ -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" }
}

View File

@@ -72,7 +72,7 @@ private import javascript
private import internal.FlowSteps
private import internal.AccessPaths
private import internal.CallGraphs
private import internal.Unit
private import semmle.javascript.Unit
private import semmle.javascript.internal.CachedStages
/**

View File

@@ -15,7 +15,7 @@
import javascript
private import semmle.javascript.dataflow.internal.FlowSteps as FlowSteps
private import semmle.javascript.dataflow.internal.Unit
private import semmle.javascript.Unit
private import semmle.javascript.dataflow.InferredTypes
private import semmle.javascript.internal.CachedStages

View File

@@ -4,14 +4,9 @@
*/
private import javascript
private import semmle.javascript.Unit
private import semmle.javascript.internal.CachedStages
private newtype TUnit = MkUnit()
private class Unit extends TUnit {
string toString() { result = "unit" }
}
/**
* Internal extension point for adding flow edges prior to call graph construction
* and type tracking.

View File

@@ -1,9 +0,0 @@
private newtype TUnit = MkUnit()
/**
* A class with only one instance.
*/
class Unit extends TUnit {
/** Gets a textual representation of this element. */
final string toString() { result = "Unit" }
}