diff options
| author | Misko Hevery | 2010-07-08 10:40:54 -0700 |
|---|---|---|
| committer | Misko Hevery | 2010-07-08 10:51:08 -0700 |
| commit | ee82dae3186b7a4fc4d339fc97d5792b2b5e2648 (patch) | |
| tree | a97c8b91cb9f1849941783078c9e828bf6880b2d /src/Scope.js | |
| parent | b5195b8f67b143d6c38de9ae2295cb364fab0d95 (diff) | |
| download | angular.js-ee82dae3186b7a4fc4d339fc97d5792b2b5e2648.tar.bz2 | |
added class as a constant keyword to generated code
Diffstat (limited to 'src/Scope.js')
| -rw-r--r-- | src/Scope.js | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/Scope.js b/src/Scope.js index b45efbce..35da77fe 100644 --- a/src/Scope.js +++ b/src/Scope.js @@ -46,7 +46,14 @@ function setter(instance, path, value){ /////////////////////////////////// var getterFnCache = {}; -var JS_KEYWORDS = ["this", "throw", "for", "foreach", "var", "const"]; +var JS_KEYWORDS = {}; +foreach( + ["break", "const", "continue", "class", "delete", + "do", "while", "for", "function", "if", + "instanceof", "new", "return", "switch", + "this", "throw", "try", "catch", "with"], + function(key){ JS_KEYWORDS[key] = true;} +); function getterFn(path){ var fn = getterFnCache[path]; if (fn) return fn; @@ -54,7 +61,7 @@ function getterFn(path){ var code = 'function (self){\n'; code += ' var last, fn, type;\n'; foreach(path.split('.'), function(key) { - key = (includes(JS_KEYWORDS, key)) ? '["' + key + '"]' : '.' + key; + key = (JS_KEYWORDS[key]) ? '["' + key + '"]' : '.' + key; code += ' if(!self) return self;\n'; code += ' last = self;\n'; code += ' self = self' + key + ';\n'; |
