when inserting a hint which is not a valid property name, such as 'my-key', insert the hint as ["my-key"] instead of .my-key.

insertHint now runs the hint through the acorn tokenizer to see if it looks like a valid property name.  If it's invalid, it replaces the '.' with brackets.
Refactored some code in Session.getType() - pulled out a method to find the leading '.' in a property lookup, and use that method from the insertHint logic as well.
Added 3 new unittests to test this new behavior.
This commit is contained in:
Erik Tierney committed 2013-04-24 15:40:05 -04:00
1 parent d496a0c2e2
commit a4c87a6bba
4 files changed
+114 -13

No files matched your search

@@ -42,4 +42,8 @@ require(["MyModule"], function (myModule) {
});
funB();
var x = A1;
var x = A1;
var arr = [];
arr["my-key"] = 1;
arr["for"] = 10;