|
120 | 120 | } |
121 | 121 | } |
122 | 122 | function Provider(sourceMap) { |
123 | | - var syntaxTree; |
124 | 123 | this.options={ |
125 | 124 | offline:true |
126 | 125 | }; |
|
154 | 153 | _cache[url]={ |
155 | 154 | exist:def1.promise, |
156 | 155 | _map:{}, |
157 | | - _file:'' |
| 156 | + _file:'', |
| 157 | + _syntaxTree:'' |
158 | 158 | }; |
159 | 159 | getSourceFileUrl(url).then(function(mapUrl){ |
160 | 160 | if(mapUrl && !validURL(mapUrl)){ |
|
167 | 167 | column: stack.columnNumber |
168 | 168 | }); |
169 | 169 | if(_cache[url]._file){ |
170 | | - syntaxTree = window.esprima.parse(_cache[url]._file,{loc:true}); |
171 | | - loc.name=_findFunctionName(syntaxTree,loc.line, loc.column); |
| 170 | + _cache[url]._syntaxTree = window.esprima.parse(_cache[url]._file,{loc:true}); |
| 171 | + loc.name=_findFunctionName( _cache[url]._syntaxTree,loc.line, loc.column); |
172 | 172 | _stack=new window.StackFrame(loc.name, stack.args, loc.source, loc.line, loc.column); |
173 | 173 | def.resolve(_stack); |
174 | 174 | }else{ |
175 | 175 | var sourceFileUlr=url.substring(0,url.lastIndexOf('/')+1)+loc.source; |
176 | 176 | $.ajax(sourceFileUlr).then(function(content) { |
177 | 177 | _cache[url]._file=content; |
178 | 178 | def1.resolve(true); |
179 | | - syntaxTree = window.esprima.parse(_cache[url]._file,{loc:true}); |
180 | | - loc.name=_findFunctionName(syntaxTree,loc.line, loc.column); |
| 179 | + _cache[url]._syntaxTree = window.esprima.parse(_cache[url]._file,{loc:true}); |
| 180 | + loc.name=_findFunctionName( _cache[url]._syntaxTree,loc.line, loc.column); |
181 | 181 | _stack=new window.StackFrame(loc.name, stack.args, loc.source, loc.line, loc.column); |
182 | 182 | def.resolve(_stack); |
183 | 183 | }).fail(function() { |
|
207 | 207 | line: stack.lineNumber, |
208 | 208 | column: stack.columnNumber |
209 | 209 | }); |
210 | | - syntaxTree = window.esprima.parse(_cache[url]._file,{loc:true}); |
211 | | - loc.name=_findFunctionName(syntaxTree,loc.line, loc.column); |
| 210 | + loc.name=_findFunctionName( _cache[url]._syntaxTree,loc.line, loc.column); |
212 | 211 | _stack=new window.StackFrame(loc.name, stack.args, loc.source, loc.line, loc.column); |
213 | 212 | def.resolve(_stack); |
214 | 213 | } |
|
0 commit comments