Skip to content

Commit

Permalink
feat(jsii): improve locality of warnings emitted for reserved words (#…
Browse files Browse the repository at this point in the history
…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.
  • Loading branch information
RomainMuller authored and mergify[bot] committed Aug 26, 2019
1 parent 04bab47 commit e762da6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/jsii/lib/assembler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,7 @@ export class Assembler implements Emitter {
private _warnAboutReservedWords(symbol: ts.Symbol) {
const reservingLanguages = isReservedName(symbol.name);
if (reservingLanguages) {
this._diagnostic(symbol.valueDeclaration,
this._diagnostic(ts.getNameOfDeclaration(symbol.valueDeclaration) || symbol.valueDeclaration,
ts.DiagnosticCategory.Warning,
`'${symbol.name}' is a reserved word in ${reservingLanguages.join(', ')}. Using this name may cause problems `
+ 'when generating language bindings. Consider using a different name.');
Expand Down

0 comments on commit e762da6

Please sign in to comment.