Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
fix($parse): allow for new lines in expr when promise unwrapping is on
Browse files Browse the repository at this point in the history
Previously, when unwrapping promises was set to `true`,
an error would occur if a parsed expression had a
new line in it.
This was because when generating the `evaledFnGetter` code,
a new line in an parsed expression would create a new line
in a JS string in that code, which is illegal. That is:
```js
pw("A+
B")
```

Closes #4718
  • Loading branch information
rodyhaddad authored and IgorMinar committed Nov 22, 2013
1 parent 0421cb4 commit 40647b1
Show file tree
Hide file tree
Showing 2 changed files with 671 additions and 660 deletions.
2 changes: 1 addition & 1 deletion src/ng/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -1017,7 +1017,7 @@ function getterFn(path, options, fullExp) {
: '((k&&k.hasOwnProperty("' + key + '"))?k:s)') + '["' + key + '"]' + ';\n' +
(options.unwrapPromises
? 'if (s && s.then) {\n' +
' pw("' + fullExp.replace(/\"/g, '\\"') + '");\n' +
' pw("' + fullExp.replace(/(["\r\n])/g, '\\$1') + '");\n' +
' if (!("$$v" in s)) {\n' +
' p=s;\n' +
' p.$$v = undefined;\n' +
Expand Down
Loading

0 comments on commit 40647b1

Please sign in to comment.