aggregate the tests in library-tests/TypeScript/ExternalTypes into a single .ql file

This commit is contained in:
Erik Krogh Kristensen
2020-10-14 14:20:01 +02:00
parent 7817ee7611
commit 41b940de69
11 changed files with 54 additions and 58 deletions

View File

@@ -1,4 +0,0 @@
| LegacyGlobals.LegacySubclass | LegacySubclass |
| Modern.ModernClass | ModernClass |
| ModernGlobals.ModernSubclass | ModernSubclass |
| __Legacy.LegacyClass | LegacyClass |

View File

@@ -1,7 +0,0 @@
import javascript
from TypeReference type, string globalName
where
type.hasQualifiedName(globalName) and
not type.hasTypeArguments()
select globalName, type

View File

@@ -1,8 +0,0 @@
| esmodule | Augmentation | Augmentation |
| esmodule | ExternalType1 | ExternalType1 |
| esmodule | ExternalType2 | ExternalType2 |
| esmodule/otherfile | OtherClass | OtherClass |
| esmodule/util | UtilClass | UtilClass |
| esmodule/util/extra | UtilExtraClass | UtilExtraClass |
| legacy | LegacyClass | LegacyClass |
| modern | ModernClass | ModernClass |

View File

@@ -1,7 +0,0 @@
import javascript
from TypeReference type, string moduleName, string exportedName
where
type.hasQualifiedName(moduleName, exportedName) and
not type.hasTypeArguments()
select moduleName, exportedName, type

View File

@@ -1,4 +0,0 @@
| external | ExternalType1 | ExternalType1 |
| external | ExternalType2 | ExternalType2 |
| legacy | MyClass | MyClass |
| modern | MyClass | MyClass |

View File

@@ -1,11 +0,0 @@
| Augmentation | defined in augmentation.ts |
| ExternalType1 | has no definition |
| ExternalType2 | has no definition |
| InternalType | defined in client_esmodule.ts |
| LegacyClass | has no definition |
| LegacySubclass | has no definition |
| ModernClass | has no definition |
| ModernSubclass | has no definition |
| OtherClass | has no definition |
| UtilClass | has no definition |
| UtilExtraClass | has no definition |

View File

@@ -1,11 +0,0 @@
import javascript
string getDefinition(TypeReference ref) {
if exists(ref.getADefinition())
then result = "defined in " + ref.getADefinition().getFile().getBaseName()
else result = "has no definition"
}
from TypeReference type
where not type.hasTypeArguments()
select type, getDefinition(type)

View File

@@ -1 +0,0 @@
| typeof externalSymbol | esmodule | externalSymbol |

View File

@@ -1,5 +0,0 @@
import javascript
from UniqueSymbolType symbol, string moduleName, string exportedName
where symbol.hasQualifiedName(moduleName, exportedName)
select symbol, moduleName, exportedName

View File

@@ -0,0 +1,28 @@
globalQualifiedNames
| LegacyClass | __Legacy.LegacyClass |
| LegacySubclass | LegacyGlobals.LegacySubclass |
| ModernClass | Modern.ModernClass |
| ModernSubclass | ModernGlobals.ModernSubclass |
moduleQualifiedName
| Augmentation | esmodule | Augmentation |
| ExternalType1 | esmodule | ExternalType1 |
| ExternalType2 | esmodule | ExternalType2 |
| LegacyClass | legacy | LegacyClass |
| ModernClass | modern | ModernClass |
| OtherClass | esmodule/otherfile | OtherClass |
| UtilClass | esmodule/util | UtilClass |
| UtilExtraClass | esmodule/util/extra | UtilExtraClass |
types
| Augmentation | defined in augmentation.ts |
| ExternalType1 | has no definition |
| ExternalType2 | has no definition |
| InternalType | defined in client_esmodule.ts |
| LegacyClass | has no definition |
| LegacySubclass | has no definition |
| ModernClass | has no definition |
| ModernSubclass | has no definition |
| OtherClass | has no definition |
| UtilClass | has no definition |
| UtilExtraClass | has no definition |
uniqueSymbols
| typeof externalSymbol | esmodule | externalSymbol |

View File

@@ -0,0 +1,26 @@
import javascript
query predicate globalQualifiedNames(TypeReference type, string globalName) {
type.hasQualifiedName(globalName) and
not type.hasTypeArguments()
}
query predicate moduleQualifiedName(TypeReference type, string moduleName, string exportedName) {
type.hasQualifiedName(moduleName, exportedName) and
not type.hasTypeArguments()
}
string getDefinition(TypeReference ref) {
if exists(ref.getADefinition())
then result = "defined in " + ref.getADefinition().getFile().getBaseName()
else result = "has no definition"
}
query predicate types(TypeReference type, string def) {
not type.hasTypeArguments() and
def = getDefinition(type)
}
query predicate uniqueSymbols(UniqueSymbolType symbol, string moduleName, string exportedName) {
symbol.hasQualifiedName(moduleName, exportedName)
}