-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Description
Hello!
I am new to Cobol, but according to Cobol examples and specifications I found, printMultiplyRegular() in MultiplyStatementRule contains a bug. It treats the first operand as the result and "MULTIPLY 42 BY B" is transformed into "BigDecimal.valueOf(42) = BigDecimal.valueOf(42).multiply(b);", which makes no sense (especially when the first argument is a literal).
This replacement will fix it:
package io.proleap.cobol.transform.java.rules.lang.procedure.multiply;
// ...
public class MultiplyStatementRule extends CobolTransformRule<MultiplyStatementContext, MultiplyStatement> {
// ...
protected void printMultiplyRegular(MultiplyStatement multiplyStatement, RuleContext rc) {
ByPhrase regular = multiplyStatement.getByPhrase();
for (ByOperand regularOperand : regular.getByOperands()) {
rc.visit(regularOperand.getOperandCall().getCtx());
rc.p(" = ");
rc.visit(regularOperand.getOperandCall().getCtx());
rc.p(".multiply(");
rc.visit(multiplyStatement.getOperandValueStmt().getCtx());
rc.p(");");
rc.pNl(regular);
}
}
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels