summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
authorBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-12 00:05:08 +0100
committerBenjamin Paassen <bpaassen@techfak.uni-bielefeld.de>2015-02-12 00:05:08 +0100
commit339683e64288a85b8d6f9355a10563417b7d2fa7 (patch)
tree3710c4bd2d811780dd6b4a7a6394ade41a9dd6b9 /src/core
parent7daed2f8431e89e2bd041a54bc1bef8c45329092 (diff)
addes special resolve case in ParserScope::resolve for default field descriptors and changed resolve mechanism in parent field refs to just asking for the FieldDescriptor with the given name.
Diffstat (limited to 'src/core')
-rw-r--r--src/core/parser/ParserScope.cpp14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/core/parser/ParserScope.cpp b/src/core/parser/ParserScope.cpp
index 9c0b729..5440b9c 100644
--- a/src/core/parser/ParserScope.cpp
+++ b/src/core/parser/ParserScope.cpp
@@ -19,6 +19,7 @@
#include <core/common/Exceptions.hpp>
#include <core/common/Utils.hpp>
#include <core/common/VariantWriter.hpp>
+#include <core/model/Domain.hpp>
#include <core/model/Typesystem.hpp>
#include "ParserScope.hpp"
@@ -37,6 +38,19 @@ Rooted<Node> ParserScopeBase::resolve(const Rtti *type,
const std::vector<std::string> &path,
Logger &logger)
{
+ // if the last element of the path is the default field name, we want to
+ // resolve the parent descriptor first.
+ if (type == &RttiTypes::FieldDescriptor &&
+ path.back() == DEFAULT_FIELD_NAME) {
+ std::vector<std::string> descPath;
+ descPath.insert(descPath.end(), path.begin(), path.end() - 1);
+ Rooted<Node> res = resolve(&RttiTypes::Descriptor, descPath, logger);
+ if (res == nullptr) {
+ return nullptr;
+ }
+ return res.cast<Descriptor>()->getFieldDescriptor();
+ }
+
// Go up the stack and try to resolve the
for (auto it = nodes.rbegin(); it != nodes.rend(); it++) {
std::vector<ResolutionResult> res = (*it)->resolve(type, path);