OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 return null; | 143 return null; |
144 return uiSourceCode.uiLocation( | 144 return uiSourceCode.uiLocation( |
145 /** @type {number} */ (entry.sourceLineNumber), /** @type {number} */ (e ntry.sourceColumnNumber)); | 145 /** @type {number} */ (entry.sourceLineNumber), /** @type {number} */ (e ntry.sourceColumnNumber)); |
146 } | 146 } |
147 | 147 |
148 /** | 148 /** |
149 * @override | 149 * @override |
150 * @param {!Workspace.UISourceCode} uiSourceCode | 150 * @param {!Workspace.UISourceCode} uiSourceCode |
151 * @param {number} lineNumber | 151 * @param {number} lineNumber |
152 * @param {number} columnNumber | 152 * @param {number} columnNumber |
153 * @return {?SDK.DebuggerModel.Location} | 153 * @return {!Array<!SDK.DebuggerModel.Location>} |
154 */ | 154 */ |
155 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { | 155 uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber) { |
156 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; | 156 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; |
157 if (!script) | 157 var sourceMap = script && this._sourceMapManager.sourceMapForClient(script); |
158 return null; | |
159 var sourceMap = this._sourceMapManager.sourceMapForClient(script); | |
160 if (!sourceMap) | 158 if (!sourceMap) |
161 return null; | 159 return []; |
162 var entry = sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber) ; | 160 return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber) |
163 if (!entry) | 161 .map(entry => this._debuggerModel.createRawLocation(script, entry.lineNu mber, entry.columnNumber)) |
164 return null; | 162 .filter(location => location); |
dgozman
2017/05/02 21:36:45
nit: location => !!location
| |
165 return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry .columnNumber); | |
166 } | 163 } |
167 | 164 |
168 /** | 165 /** |
169 * @param {!Common.Event} event | 166 * @param {!Common.Event} event |
170 */ | 167 */ |
171 _sourceMapWillAttach(event) { | 168 _sourceMapWillAttach(event) { |
172 var script = /** @type {!SDK.Script} */ (event.data); | 169 var script = /** @type {!SDK.Script} */ (event.data); |
173 // Create stub UISourceCode for the time source mapping is being loaded. | 170 // Create stub UISourceCode for the time source mapping is being loaded. |
174 this._addStubUISourceCode(script); | 171 this._addStubUISourceCode(script); |
175 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); | 172 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
271 * @override | 268 * @override |
272 * @param {!Workspace.UISourceCode} uiSourceCode | 269 * @param {!Workspace.UISourceCode} uiSourceCode |
273 * @param {number} lineNumber | 270 * @param {number} lineNumber |
274 * @return {boolean} | 271 * @return {boolean} |
275 */ | 272 */ |
276 uiLineHasMapping(uiSourceCode, lineNumber) { | 273 uiLineHasMapping(uiSourceCode, lineNumber) { |
277 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; | 274 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; |
278 var sourceMap = script ? this._sourceMapManager.sourceMapForClient(script) : null; | 275 var sourceMap = script ? this._sourceMapManager.sourceMapForClient(script) : null; |
279 if (!sourceMap) | 276 if (!sourceMap) |
280 return true; | 277 return true; |
281 return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber); | 278 return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber).length > 0; |
282 } | 279 } |
283 | 280 |
284 dispose() { | 281 dispose() { |
285 Common.EventTarget.removeEventListeners(this._eventListeners); | 282 Common.EventTarget.removeEventListeners(this._eventListeners); |
286 this._stubProject.dispose(); | 283 this._stubProject.dispose(); |
287 } | 284 } |
288 }; | 285 }; |
289 | 286 |
290 Bindings.CompilerScriptMapping._scriptSymbol = Symbol('Bindings.CompilerScriptMa pping._scriptSymbol'); | 287 Bindings.CompilerScriptMapping._scriptSymbol = Symbol('Bindings.CompilerScriptMa pping._scriptSymbol'); |
291 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol'); | 288 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM apping._frameIdSymbol'); |
OLD | NEW |