Don't try to revive buffers

We can safely skip reviving these objects (which is quite expensive) since they only contain numbers
This commit is contained in:
Matt Bierner
2020-07-22 14:02:32 -07:00
parent ba6576d343
commit afdb5ec6e0

View File

@@ -5,6 +5,7 @@
import { URI } from 'vs/base/common/uri';
import { regExpFlags } from 'vs/base/common/strings';
import { VSBuffer } from 'vs/base/common/buffer';
export function stringify(obj: any): string {
return JSON.stringify(obj, replacer);
@@ -44,6 +45,13 @@ export function revive(obj: any, depth = 0): any {
case 2: return new RegExp(obj.source, obj.flags);
}
if (
obj instanceof VSBuffer
|| obj instanceof Uint8Array
) {
return obj;
}
// walk object (or array)
for (let key in obj) {
if (Object.hasOwnProperty.call(obj, key)) {