Skip to content

Commit

Permalink
Simplify parsing logic
Browse files Browse the repository at this point in the history
  • Loading branch information
FirentisTFW committed Nov 16, 2024
1 parent fc99c42 commit efe97db
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/util/dart_class_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,18 +89,14 @@ function parseLinesToConstructors(
continue;
}

const factoryConstructor = line.includes(`factory ${className}.`);

let openParenthesisCount = 0;
const openingParenthesisChar = factoryConstructor ? "(" : "{";
const closingParenthesisChar = factoryConstructor ? ")" : "}";

for (let j = i; j < lines.length; j++) {
// FIXME Possibly many occurrences in one line?
if (lines[j].includes(openingParenthesisChar)) {
if (lines[j].includes("(")) {
openParenthesisCount++;
}
if (lines[j].includes(closingParenthesisChar)) {
if (lines[j].includes(")")) {
openParenthesisCount--;
}
if (openParenthesisCount > 0) {
Expand Down

0 comments on commit efe97db

Please sign in to comment.