JS: make TypeAnnotation extend Locatable

This commit is contained in:
Asger F
2019-04-16 17:53:36 +01:00
parent c44f99a204
commit cf8c327a10
3 changed files with 17 additions and 20 deletions

View File

@@ -7,10 +7,7 @@ import javascript
/**
* A type annotation, either in the form of a TypeScript type or a JSDoc comment.
*/
class TypeAnnotation extends @type_annotation {
/** Gets a string representation of this type. */
string toString() { none() }
class TypeAnnotation extends @type_annotation, Locatable {
/** Holds if this is the `any` type. */
predicate isAny() { none() }

View File

@@ -1,21 +1,21 @@
test_isString
| string |
| file://:0:0:0:0 | string |
test_isNumber
| number |
| file://:0:0:0:0 | number |
test_QualifiedName
| VarType | VarType |
| boolean | boolean |
| foo.bar.baz | foo.bar.baz |
| number | number |
| string | string |
| VarType | file://:0:0:0:0 | VarType |
| boolean | file://:0:0:0:0 | boolean |
| foo.bar.baz | file://:0:0:0:0 | foo.bar.baz |
| number | file://:0:0:0:0 | number |
| string | file://:0:0:0:0 | string |
test_ParameterType
| tst.js:7:12:7:12 | x | string |
| tst.js:7:15:7:15 | y | number? |
| tst.js:7:18:7:18 | z | foo.bar.baz |
| tst.js:7:12:7:12 | x | file://:0:0:0:0 | string |
| tst.js:7:15:7:15 | y | file://:0:0:0:0 | number? |
| tst.js:7:18:7:18 | z | file://:0:0:0:0 | foo.bar.baz |
test_VarType
| tst.js:7:12:7:12 | x | string |
| tst.js:7:15:7:15 | y | number? |
| tst.js:7:18:7:18 | z | foo.bar.baz |
| tst.js:11:7:11:7 | w | VarType |
| tst.js:7:12:7:12 | x | file://:0:0:0:0 | string |
| tst.js:7:15:7:15 | y | file://:0:0:0:0 | number? |
| tst.js:7:18:7:18 | z | file://:0:0:0:0 | foo.bar.baz |
| tst.js:11:7:11:7 | w | file://:0:0:0:0 | VarType |
test_ReturnType
| tst.js:7:1:12:1 | functio ... null;\\n} | boolean |
| tst.js:7:1:12:1 | functio ... null;\\n} | file://:0:0:0:0 | boolean |

View File

@@ -1 +1 @@
| ResolvedType | resolved | ResolvedType |
| tst.ts:5:8:5:19 | ResolvedType | resolved | ResolvedType |