Kaydet (Commit) 1d531077 authored tarafından Luboš Luňák's avatar Luboš Luňák

more robust implicit intersection optimizing

For example, FormulaCompiler::MergeRangeReference() may replace
the parameter tokens and merge two into one.

Change-Id: Ie2933dec3ef73b5b605160e86a8ab3b5b1d17c1c
Reviewed-on: https://gerrit.libreoffice.org/58684
Tested-by: Jenkins
Reviewed-by: 's avatarLuboš Luňák <l.lunak@collabora.com>
üst a3007228
......@@ -305,10 +305,11 @@ private:
// be important. Store candidate parameters and the operation they are the argument for.
struct PendingImplicitIntersectionOptimization
{
PendingImplicitIntersectionOptimization(formula::FormulaToken** p, const formula::FormulaToken* o)
: parameter( p ), operation( o ) {}
formula::FormulaToken** parameter;
const formula::FormulaToken* operation;
PendingImplicitIntersectionOptimization(formula::FormulaToken** p, formula::FormulaToken* o)
: parameterLocation( p ), parameter( *p ), operation( o ) {}
formula::FormulaToken** parameterLocation;
formula::FormulaTokenRef parameter;
formula::FormulaTokenRef operation;
};
std::vector< PendingImplicitIntersectionOptimization > mPendingImplicitIntersectionOptimizations;
std::set<formula::FormulaTokenRef> mUnhandledPossibleImplicitIntersections;
......
......@@ -5971,10 +5971,14 @@ void ScCompiler::PostProcessCode()
{
for( const PendingImplicitIntersectionOptimization& item : mPendingImplicitIntersectionOptimizations )
{
if( *item.parameterLocation != item.parameter ) // the parameter has been changed somehow
continue;
if( item.parameterLocation >= pCode ) // the location is not inside the code (pCode points after the end)
continue;
// E.g. "SUMPRODUCT(I5:I6+1)" shouldn't do implicit intersection.
if( item.operation->IsInForceArray())
continue;
ReplaceDoubleRefII( item.parameter );
ReplaceDoubleRefII( item.parameterLocation );
}
mPendingImplicitIntersectionOptimizations.clear();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment