Skip to content

Commit

Permalink
#120 - parser improvement
Browse files Browse the repository at this point in the history
  • Loading branch information
giraud committed Dec 17, 2018
1 parent a5d9e2a commit 6ce1131
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/com/reason/lang/reason/RmlParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -255,14 +255,17 @@ private void parseComma(@NotNull PsiBuilder builder, ParserState state) {
if (state.isCurrentResolution(functionBody)) {
// a function is part of something else, close it first
state.popEnd().popEnd();
} else if (state.isCurrentResolution(modulePath)) {
state.complete().popEnd();
}

if (state.isCurrentResolution(functionParameterNamedSignatureItem)) {
state.complete().
popEndUntilResolution(functionParameterNamed).popEnd().
advance().
add(mark(builder, functionParameter, functionParameter, m_types.C_FUN_PARAM));
add(mark(builder, functionParameter, m_types.C_FUN_PARAM));
}

if (state.isCurrentResolution(signatureItem) && !state.isCurrentContext(recordSignature)) {
state.popEnd();
state.advance();
Expand Down Expand Up @@ -651,7 +654,7 @@ private void parseLIdent(@NotNull PsiBuilder builder, ParserState state) {
state.complete();
state.setPreviousComplete();
} else if (state.isCurrentResolution(functionParameters)) {
state.add(mark(builder, state.currentContext(), functionParameter, m_types.C_FUN_PARAM).complete());
state.add(mark(builder, functionParameter, m_types.C_FUN_PARAM).complete());
} else if (state.isCurrentResolution(external)) {
// EXTERNAL <LIDENT> ...
state.updateCurrentResolution(externalNamed);
Expand Down
6 changes: 6 additions & 0 deletions tests/com/reason/lang/reason/FunctionCallTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,4 +37,10 @@ public void testCall3() {
assertEmpty(callParams.getParameterList());
}

public void testIssue120() {
PsiLet e = first(letExpressions(parseCode("let _ = f(x == U.I, 1)")));

PsiFunctionCallParams params = PsiTreeUtil.findChildOfType(e, PsiFunctionCallParams.class);
assertSize(2, params.getParameterList());
}
}

0 comments on commit 6ce1131

Please sign in to comment.