| 1743 | } |
| 1744 | |
| 1745 | private async instanceRefToVariable( |
| 1746 | thread: ThreadInfo, canEvaluate: boolean, evaluateName: string, name: string, ref: VMInstanceRef | VMSentinel, allowFetchFullString: boolean, |
| 1747 | ): Promise<DebugProtocol.Variable> { |
| 1748 | if (ref.type === "Sentinel") { |
| 1749 | return { |
| 1750 | name, |
| 1751 | value: (ref as VMSentinel).valueAsString, |
| 1752 | variablesReference: 0, |
| 1753 | }; |
| 1754 | } else { |
| 1755 | const val = ref as InstanceWithEvaluateName; |
| 1756 | // Stick on the evaluateName as we'll need this to build |
| 1757 | // the evaluateName for the child, and we don't have the parent |
| 1758 | // (or a string expression) in the response. |
| 1759 | val.evaluateName = canEvaluate ? evaluateName : undefined; |
| 1760 | |
| 1761 | const str = this.evaluateToStringInDebugViews && allowFetchFullString && !val.valueAsString |
| 1762 | ? await this.fullValueAsString(thread.ref, val) |
| 1763 | : this.valueAsString(val); |
| 1764 | |
| 1765 | return { |
| 1766 | evaluateName: canEvaluate ? evaluateName : undefined, |
| 1767 | indexedVariables: (val && val.kind && val.kind.endsWith("List") ? val.length : undefined), |
| 1768 | name, |
| 1769 | type: `${val.kind} (${val.class.name})`, |
| 1770 | value: str || "", |
| 1771 | variablesReference: val.valueAsString ? 0 : thread.storeData(val), |
| 1772 | }; |
| 1773 | } |
| 1774 | } |
| 1775 | |
| 1776 | public isSdkLibrary(uri: string) { |
| 1777 | return uri.startsWith("dart:"); |