Skip to content

Commit

Permalink
Extract local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
emlun committed Jan 13, 2019
1 parent 8cec667 commit e9f4bcb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@ protected void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, J
}
List<JCExpression> invokeAddExpr = invokeAddExprBuilder.toList();
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, invokeAddExpr);
statements.append(maker.Exec(invokeAdd));
JCStatement st = maker.Exec(invokeAdd);
statements.append(st);

if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Name methodName = data.getSingularName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,9 @@ protected void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, J
statements.append(createConstructBuilderVarIfNeeded(maker, data, builderType, false, source));
JCExpression thisDotFieldDotAdd = chainDots(builderType, "this", data.getPluralName().toString(), "add");
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotFieldDotAdd, List.<JCExpression>of(maker.Ident(data.getSingularName())));
statements.append(maker.Exec(invokeAdd));
JCStatement st = maker.Exec(invokeAdd);
statements.append(st);

if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Name name = data.getSingularName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,14 @@ protected void generateSingularMethod(boolean deprecate, JavacTreeMaker maker, J
/* this.pluralname$key.add(singularnameKey); */ {
JCExpression thisDotKeyFieldDotAdd = chainDots(builderType, "this", data.getPluralName() + "$key", "add");
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotKeyFieldDotAdd, List.<JCExpression>of(maker.Ident(keyName)));
statements.append(maker.Exec(invokeAdd));
JCStatement st = maker.Exec(invokeAdd);
statements.append(st);
}
/* this.pluralname$value.add(singularnameValue); */ {
JCExpression thisDotValueFieldDotAdd = chainDots(builderType, "this", data.getPluralName() + "$value", "add");
JCExpression invokeAdd = maker.Apply(List.<JCExpression>nil(), thisDotValueFieldDotAdd, List.<JCExpression>of(maker.Ident(valueName)));
statements.append(maker.Exec(invokeAdd));
JCStatement st = maker.Exec(invokeAdd);
statements.append(st);
}
if (returnStatement != null) statements.append(returnStatement);
JCBlock body = maker.Block(0, statements.toList());
Expand Down

0 comments on commit e9f4bcb

Please sign in to comment.