Skip to content

Commit e762da6

Browse files
RomainMullermergify[bot]
authored andcommitted
feat(jsii): improve locality of warnings emitted for reserved words (#739)
Instead of tagging the entire declaration, only tag the name part of it when emitting warnings about usage of reserved words from one of the supported languages. This improves the actionability of the messages, and makes for shorter log entries, too.
1 parent 04bab47 commit e762da6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/jsii/lib/assembler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1018,7 +1018,7 @@ export class Assembler implements Emitter {
10181018
private _warnAboutReservedWords(symbol: ts.Symbol) {
10191019
const reservingLanguages = isReservedName(symbol.name);
10201020
if (reservingLanguages) {
1021-
this._diagnostic(symbol.valueDeclaration,
1021+
this._diagnostic(ts.getNameOfDeclaration(symbol.valueDeclaration) || symbol.valueDeclaration,
10221022
ts.DiagnosticCategory.Warning,
10231023
`'${symbol.name}' is a reserved word in ${reservingLanguages.join(', ')}. Using this name may cause problems `
10241024
+ 'when generating language bindings. Consider using a different name.');

0 commit comments

Comments
 (0)