-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
closes #32; fix missing diagnostic for duplicate qualifiers
- Loading branch information
Showing
3 changed files
with
36 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -363,6 +363,18 @@ export class Explainer { | |
} | ||
} | ||
|
||
/** | ||
Check failure on line 366 in js/prose-decl.js GitHub Actions / build (16.x)
Check failure on line 366 in js/prose-decl.js GitHub Actions / build (18.x)
|
||
* Checks whether there are duplicate qualifiers in the given list | ||
* @param {string[]} qualifiers | ||
Check failure on line 368 in js/prose-decl.js GitHub Actions / build (16.x)
|
||
* @param {'function' | 'pointer'} context | ||
Check failure on line 369 in js/prose-decl.js GitHub Actions / build (16.x)
|
||
*/ | ||
checkForDuplicateQualifiers(qualifiers, context) { | ||
const withoutDuplicates = new Set(qualifiers.map(q => q === '_Atomic' ? 'atomic' : q)) | ||
Check failure on line 372 in js/prose-decl.js GitHub Actions / build (16.x)
|
||
if (withoutDuplicates.size !== qualifiers.length) { | ||
this.showDiagnostic(`duplicate-${context}-qualifier`); | ||
} | ||
} | ||
|
||
/** | ||
* Throws if there is misuse of specifiers in the declaration specifier | ||
* sequence, depending on the provided kind of context. | ||
|
@@ -508,6 +520,7 @@ export class Explainer { | |
break; | ||
} | ||
case '*': { | ||
this.checkForDuplicateQualifiers(d.qualifiers, 'pointer'); | ||
const q = d.qualifiers | ||
.sort(Explainer.compareSpecifiers) | ||
.map(Explainer.remapSpecifierTextForReadability) | ||
|
@@ -598,6 +611,7 @@ export class Explainer { | |
this.showDiagnostic('empty-function-parameters'); | ||
} | ||
|
||
this.checkForDuplicateQualifiers(d.qualifiers, 'function'); | ||
let overrideFinal = d.qualifiers[d.qualifiers.length - 1]; | ||
if (!['override', 'final'].includes(overrideFinal)) { | ||
overrideFinal = undefined; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters