Skip to content
Permalink
Browse files
Don't remove if keyword on process error
Prevent the `if` keyword from removing itself from the AST when it fails to parse. This allows us to generate an error for it later, if it is not handled as part of some other syntax.
  • Loading branch information
Pieter12345 committed Jul 21, 2020
1 parent 1dcd0cb commit 980bd983293d26668744c0cd200814f8ee7dcaa6
Showing 1 changed file with 4 additions and 1 deletion.
@@ -39,7 +39,6 @@ && nodeIsIfFunction(list.get(keywordPosition + 3))) {
// It is, convert this into an ifelse
ParseTree newNode = new ParseTree(new CFunction(IFELSE, t), node.getFileOptions());
newNode.setChildren(node.getChildren());
list.set(keywordPosition, newNode);
node = newNode;
}
} catch (IndexOutOfBoundsException ex) {
@@ -94,6 +93,10 @@ && nodeIsIfFunction(list.get(keywordPosition + 3))) {
}
}
}

// Set the new node, which might have changed to 'ifelse()'.
list.set(keywordPosition, node);

return keywordPosition;
}

0 comments on commit 980bd98

Please sign in to comment.