aboutsummaryrefslogtreecommitdiffstats
path: root/qv4codegen.cpp
diff options
context:
space:
mode:
authorLars Knoll <lars.knoll@digia.com>2012-12-17 13:34:39 +0100
committerSimon Hausmann <simon.hausmann@digia.com>2012-12-17 20:24:20 +0100
commit2d4daa564719d61191aa4907494e8a728fbe335b (patch)
treea8e89549b776fa591c7d54b9354e6fc985cfe49f /qv4codegen.cpp
parent344a5b804cc9570ebe51f62ff492d3a896d97856 (diff)
Resolve argument names from right to left
Duplicated names for arguments are allowed in JS, later ones shadow previous ones. So we need to iterate from back to front to resolve the names correctly. Change-Id: If427ce9d11ac561457c24e41f79c11263fa0a8dc Reviewed-by: Simon Hausmann <simon.hausmann@digia.com>
Diffstat (limited to 'qv4codegen.cpp')
-rw-r--r--qv4codegen.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/qv4codegen.cpp b/qv4codegen.cpp
index cc605d9878..063243ad15 100644
--- a/qv4codegen.cpp
+++ b/qv4codegen.cpp
@@ -1774,7 +1774,7 @@ IR::Function *Codegen::defineFunction(const QString &name, AST::Node *ast,
int Codegen::indexOfArgument(const QStringRef &string) const
{
- for (int i = 0; i < _function->formals.size(); ++i) {
+ for (int i = _function->formals.size() - 1; i >= 0; --i) {
if (*_function->formals.at(i) == string)
return i;
}