Skip to content

Commit

Permalink
fix(parser): changed name on options to be Acorn compat
Browse files Browse the repository at this point in the history
  • Loading branch information
KFlash committed Jun 28, 2019
1 parent e2d78cc commit 43b0029
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const enum Context {
OptionsJSX = 1 << 4,
OptionsGlobalReturn = 1 << 5,
OptionsLexical = 1 << 6,
OptionsParenthesized = 1 << 7,
OptionsPreserveParens = 1 << 7,
OptionsWebCompat = 1 << 8,
OptionsRaw = 1 << 9,
Strict = 1 << 10,
Expand All @@ -35,7 +35,7 @@ export const enum Context {
InMethod = 1 << 25,
AllowNewTarget = 1 << 26,
DisallowIn = 1 << 27,
InClass = 1 << 28
InClass = 1 << 28,
}

export const enum PropertyKind {
Expand Down
6 changes: 3 additions & 3 deletions src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ export interface Options {
// The flag to enable implied strict mode
impliedStrict?: boolean;
// Enable non-standard parenthesized expression node
parenthesizedExpr?: boolean;
preserveParens?: boolean;
// Enable lexical binding and scope tracking
lexical?: boolean;
// Adds a source attribute in every node’s loc object when the locations option is `true`
Expand All @@ -206,7 +206,7 @@ export function parseSource(source: string, options: Options | void, context: Co
if (options.directives) context |= Context.OptionsDirectives | Context.OptionsRaw;
if (options.globalReturn) context |= Context.OptionsGlobalReturn;
if (options.raw) context |= Context.OptionsRaw;
if (options.parenthesizedExpr) context |= Context.OptionsParenthesized;
if (options.preserveParens) context |= Context.OptionsPreserveParens;
if (options.impliedStrict) context |= Context.Strict;
if (options.source) sourceFile = options.source;
}
Expand Down Expand Up @@ -6419,7 +6419,7 @@ export function parseParenthesizedExpression(

parser.destructible = ((parser.destructible | DestructuringKind.Yield) ^ DestructuringKind.Yield) | destructible;

return context & Context.OptionsParenthesized
return context & Context.OptionsPreserveParens
? finishNode(parser, context, idxStart, lineStart, columnStart, {
type: 'ParenthesizedExpression',
expression: expr
Expand Down
2 changes: 1 addition & 1 deletion test/parser/miscellaneous/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('Expressions - API', () => {
ranges: true,
webCompat: true,
module: true,
parenthesizedExpr: true,
preserveParens: true,
lexical: true,
source: 'bullshit'
}),
Expand Down

0 comments on commit 43b0029

Please sign in to comment.