Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for es2022 class propertydefinitions and private members -> #2106

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/esprima.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,12 @@

import { CommentHandler } from './comment-handler';
import { JSXParser } from './jsx-parser';
import { Parser } from './parser';
import { Config, Parser } from './parser';
import { Tokenizer } from './tokenizer';

export function parse(code: string, options, delegate) {
export { Config } from './parser';

export function parse(code: string, options?: Config, delegate?) {
let commentHandler: CommentHandler | null = null;
const proxyDelegate = (node, metadata) => {
if (delegate) {
Expand Down Expand Up @@ -79,19 +81,19 @@ export function parse(code: string, options, delegate) {
return ast;
}

export function parseModule(code: string, options, delegate) {
export function parseModule(code: string, options?: Config, delegate?) {
const parsingOptions = options || {};
parsingOptions.sourceType = 'module';
return parse(code, parsingOptions, delegate);
}

export function parseScript(code: string, options, delegate) {
export function parseScript(code: string, options?: Config, delegate?) {
const parsingOptions = options || {};
parsingOptions.sourceType = 'script';
return parse(code, parsingOptions, delegate);
}

export function tokenize(code: string, options, delegate) {
export function tokenize(code: string, options?: Config, delegate?) {
const tokenizer = new Tokenizer(code, options);

const tokens: any = [];
Expand Down