aboutsummaryrefslogtreecommitdiffstats
path: root/generator
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2013-07-26 12:16:45 -0400
committerJohn Ehresman <jpe@wingware.com>2013-07-30 17:26:24 +0200
commit46db89a2a500c5b760c6f2b35ecde38d7e5ebfb6 (patch)
tree1feb857d0b8a1a8e34496b57e72300703e8f78ed /generator
parentae2a80453b95775364e93ed1a4647429b2fd7bad (diff)
Fix '%#' substitution for # > 9
Change '%#' substitution to use a regular expression for the 'old' text to enforce a word boundary after '#', such that we don't perform e.g. '%1' replacement on inputs like '%10'. This fixes problems trying to modify functions with more than nine arguments, such as the example from the previous commit (which now compiles and passes). Also add a test case for this. Change-Id: I9956804b3c65bddf7e36838866641b24ceb87c57 Reviewed-by: John Ehresman <jpe@wingware.com>
Diffstat (limited to 'generator')
-rw-r--r--generator/shiboken/shibokengenerator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/generator/shiboken/shibokengenerator.cpp b/generator/shiboken/shibokengenerator.cpp
index 7de0d3a51..ab3f59466 100644
--- a/generator/shiboken/shibokengenerator.cpp
+++ b/generator/shiboken/shibokengenerator.cpp
@@ -1659,7 +1659,7 @@ void ShibokenGenerator::writeCodeSnips(QTextStream& s,
if (type->isReference() || isPointer(type))
code.replace(QString("%%1.").arg(idx), QString("%1->").arg(replacement));
}
- code.replace(QString("%%1").arg(idx), pair.second);
+ code.replace(QRegExp(QString("%%1\\b").arg(idx)), pair.second);
}
if (language == TypeSystem::NativeCode) {
@@ -1923,7 +1923,7 @@ bool ShibokenGenerator::injectedCodeUsesArgument(const AbstractMetaFunction* fun
QString code = snip.code();
if (code.contains("%ARGUMENT_NAMES"))
return true;
- if (code.contains(QString("%%1").arg(argumentIndex + 1)))
+ if (code.contains(QRegExp(QString("%%1\\b").arg(argumentIndex + 1))))
return true;
}
return false;