Skip to content

Commit

Permalink
Address review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
poorna2152 committed Dec 16, 2023
1 parent 27eb93f commit 3064cec
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 38 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13038,21 +13038,14 @@ private STNode parseSyncSendAction(STNode expression) {
* @return peer worker name node
*/
private STNode parsePeerWorkerName() {
return STNodeFactory.createSimpleNameReferenceNode(parsePeerWorkerIdentifier());
}

private STNode parsePeerWorkerIdentifier() {
STToken token = peek();
switch (token.kind) {
case IDENTIFIER_TOKEN:
return consume();
case FUNCTION_KEYWORD:
STToken functionKeyword = consume();
return STNodeFactory.createIdentifierToken(functionKeyword.text(), functionKeyword.leadingMinutiae(),
functionKeyword.trailingMinutiae(), functionKeyword.diagnostics());
return STNodeFactory.createSimpleNameReferenceNode(consume());
default:
recover(token, ParserRuleContext.PEER_WORKER_NAME);
return parsePeerWorkerIdentifier();
return parsePeerWorkerName();
}
}

Expand Down Expand Up @@ -13232,8 +13225,7 @@ private STNode createReceiveField(STNode identifier) {

identifier = STNodeFactory.createSimpleNameReferenceNode(identifier);
STNode colon = parseColon();
STNode peerWorker = parsePeerWorkerIdentifier();
peerWorker = STNodeFactory.createSimpleNameReferenceNode(peerWorker);
STNode peerWorker = parsePeerWorkerName();
return STNodeFactory.createReceiveFieldNode(identifier, colon, peerWorker);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down Expand Up @@ -496,8 +495,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -636,8 +636,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand All @@ -358,8 +357,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down Expand Up @@ -560,8 +558,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand All @@ -584,8 +581,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand Down Expand Up @@ -685,8 +681,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,8 +242,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down Expand Up @@ -324,8 +323,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function"
"kind": "FUNCTION_KEYWORD"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -310,8 +310,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand Down Expand Up @@ -407,8 +406,7 @@
"kind": "SIMPLE_NAME_REFERENCE",
"children": [
{
"kind": "IDENTIFIER_TOKEN",
"value": "function",
"kind": "FUNCTION_KEYWORD",
"trailingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1261,6 +1261,12 @@
},
{
"kind": "CLOSE_BRACE_TOKEN",
"leadingMinutiae": [
{
"kind": "WHITESPACE_MINUTIAE",
"value": " "
}
],
"trailingMinutiae": [
{
"kind": "END_OF_LINE_MINUTIAE",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ function foo6() {
function foo7() {
<- {
a: }
}
}

function foo8() {
flush
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3008,14 +3008,19 @@ public ReceiveActionNode transform(ReceiveActionNode receiveActionNode) {

@Override
public ReceiveFieldsNode transform(ReceiveFieldsNode receiveFieldsNode) {
int trailingNL = shouldExpand(receiveFieldsNode) ? 1 : 0;
boolean preserveIndent = env.preserveIndentation;
preserveIndentation(false);
boolean isMultiline = shouldExpand(receiveFieldsNode);
int trailingNL = isMultiline ? 1 : 0;
int trailingWS = isMultiline ? 0 : 1;
Token openBrace = formatToken(receiveFieldsNode.openBrace(), 0, trailingNL);
indent();
SeparatedNodeList<Node> receiveFields =
formatSeparatedNodeList(receiveFieldsNode.receiveFields(), 0, 0, 1 - trailingNL, trailingNL, 0,
formatSeparatedNodeList(receiveFieldsNode.receiveFields(), 0, 0, trailingWS, trailingNL, 0,
trailingNL);
unindent();
Token closeBrace = formatToken(receiveFieldsNode.closeBrace(), env.trailingWS, env.trailingNL);
preserveIndentation(preserveIndent);
return receiveFieldsNode.modify()
.withOpenBrace(openBrace)
.withReceiveFields(receiveFields)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,13 @@ function foz() {
};
}
}

function foooz() {
do {
_ = <-
{
a: w1,
b: w2
};
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ function foz() {
tooLengthyWorkerName};
}
}

function foooz() {
do {
_ = <-
{
a: w1,b: w2
};
}
}

0 comments on commit 3064cec

Please sign in to comment.