fix($injector): more conservative annotation parsing

This commit is contained in:
Misko Hevery 2012-09-05 14:46:17 -07:00
parent 8cb9c99ec0
commit d9eff86ef7
2 changed files with 2 additions and 2 deletions

View file

@ -40,7 +40,7 @@
var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m; var FN_ARGS = /^function\s*[^\(]*\(\s*([^\)]*)\)/m;
var FN_ARG_SPLIT = /,/; var FN_ARG_SPLIT = /,/;
var FN_ARG = /^\s*(_?)(.+?)\1\s*$/; var FN_ARG = /^\s*(_?)(\S+?)\1\s*$/;
var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg; var STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
function annotate(fn) { function annotate(fn) {
var $inject, var $inject,

View file

@ -143,7 +143,7 @@ describe('injector', function() {
function $f_n0 /* function $f_n0 /*
*/( */(
$a, // x, <-- looks like an arg but it is a comment $a, // x, <-- looks like an arg but it is a comment
b_, /* z, <-- looks like an arg but it is a b_ , /* z, <-- looks like an arg but it is a
multi-line comment multi-line comment
function (a, b) {} function (a, b) {}
*/ */