Browse Source

fix checkSetter()

Evan You 11 years ago
parent
commit
bb5600c4c7
2 changed files with 5 additions and 2 deletions
  1. 2 2
      src/parse/expression.js
  2. 3 0
      test/unit/specs/expression_parser_spec.js

+ 2 - 2
src/parse/expression.js

@@ -191,12 +191,12 @@ function makeSetter (body) {
 /**
  * Check for setter existence on a cache hit.
  *
- * @param {Function} fn
+ * @param {Function} hit
  */
 
 function checkSetter (hit) {
   if (!hit.set) {
-    fn.set = makeSetter(hit.body)
+    hit.set = makeSetter(hit.body)
   }
 }
 

+ 3 - 0
test/unit/specs/expression_parser_spec.js

@@ -193,6 +193,9 @@ describe('Expression Parser', function () {
   })
 
   it('dynamic setter', function () {
+    // make sure checkSetter works:
+    // should add setter if a cache hit doesn't have hit function.
+    expParser.parse('a[b]')
     var res = expParser.parse('a[b]', true)
     var scope = {
       a: { c: 1 },