From 9600a771999de20fb22130cdb97088591508f89f Mon Sep 17 00:00:00 2001 From: Dan Sinclair Date: Tue, 6 Mar 2018 13:51:18 +0000 Subject: [formcalc] Allow empty declaration bodies This CL removes the checks for empty declaration bodies. Change-Id: I06a8f602f49d7709bce86442cae2d38991fa5d82 Reviewed-on: https://pdfium-review.googlesource.com/27950 Reviewed-by: Ryan Harrison Commit-Queue: dsinclair --- xfa/fxfa/fm2js/cxfa_fmparser.cpp | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/xfa/fxfa/fm2js/cxfa_fmparser.cpp b/xfa/fxfa/fm2js/cxfa_fmparser.cpp index 09cbee5a10..f000066a19 100644 --- a/xfa/fxfa/fm2js/cxfa_fmparser.cpp +++ b/xfa/fxfa/fm2js/cxfa_fmparser.cpp @@ -131,11 +131,8 @@ std::unique_ptr CXFA_FMParser::ParseFunction() { return nullptr; std::vector> expressions; - if (m_token.m_type != TOKendfunc) { + if (m_token.m_type != TOKendfunc) expressions = ParseExpressionList(); - if (expressions.empty()) - return nullptr; - } if (!CheckThenNext(TOKendfunc)) return nullptr; @@ -965,7 +962,7 @@ std::unique_ptr CXFA_FMParser::ParseWhileExpression() { return nullptr; auto exprs = ParseExpressionList(); - if (exprs.empty() || !CheckThenNext(TOKendwhile)) + if (!CheckThenNext(TOKendwhile)) return nullptr; return pdfium::MakeUnique( @@ -1023,7 +1020,7 @@ std::unique_ptr CXFA_FMParser::ParseForExpression() { return nullptr; auto exprs = ParseExpressionList(); - if (exprs.empty() || !CheckThenNext(TOKendfor)) + if (!CheckThenNext(TOKendfor)) return nullptr; return pdfium::MakeUnique( @@ -1069,7 +1066,7 @@ std::unique_ptr CXFA_FMParser::ParseForeachExpression() { return nullptr; auto exprs = ParseExpressionList(); - if (exprs.empty() || !CheckThenNext(TOKendfor)) + if (!CheckThenNext(TOKendfor)) return nullptr; return pdfium::MakeUnique( @@ -1089,7 +1086,7 @@ std::unique_ptr CXFA_FMParser::ParseDoExpression() { return nullptr; auto exprs = ParseExpressionList(); - if (exprs.empty() || !CheckThenNext(TOKend)) + if (!CheckThenNext(TOKend)) return nullptr; return pdfium::MakeUnique( -- cgit v1.2.3