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

refactor(traverse): use camel case props internally #3880

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions crates/oxc_traverse/scripts/lib/parse.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {readFile} from 'fs/promises';
import {join as pathJoin} from 'path';
import {fileURLToPath} from 'url';
import assert from 'assert';
import {typeAndWrappers} from './utils.mjs';
import {typeAndWrappers, snakeToCamel} from './utils.mjs';

const FILENAMES = ['js.rs', 'jsx.rs', 'literal.rs', 'ts.rs'];

Expand Down Expand Up @@ -145,7 +145,8 @@ function parseScopeArgs(argsStr, filename, lineIndex) {
}
assert(bracketCount === 0);

args[key] = argsStr.slice(0, index).trim();
const camelKey = key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
args[camelKey] = argsStr.slice(0, index).trim();
argsStr = argsStr.slice(index + 1);
if (argsStr === '') break;

Expand Down
2 changes: 1 addition & 1 deletion crates/oxc_traverse/scripts/lib/walk.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function generateWalkForStruct(type, types) {
let scopeEnterField, enterScopeCode = '', exitScopeCode = '';
if (scopeArgs && scopeIdField) {
// Get field to enter scope before
const enterFieldName = scopeArgs.enter_scope_before;
const enterFieldName = scopeArgs.enterScopeBefore;
if (enterFieldName) {
scopeEnterField = visitedFields.find(field => field.name === enterFieldName);
assert(
Expand Down
Loading