mirror of
https://github.com/danbulant/oxc
synced 2026-05-24 12:21:58 +00:00
refactor(traverse): use camel case props internally (#3880)
Small change to internals of `oxc_traverse` codegen. Use camel-case property names.
This commit is contained in:
parent
2045c92338
commit
24979c98b2
2 changed files with 4 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ import {readFile} from 'fs/promises';
|
||||||
import {join as pathJoin} from 'path';
|
import {join as pathJoin} from 'path';
|
||||||
import {fileURLToPath} from 'url';
|
import {fileURLToPath} from 'url';
|
||||||
import assert from 'assert';
|
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'];
|
const FILENAMES = ['js.rs', 'jsx.rs', 'literal.rs', 'ts.rs'];
|
||||||
|
|
||||||
|
|
@ -145,7 +145,8 @@ function parseScopeArgs(argsStr, filename, lineIndex) {
|
||||||
}
|
}
|
||||||
assert(bracketCount === 0);
|
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);
|
argsStr = argsStr.slice(index + 1);
|
||||||
if (argsStr === '') break;
|
if (argsStr === '') break;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -61,7 +61,7 @@ function generateWalkForStruct(type, types) {
|
||||||
let scopeEnterField, enterScopeCode = '', exitScopeCode = '';
|
let scopeEnterField, enterScopeCode = '', exitScopeCode = '';
|
||||||
if (scopeArgs && scopeIdField) {
|
if (scopeArgs && scopeIdField) {
|
||||||
// Get field to enter scope before
|
// Get field to enter scope before
|
||||||
const enterFieldName = scopeArgs.enter_scope_before;
|
const enterFieldName = scopeArgs.enterScopeBefore;
|
||||||
if (enterFieldName) {
|
if (enterFieldName) {
|
||||||
scopeEnterField = visitedFields.find(field => field.name === enterFieldName);
|
scopeEnterField = visitedFields.find(field => field.name === enterFieldName);
|
||||||
assert(
|
assert(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue