aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorFawn <fangrui_tong@brown.edu>2019-06-15 17:28:06 -0400
committerFawn <fangrui_tong@brown.edu>2019-06-15 17:28:06 -0400
commit14ae66aec1879386c130567496597db9105e4f99 (patch)
tree300f9ac7e153bd404b8b3799fba0f52514861c36 /src/new_fields/Doc.ts
parentb4bd43f6e79c9dec30842262f270ca6122f1184a (diff)
parent618d3717e118f978de976cb34e8bc2051c726ffc (diff)
merge with master
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 7f7263cf1..c2cfda079 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -186,7 +186,8 @@ export namespace Doc {
}
// compare whether documents or their protos match
- export function AreProtosEqual(doc: Doc, other: Doc) {
+ export function AreProtosEqual(doc?: Doc, other?: Doc) {
+ if (!doc || !other) return false;
let r = (doc === other);
let r2 = (doc.proto === other);
let r3 = (other.proto === doc);
@@ -211,13 +212,11 @@ export namespace Doc {
return Array.from(results);
}
-
export function MakeAlias(doc: Doc) {
- const alias = new Doc;
if (!GetT(doc, "isPrototype", "boolean", true)) {
- alias.proto = doc.proto;
+ return Doc.MakeCopy(doc);
}
- return alias;
+ return new Doc;
}
export function MakeCopy(doc: Doc, copyProto: boolean = false): Doc {