| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 result.push({ | 65 result.push({ |
| 66 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope
Details.type())), | 66 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope
Details.type())), |
| 67 object: scopeObject, | 67 object: scopeObject, |
| 68 name: scopeDetails.name() || "" | 68 name: scopeDetails.name() || "" |
| 69 }); | 69 }); |
| 70 } | 70 } |
| 71 return result; | 71 return result; |
| 72 } | 72 } |
| 73 | 73 |
| 74 /** | 74 /** |
| 75 * @param {Object} gen |
| 76 * @return {?Array<!Scope>} |
| 77 */ |
| 78 DebuggerScript.getGeneratorScopes = function(gen) |
| 79 { |
| 80 var mirror = MakeMirror(gen); |
| 81 if (!mirror.isGenerator()) |
| 82 return null; |
| 83 var generatorMirror = /** @type {!GeneratorMirror} */(mirror); |
| 84 var count = generatorMirror.scopeCount(); |
| 85 if (count == 0) |
| 86 return null; |
| 87 var result = []; |
| 88 for (var i = 0; i < count; i++) { |
| 89 var scopeDetails = generatorMirror.scope(i).details(); |
| 90 var scopeObject = DebuggerScript._buildScopeObject(scopeDetails.type(),
scopeDetails.object()); |
| 91 if (!scopeObject) |
| 92 continue; |
| 93 result.push({ |
| 94 type: /** @type {string} */(DebuggerScript._scopeTypeNames.get(scope
Details.type())), |
| 95 object: scopeObject, |
| 96 name: scopeDetails.name() || "" |
| 97 }); |
| 98 } |
| 99 return result; |
| 100 } |
| 101 |
| 102 /** |
| 75 * @param {Object} object | 103 * @param {Object} object |
| 76 * @return {?RawLocation} | 104 * @return {?RawLocation} |
| 77 */ | 105 */ |
| 78 DebuggerScript.getGeneratorObjectLocation = function(object) | 106 DebuggerScript.getGeneratorObjectLocation = function(object) |
| 79 { | 107 { |
| 80 var mirror = MakeMirror(object, true /* transient */); | 108 var mirror = MakeMirror(object, true /* transient */); |
| 81 if (!mirror.isGenerator()) | 109 if (!mirror.isGenerator()) |
| 82 return null; | 110 return null; |
| 83 var generatorMirror = /** @type {!GeneratorMirror} */(mirror); | 111 var generatorMirror = /** @type {!GeneratorMirror} */(mirror); |
| 84 var funcMirror = generatorMirror.func(); | 112 var funcMirror = generatorMirror.func(); |
| (...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 break; | 581 break; |
| 554 } | 582 } |
| 555 return result; | 583 return result; |
| 556 } | 584 } |
| 557 | 585 |
| 558 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. | 586 // We never resolve Mirror by its handle so to avoid memory leaks caused by Mirr
ors in the cache we disable it. |
| 559 ToggleMirrorCache(false); | 587 ToggleMirrorCache(false); |
| 560 | 588 |
| 561 return DebuggerScript; | 589 return DebuggerScript; |
| 562 })(); | 590 })(); |
| OLD | NEW |