| 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 {!Array<!SDK.DebuggerModel.Location>} | 153 * @return {?SDK.DebuggerModel.Location} |
| 154 */ | 154 */ |
| 155 uiLocationToRawLocations(uiSourceCode, lineNumber, columnNumber) { | 155 uiLocationToRawLocation(uiSourceCode, lineNumber, columnNumber) { |
| 156 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; | 156 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; |
| 157 var sourceMap = script && this._sourceMapManager.sourceMapForClient(script); | 157 if (!script) |
| 158 return null; |
| 159 var sourceMap = this._sourceMapManager.sourceMapForClient(script); |
| 158 if (!sourceMap) | 160 if (!sourceMap) |
| 159 return []; | 161 return null; |
| 160 return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber) | 162 var entry = sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber)
; |
| 161 .map(entry => this._debuggerModel.createRawLocation(script, entry.lineNu
mber, entry.columnNumber)) | 163 if (!entry) |
| 162 .filter(location => !!location); | 164 return null; |
| 165 return this._debuggerModel.createRawLocation(script, entry.lineNumber, entry
.columnNumber); |
| 163 } | 166 } |
| 164 | 167 |
| 165 /** | 168 /** |
| 166 * @param {!Common.Event} event | 169 * @param {!Common.Event} event |
| 167 */ | 170 */ |
| 168 _sourceMapWillAttach(event) { | 171 _sourceMapWillAttach(event) { |
| 169 var script = /** @type {!SDK.Script} */ (event.data); | 172 var script = /** @type {!SDK.Script} */ (event.data); |
| 170 // Create stub UISourceCode for the time source mapping is being loaded. | 173 // Create stub UISourceCode for the time source mapping is being loaded. |
| 171 this._addStubUISourceCode(script); | 174 this._addStubUISourceCode(script); |
| 172 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); | 175 this._debuggerWorkspaceBinding.pushSourceMapping(script, this); |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 * @override | 271 * @override |
| 269 * @param {!Workspace.UISourceCode} uiSourceCode | 272 * @param {!Workspace.UISourceCode} uiSourceCode |
| 270 * @param {number} lineNumber | 273 * @param {number} lineNumber |
| 271 * @return {boolean} | 274 * @return {boolean} |
| 272 */ | 275 */ |
| 273 uiLineHasMapping(uiSourceCode, lineNumber) { | 276 uiLineHasMapping(uiSourceCode, lineNumber) { |
| 274 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; | 277 var script = uiSourceCode[Bindings.CompilerScriptMapping._scriptSymbol]; |
| 275 var sourceMap = script ? this._sourceMapManager.sourceMapForClient(script) :
null; | 278 var sourceMap = script ? this._sourceMapManager.sourceMapForClient(script) :
null; |
| 276 if (!sourceMap) | 279 if (!sourceMap) |
| 277 return true; | 280 return true; |
| 278 return sourceMap.mappingsForLine(uiSourceCode.url(), lineNumber).length > 0; | 281 return !!sourceMap.firstSourceLineMapping(uiSourceCode.url(), lineNumber); |
| 279 } | 282 } |
| 280 | 283 |
| 281 dispose() { | 284 dispose() { |
| 282 Common.EventTarget.removeEventListeners(this._eventListeners); | 285 Common.EventTarget.removeEventListeners(this._eventListeners); |
| 283 this._stubProject.dispose(); | 286 this._stubProject.dispose(); |
| 284 } | 287 } |
| 285 }; | 288 }; |
| 286 | 289 |
| 287 Bindings.CompilerScriptMapping._scriptSymbol = Symbol('Bindings.CompilerScriptMa
pping._scriptSymbol'); | 290 Bindings.CompilerScriptMapping._scriptSymbol = Symbol('Bindings.CompilerScriptMa
pping._scriptSymbol'); |
| 288 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM
apping._frameIdSymbol'); | 291 Bindings.CompilerScriptMapping._frameIdSymbol = Symbol('Bindings.CompilerScriptM
apping._frameIdSymbol'); |
| OLD | NEW |