summaryrefslogtreecommitdiff
path: root/src/shared/proparser/qmakebuiltins.cpp
diff options
context:
space:
mode:
authorOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-07-25 19:10:07 +0200
committerOswald Buddenhagen <oswald.buddenhagen@nokia.com>2012-08-01 16:42:39 +0200
commit187751f9678d9bc45aa26c435997639178cf4c6b (patch)
treecfaae7619cbfbf3177b3af7323af05a5b5d20fe5 /src/shared/proparser/qmakebuiltins.cpp
parentb475ae43de88e9521c9de4a0fd63fdf136f244de (diff)
downloadqt-creator-187751f9678d9bc45aa26c435997639178cf4c6b.tar.gz
add $$shadowed() function
follow suit with qmake ... Change-Id: Ic97576eaf74dfd58e8d8cd2f8034dac3963b92c4 Reviewed-by: Daniel Teske <daniel.teske@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Diffstat (limited to 'src/shared/proparser/qmakebuiltins.cpp')
-rw-r--r--src/shared/proparser/qmakebuiltins.cpp19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/shared/proparser/qmakebuiltins.cpp b/src/shared/proparser/qmakebuiltins.cpp
index bf6023b9ff..630d1fb080 100644
--- a/src/shared/proparser/qmakebuiltins.cpp
+++ b/src/shared/proparser/qmakebuiltins.cpp
@@ -76,7 +76,8 @@ enum ExpandFunc {
E_SPRINTF, E_FORMAT_NUMBER, E_JOIN, E_SPLIT, E_BASENAME, E_DIRNAME, E_SECTION,
E_FIND, E_SYSTEM, E_UNIQUE, E_REVERSE, E_QUOTE, E_ESCAPE_EXPAND,
E_UPPER, E_LOWER, E_FILES, E_PROMPT, E_RE_ESCAPE, E_VAL_ESCAPE,
- E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS
+ E_REPLACE, E_SORT_DEPENDS, E_RESOLVE_DEPENDS, E_ENUMERATE_VARS,
+ E_SHADOWED
};
enum TestFunc {
@@ -123,6 +124,7 @@ void QMakeEvaluator::initFunctionStatics()
{ "sort_depends", E_SORT_DEPENDS },
{ "resolve_depends", E_RESOLVE_DEPENDS },
{ "enumerate_vars", E_ENUMERATE_VARS },
+ { "shadowed", E_SHADOWED },
};
for (unsigned i = 0; i < sizeof(expandInits)/sizeof(expandInits[0]); ++i)
statics.expands.insert(ProString(expandInits[i].name), expandInits[i].func);
@@ -819,6 +821,21 @@ ProStringList QMakeEvaluator::evaluateExpandFunction(
foreach (const ProString &key, keys)
ret << key;
break; }
+ case E_SHADOWED:
+ if (args.count() != 1) {
+ evalError(fL1S("shadowed(path) requires one argument."));
+ } else {
+ QString val = resolvePath(args.at(0).toQString(m_tmp1));
+ if (m_option->source_root.isEmpty()) {
+ ret += ProString(val, NoHash);
+ } else if (val.startsWith(m_option->source_root)
+ && (val.length() == m_option->source_root.length()
+ || val.at(m_option->source_root.length()) == QLatin1Char('/'))) {
+ ret += ProString(m_option->build_root + val.mid(m_option->source_root.length()),
+ NoHash).setSource(args.at(0));
+ }
+ }
+ break;
case E_INVALID:
evalError(fL1S("'%1' is not a recognized replace function.")
.arg(func.toQString(m_tmp1)));