summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Kelly <steveire@gmail.com>2012-11-26 21:42:00 (GMT)
committerStephen Kelly <steveire@gmail.com>2012-11-26 21:52:22 (GMT)
commitee96dc76864b899684d62b51edd87d3083e80168 (patch)
tree75c8d00dee9cfb81502b350bdb8d9f80935b536f
parente5748521206e1f240d495d1ec3b2ccd31611f081 (diff)
downloadCMake-ee96dc76864b899684d62b51edd87d3083e80168.zip
CMake-ee96dc76864b899684d62b51edd87d3083e80168.tar.gz
CMake-ee96dc76864b899684d62b51edd87d3083e80168.tar.bz2
Genex: Extract a method to parse parameters.
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx21
-rw-r--r--Source/cmGeneratorExpressionEvaluator.h8
2 files changed, 26 insertions, 3 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 2e123a4..23f641d 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -677,6 +677,23 @@ std::string GeneratorExpressionContent::Evaluate(
}
std::vector<std::string> parameters;
+ this->EvaluateParameters(node, identifier, context, dagChecker, parameters);
+ if (context->HadError)
+ {
+ return std::string();
+ }
+
+ return node->Evaluate(parameters, context, this, dagChecker);
+}
+
+//----------------------------------------------------------------------------
+std::string GeneratorExpressionContent::EvaluateParameters(
+ const cmGeneratorExpressionNode *node,
+ const std::string &identifier,
+ cmGeneratorExpressionContext *context,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ std::vector<std::string> &parameters) const
+{
{
std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
pit = this->ParamChildren.begin();
@@ -732,10 +749,8 @@ std::string GeneratorExpressionContent::Evaluate(
{
reportError(context, this->GetOriginalExpression(), "$<" + identifier
+ "> expression requires at least one parameter.");
- return std::string();
}
-
- return node->Evaluate(parameters, context, this, dagChecker);
+ return std::string();
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h
index 04a2acd..642a02e 100644
--- a/Source/cmGeneratorExpressionEvaluator.h
+++ b/Source/cmGeneratorExpressionEvaluator.h
@@ -33,6 +33,7 @@ struct cmGeneratorExpressionContext
};
struct cmGeneratorExpressionDAGChecker;
+struct cmGeneratorExpressionNode;
//----------------------------------------------------------------------------
struct cmGeneratorExpressionEvaluator
@@ -118,6 +119,13 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
~GeneratorExpressionContent();
private:
+ std::string EvaluateParameters(const cmGeneratorExpressionNode *node,
+ const std::string &identifier,
+ cmGeneratorExpressionContext *context,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ std::vector<std::string> &parameters) const;
+
+private:
std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;
const char *StartContent;