IDEA-160102 JavaScript Debugger: "Copy Watch"creates buggy code

This commit is contained in:
Konstantin Ulitin
2016-11-23 17:41:19 +03:00
parent e6070e43e3
commit 5724f97175
@@ -59,20 +59,20 @@ object ValueModifierUtil {
}
private fun doAppendName(builder: StringBuilder, name: String, quoted: Boolean) {
val useKeyNotation = !quoted && KEY_NOTATION_PROPERTY_NAME_PATTERN.matcher(name).matches()
if (builder.length != 0) {
builder.append(if (useKeyNotation) '.' else '[')
}
if (useKeyNotation) {
builder.append(name)
}
else {
if (quoted) {
builder.append(name)
val isProperty = !builder.isEmpty()
if (isProperty) {
val useKeyNotation = !quoted && KEY_NOTATION_PROPERTY_NAME_PATTERN.matcher(name).matches()
if (useKeyNotation) {
builder.append('.').append(name)
}
else {
JsonUtil.escape(name, builder)
builder.append('[')
if (quoted) builder.append(name)
else JsonUtil.escape(name, builder)
builder.append(']')
}
builder.append(']')
}
else {
builder.append(name)
}
}