Fix the problem of multi arguments calculation (#1253)

pull/2/head
ww1516123 3 years ago committed by GitHub
parent d490a0f86f
commit 7f570c74f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -899,6 +899,13 @@ func (f *File) evalInfixExp(sheet, cell string, tokens []efp.Token) (formulaArg,
if result.Type == ArgUnknown { if result.Type == ArgUnknown {
return newEmptyFormulaArg(), errors.New(formulaErrorVALUE) return newEmptyFormulaArg(), errors.New(formulaErrorVALUE)
} }
// when thisToken is Range and nextToken is Argument and opfdStack not Empty, should push value to opfdStack and continue.
if nextToken.TType == efp.TokenTypeArgument {
if !opfdStack.Empty() {
opfdStack.Push(result)
continue
}
}
argsStack.Peek().(*list.List).PushBack(result) argsStack.Peek().(*list.List).PushBack(result)
continue continue
} }

@ -1399,9 +1399,10 @@ func TestCalcCellValue(t *testing.T) {
// FALSE // FALSE
"=FALSE()": "FALSE", "=FALSE()": "FALSE",
// IFERROR // IFERROR
"=IFERROR(1/2,0)": "0.5", "=IFERROR(1/2,0)": "0.5",
"=IFERROR(ISERROR(),0)": "0", "=IFERROR(ISERROR(),0)": "0",
"=IFERROR(1/0,0)": "0", "=IFERROR(1/0,0)": "0",
"=IFERROR(B2/MROUND(A2,1),0)": "2.5",
// IFNA // IFNA
"=IFNA(1,\"not found\")": "1", "=IFNA(1,\"not found\")": "1",
"=IFNA(NA(),\"not found\")": "not found", "=IFNA(NA(),\"not found\")": "not found",

Loading…
Cancel
Save