Skip to content

Commit

Permalink
refactor(main.ts): Make parseScript static
Browse files Browse the repository at this point in the history
  • Loading branch information
LuanRT committed Jul 31, 2024
1 parent 3f81b80 commit 235d267
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,6 @@ export default class Jinter {
});
}

/**
* Generates an AST from the input.
*/
public parseScript(input: string) {
try {
return parse(input, { ecmaVersion: 2020 });
} catch (e: any) {
throw new JinterError(e.message);
}
}

/**
* Evaluates the program.
* @returns The result of the last statement in the program.
Expand All @@ -72,4 +61,15 @@ export default class Jinter {

return this.visitor.run();
}

/**
* Generates an AST from the input.
*/
public static parseScript(input: string) {
try {
return parse(input, { ecmaVersion: 2020 });
} catch (e: any) {
throw new JinterError(e.message);
}
}
}

0 comments on commit 235d267

Please sign in to comment.