diff options
| author | Fawn <fangrui_tong@brown.edu> | 2019-06-15 17:28:06 -0400 |
|---|---|---|
| committer | Fawn <fangrui_tong@brown.edu> | 2019-06-15 17:28:06 -0400 |
| commit | 14ae66aec1879386c130567496597db9105e4f99 (patch) | |
| tree | 300f9ac7e153bd404b8b3799fba0f52514861c36 /src/new_fields/Doc.ts | |
| parent | b4bd43f6e79c9dec30842262f270ca6122f1184a (diff) | |
| parent | 618d3717e118f978de976cb34e8bc2051c726ffc (diff) | |
merge with master
Diffstat (limited to 'src/new_fields/Doc.ts')
| -rw-r--r-- | src/new_fields/Doc.ts | 9 |
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 { |
