MCPcopy
hub / github.com/jquery/esprima / validateParam

Method validateParam

src/parser.ts:2752–2782  ·  view source on GitHub ↗
(options, param, name)

Source from the content-addressed store, hash-verified

2750 }
2751
2752 validateParam(options, param, name) {
2753 const key = '$' + name;
2754 if (this.context.strict) {
2755 if (this.scanner.isRestrictedWord(name)) {
2756 options.stricted = param;
2757 options.message = Messages.StrictParamName;
2758 }
2759 if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
2760 options.stricted = param;
2761 options.message = Messages.StrictParamDupe;
2762 }
2763 } else if (!options.firstRestricted) {
2764 if (this.scanner.isRestrictedWord(name)) {
2765 options.firstRestricted = param;
2766 options.message = Messages.StrictParamName;
2767 } else if (this.scanner.isStrictModeReservedWord(name)) {
2768 options.firstRestricted = param;
2769 options.message = Messages.StrictReservedWord;
2770 } else if (Object.prototype.hasOwnProperty.call(options.paramSet, key)) {
2771 options.stricted = param;
2772 options.message = Messages.StrictParamDupe;
2773 }
2774 }
2775
2776 /* istanbul ignore next */
2777 if (typeof Object.defineProperty === 'function') {
2778 Object.defineProperty(options.paramSet, key, { value: true, enumerable: true, writable: true, configurable: true });
2779 } else {
2780 options.paramSet[key] = true;
2781 }
2782 }
2783
2784 parseRestElement(params): Node.RestElement {
2785 const node = this.createNode();

Callers 2

checkPatternParamMethod · 0.95
parseFormalParameterMethod · 0.95

Calls 2

isRestrictedWordMethod · 0.80

Tested by

no test coverage detected