summaryrefslogtreecommitdiff
path: root/compiler/src/main/kotlin/android/databinding
diff options
context:
space:
mode:
authorGeorge Mount <mount@google.com>2017-05-03 17:16:09 -0700
committerGeorge Mount <mount@google.com>2017-05-04 14:40:13 -0700
commitcf48aab44d681040527be152c31d310d65cbbaaa (patch)
tree00b66226daab9fa76720c616c9fb46cfd508ea64 /compiler/src/main/kotlin/android/databinding
parent17682ff2c1c35ec3b29b7ec1ab6d9ba14be5b220 (diff)
downloaddata-binding-cf48aab44d681040527be152c31d310d65cbbaaa.tar.gz
Fix local variable name collision.
Bug 37130152 Local variable names were colliding with fields, so they must account for field names. Test: ran TestApp tests Change-Id: I0f3224842ba522c031e4fa568c6dd04cccf69a74
Diffstat (limited to 'compiler/src/main/kotlin/android/databinding')
-rw-r--r--compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt4
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt
index 673505d7..8d46cd9c 100644
--- a/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt
+++ b/compiler/src/main/kotlin/android/databinding/tool/writer/LayoutBinderWriter.kt
@@ -96,8 +96,10 @@ class ExprModelExt {
if (scope == Scope.CALLBACK || scope == Scope.EXECUTE_PENDING_METHOD) {
candidate = candidate.decapitalize()
}
+ val checkFields = scope != Scope.METHOD
var i = 0
- while (usedFieldNames[scope]!!.contains(candidate)) {
+ while (usedFieldNames[scope]!!.contains(candidate)
+ || (checkFields && usedFieldNames[Scope.FIELD]!!.contains(candidate))) {
i ++
candidate = candidateBase + i
}