refactor: remove WHAT-comments, keep WHY and RFC references
This commit is contained in:
@@ -29,7 +29,6 @@ export function parseAstLog(text) {
|
||||
|
||||
const node = { slot, parentSlot, depth, positionals, props, children: [] };
|
||||
|
||||
// Pop stack to find correct parent (parent must have depth < current)
|
||||
while (stack.length > 1 && stack[stack.length - 1].depth >= depth) {
|
||||
stack.pop();
|
||||
}
|
||||
@@ -54,18 +53,15 @@ function _parseRest(rest) {
|
||||
let inProps = false;
|
||||
|
||||
while (i < n) {
|
||||
// skip spaces
|
||||
while (i < n && rest[i] === ' ') i++;
|
||||
if (i >= n) break;
|
||||
|
||||
if (rest[i] === "'") {
|
||||
// single-quoted value (positional string)
|
||||
const j = rest.indexOf("'", i + 1);
|
||||
const val = rest.slice(i + 1, j === -1 ? n : j);
|
||||
i = j === -1 ? n : j + 1;
|
||||
if (!inProps) positionals.push(val);
|
||||
} else {
|
||||
// scan to next space
|
||||
let j = i;
|
||||
while (j < n && rest[j] !== ' ') j++;
|
||||
const tok = rest.slice(i, j);
|
||||
@@ -78,9 +74,7 @@ function _parseRest(rest) {
|
||||
let rawVal = tok.slice(eqIdx + 1);
|
||||
|
||||
if (rawVal.startsWith("'")) {
|
||||
// value continues until next single quote
|
||||
const valStart = i - (tok.length - eqIdx - 1);
|
||||
// find closing quote: search from after the opening quote
|
||||
const openPos = rest.indexOf("'", rest.lastIndexOf(key + '=', i) + key.length + 1);
|
||||
const closePos = rest.indexOf("'", openPos + 1);
|
||||
rawVal = closePos === -1 ? rest.slice(openPos + 1) : rest.slice(openPos + 1, closePos);
|
||||
@@ -91,15 +85,12 @@ function _parseRest(rest) {
|
||||
} else if (!inProps) {
|
||||
positionals.push(coerce(tok));
|
||||
}
|
||||
// bare token after props start is ignored (shouldn't happen per spec)
|
||||
}
|
||||
}
|
||||
|
||||
return { positionals, props };
|
||||
}
|
||||
|
||||
// ── Second pass: build typed model ──────────────────────────────────────────
|
||||
|
||||
function _collectUnknownProps(nodeProps, knownKeys) {
|
||||
return Object.fromEntries(Object.entries(nodeProps).filter(([k]) => !knownKeys.has(k)));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user