mirror of
https://gitee.com/openharmony/third_party_typescript
synced 2025-02-22 21:23:00 +00:00
parent
10f306350b
commit
607c9c5e26
@ -197,6 +197,7 @@ namespace ts {
|
||||
"|=": SyntaxKind.BarEqualsToken,
|
||||
"^=": SyntaxKind.CaretEqualsToken,
|
||||
"@": SyntaxKind.AtToken,
|
||||
"`": SyntaxKind.BacktickToken
|
||||
});
|
||||
|
||||
/*
|
||||
@ -298,7 +299,6 @@ namespace ts {
|
||||
}
|
||||
|
||||
const tokenStrings = makeReverseMap(textToToken);
|
||||
|
||||
export function tokenToString(t: SyntaxKind): string | undefined {
|
||||
return tokenStrings[t];
|
||||
}
|
||||
|
@ -31,3 +31,18 @@ describe("Public APIs", () => {
|
||||
verifyApi("tsserverlibrary.d.ts");
|
||||
});
|
||||
});
|
||||
|
||||
describe("Public APIs:: token to string", () => {
|
||||
function assertDefinedTokenToString(initial: ts.SyntaxKind, last: ts.SyntaxKind) {
|
||||
for (let t = initial; t <= last; t++) {
|
||||
assert.isDefined(ts.tokenToString(t), `Expected tokenToString defined for ${ts.Debug.formatSyntaxKind(t)}`);
|
||||
}
|
||||
}
|
||||
|
||||
it("for punctuations", () => {
|
||||
assertDefinedTokenToString(ts.SyntaxKind.FirstPunctuation, ts.SyntaxKind.LastPunctuation);
|
||||
});
|
||||
it("for keywords", () => {
|
||||
assertDefinedTokenToString(ts.SyntaxKind.FirstKeyword, ts.SyntaxKind.LastKeyword);
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,20 @@
|
||||
//// [jsdocParameterParsingInvalidName.ts]
|
||||
class c {
|
||||
/**
|
||||
* @param {string} [`foo]
|
||||
*/
|
||||
method(foo) {
|
||||
}
|
||||
}
|
||||
|
||||
//// [jsdocParameterParsingInvalidName.js]
|
||||
var c = /** @class */ (function () {
|
||||
function c() {
|
||||
}
|
||||
/**
|
||||
* @param {string} [`foo]
|
||||
*/
|
||||
c.prototype.method = function (foo) {
|
||||
};
|
||||
return c;
|
||||
}());
|
@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/jsdocParameterParsingInvalidName.ts ===
|
||||
class c {
|
||||
>c : Symbol(c, Decl(jsdocParameterParsingInvalidName.ts, 0, 0))
|
||||
|
||||
/**
|
||||
* @param {string} [`foo]
|
||||
*/
|
||||
method(foo) {
|
||||
>method : Symbol(c.method, Decl(jsdocParameterParsingInvalidName.ts, 0, 9))
|
||||
>foo : Symbol(foo, Decl(jsdocParameterParsingInvalidName.ts, 4, 11))
|
||||
}
|
||||
}
|
@ -0,0 +1,12 @@
|
||||
=== tests/cases/compiler/jsdocParameterParsingInvalidName.ts ===
|
||||
class c {
|
||||
>c : c
|
||||
|
||||
/**
|
||||
* @param {string} [`foo]
|
||||
*/
|
||||
method(foo) {
|
||||
>method : (foo: any) => void
|
||||
>foo : any
|
||||
}
|
||||
}
|
7
tests/cases/compiler/jsdocParameterParsingInvalidName.ts
Normal file
7
tests/cases/compiler/jsdocParameterParsingInvalidName.ts
Normal file
@ -0,0 +1,7 @@
|
||||
class c {
|
||||
/**
|
||||
* @param {string} [`foo]
|
||||
*/
|
||||
method(foo) {
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user