Repository navigation
Conversation
Per https://webidl.spec.whatwg.org/#idl-names, the reserved identifier rule exempts operation arguments, but the tokeniser rejected reserved names before the parser could know the syntactic position. The check now runs after parsing: reserved tokens used as argument names are exempt, every other use still throws the same parse error. Fixes w3c#785
Attribute, constant, enum, dictionary field, namespace and typedef names must still reject reserved identifiers.
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Per https://webidl.spec.whatwg.org/#idl-names, the reserved identifier rule (
constructor,toString, leading_) exempts operation arguments, but the check ran insidetokenise()— before the parser could know the syntactic position — soundefined foo(unsigned long toString);was wrongly rejected.The check now runs after parsing in
parseByTokens(): argument name tokens are exempt, every other use still throws the same parse-time error. Regenerated invalid baselines only gained the source name and full source line in the error context (same caret, same message).Covered by a new syntax test (
argument-reserved-name.webidl:toString,_toString,_constructoras argument names in an interface operation and a callback); existing invalid tests for operation/typedef names still pass.npm test(eslint + tsc + webpack + mocha): 297 passing.Fixes #785