mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-15 02:48:30 -05:00
Initial VS Code 1.19 source merge (#571)
* Initial 1.19 xcopy * Fix yarn build * Fix numerous build breaks * Next batch of build break fixes * More build break fixes * Runtime breaks * Additional post merge fixes * Fix windows setup file * Fix test failures. * Update license header blocks to refer to source eula
This commit is contained in:
@@ -11,7 +11,9 @@ export function stringify(obj: any): string {
|
||||
}
|
||||
|
||||
export function parse(text: string): any {
|
||||
return JSON.parse(text, reviver);
|
||||
let data = JSON.parse(text);
|
||||
data = revive(data, 0);
|
||||
return data;
|
||||
}
|
||||
|
||||
interface MarshalledObject {
|
||||
@@ -30,15 +32,27 @@ function replacer(key: string, value: any): any {
|
||||
return value;
|
||||
}
|
||||
|
||||
function reviver(key: string, value: any): any {
|
||||
let marshallingConst: number;
|
||||
if (value !== void 0 && value !== null) {
|
||||
marshallingConst = (<MarshalledObject>value).$mid;
|
||||
function revive(obj: any, depth: number): any {
|
||||
|
||||
if (!obj || depth > 200) {
|
||||
return obj;
|
||||
}
|
||||
|
||||
switch (marshallingConst) {
|
||||
case 1: return URI.revive(value);
|
||||
case 2: return new RegExp(value.source, value.flags);
|
||||
default: return value;
|
||||
if (typeof obj === 'object') {
|
||||
|
||||
switch ((<MarshalledObject>obj).$mid) {
|
||||
case 1: return URI.revive(obj);
|
||||
case 2: return new RegExp(obj.source, obj.flags);
|
||||
}
|
||||
|
||||
// walk object (or array)
|
||||
for (let key in obj) {
|
||||
if (Object.hasOwnProperty.call(obj, key)) {
|
||||
obj[key] = revive(obj[key], depth + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user