Skip to content

Commit 3f58f1f

Browse files
committed
print prototypes as '[prototype]' to indicate that it's not a real
property
1 parent 5a343aa commit 3f58f1f

4 files changed

Lines changed: 81 additions & 78 deletions

File tree

‎v4-cokapi/backends/javascript/jslogger.js‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ function encodeObject(o) {
283283
var proto = Object.getPrototypeOf(o);
284284
if (_.isObject(proto) && !_.isEmpty(proto)) {
285285
//log('obj.prototype', proto, proto.smallObjId_hidden_);
286-
newEncodedObj.push(['prototype', encodeObject(proto)]);
286+
// surround 'prototype' with [ ] to indicate that it's not a
287+
// real property, but rather a pseudo-property that can only
288+
// be obtained using Object.getPrototypeOf
289+
newEncodedObj.push(['[prototype]', encodeObject(proto)]);
287290
}
288291
}
289292

‎v4-cokapi/backends/javascript/tests/constructor.golden‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@
8282
'',
8383
[ 'x', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
8484
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
85-
[ 'prototype', [ 'REF', 2 ] ] ] } },
85+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
8686
{ stdout: '',
8787
func_name: 'Vector',
8888
stack_to_render:
@@ -122,7 +122,7 @@
122122
'',
123123
[ 'x', 1 ],
124124
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
125-
[ 'prototype', [ 'REF', 2 ] ] ] } },
125+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
126126
{ stdout: '',
127127
func_name: 'Vector',
128128
stack_to_render:
@@ -162,7 +162,7 @@
162162
'',
163163
[ 'x', 1 ],
164164
[ 'y', 2 ],
165-
[ 'prototype', [ 'REF', 2 ] ] ] } },
165+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
166166
{ stdout: '',
167167
func_name: '',
168168
stack_to_render: [],
@@ -193,7 +193,7 @@
193193
'',
194194
[ 'x', 1 ],
195195
[ 'y', 2 ],
196-
[ 'prototype', [ 'REF', 2 ] ] ] } },
196+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
197197
{ stdout: '',
198198
func_name: 'Vector',
199199
stack_to_render:
@@ -233,7 +233,7 @@
233233
'',
234234
[ 'x', 1 ],
235235
[ 'y', 2 ],
236-
[ 'prototype', [ 'REF', 2 ] ] ] } },
236+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
237237
{ stdout: '',
238238
func_name: 'Vector',
239239
stack_to_render:
@@ -274,7 +274,7 @@
274274
'',
275275
[ 'x', 1 ],
276276
[ 'y', 2 ],
277-
[ 'prototype', [ 'REF', 2 ] ] ] } },
277+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
278278
{ stdout: '',
279279
func_name: 'Vector',
280280
stack_to_render:
@@ -316,7 +316,7 @@
316316
'',
317317
[ 'x', 1 ],
318318
[ 'y', 2 ],
319-
[ 'prototype', [ 'REF', 2 ] ] ] } },
319+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
320320
{ stdout: '',
321321
func_name: '',
322322
stack_to_render: [],
@@ -349,4 +349,4 @@
349349
'',
350350
[ 'x', 1 ],
351351
[ 'y', 2 ],
352-
[ 'prototype', [ 'REF', 2 ] ] ] } } ] }
352+
[ '[prototype]', [ 'REF', 2 ] ] ] } } ] }

‎v4-cokapi/backends/javascript/tests/eloquentjs-6.1-mod.golden‎

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@
167167
'',
168168
[ 'x', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
169169
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
170-
[ 'prototype', [ 'REF', 2 ] ] ] } },
170+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
171171
{ stdout: '',
172172
func_name: 'Vector',
173173
stack_to_render:
@@ -218,7 +218,7 @@
218218
'',
219219
[ 'x', 1 ],
220220
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
221-
[ 'prototype', [ 'REF', 2 ] ] ] } },
221+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
222222
{ stdout: '',
223223
func_name: 'Vector',
224224
stack_to_render:
@@ -269,7 +269,7 @@
269269
'',
270270
[ 'x', 1 ],
271271
[ 'y', 2 ],
272-
[ 'prototype', [ 'REF', 2 ] ] ] } },
272+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
273273
{ stdout: '',
274274
func_name: '',
275275
stack_to_render: [],
@@ -311,7 +311,7 @@
311311
'',
312312
[ 'x', 1 ],
313313
[ 'y', 2 ],
314-
[ 'prototype', [ 'REF', 2 ] ] ] } },
314+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
315315
{ stdout: '',
316316
func_name: 'Vector',
317317
stack_to_render:
@@ -362,13 +362,13 @@
362362
'',
363363
[ 'x', 1 ],
364364
[ 'y', 2 ],
365-
[ 'prototype', [ 'REF', 2 ] ] ],
365+
[ '[prototype]', [ 'REF', 2 ] ] ],
366366
'6':
367367
[ 'INSTANCE',
368368
'',
369369
[ 'x', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
370370
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
371-
[ 'prototype', [ 'REF', 2 ] ] ] } },
371+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
372372
{ stdout: '',
373373
func_name: 'Vector',
374374
stack_to_render:
@@ -419,13 +419,13 @@
419419
'',
420420
[ 'x', 1 ],
421421
[ 'y', 2 ],
422-
[ 'prototype', [ 'REF', 2 ] ] ],
422+
[ '[prototype]', [ 'REF', 2 ] ] ],
423423
'6':
424424
[ 'INSTANCE',
425425
'',
426426
[ 'x', 2 ],
427427
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
428-
[ 'prototype', [ 'REF', 2 ] ] ] } },
428+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
429429
{ stdout: '',
430430
func_name: 'Vector',
431431
stack_to_render:
@@ -476,13 +476,13 @@
476476
'',
477477
[ 'x', 1 ],
478478
[ 'y', 2 ],
479-
[ 'prototype', [ 'REF', 2 ] ] ],
479+
[ '[prototype]', [ 'REF', 2 ] ] ],
480480
'6':
481481
[ 'INSTANCE',
482482
'',
483483
[ 'x', 2 ],
484484
[ 'y', 3 ],
485-
[ 'prototype', [ 'REF', 2 ] ] ] } },
485+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
486486
{ stdout: '',
487487
func_name: '',
488488
stack_to_render: [],
@@ -524,13 +524,13 @@
524524
'',
525525
[ 'x', 1 ],
526526
[ 'y', 2 ],
527-
[ 'prototype', [ 'REF', 2 ] ] ],
527+
[ '[prototype]', [ 'REF', 2 ] ] ],
528528
'6':
529529
[ 'INSTANCE',
530530
'',
531531
[ 'x', 2 ],
532532
[ 'y', 3 ],
533-
[ 'prototype', [ 'REF', 2 ] ] ] } },
533+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
534534
{ stdout: '',
535535
func_name: '',
536536
stack_to_render:
@@ -581,13 +581,13 @@
581581
'',
582582
[ 'x', 1 ],
583583
[ 'y', 2 ],
584-
[ 'prototype', [ 'REF', 2 ] ] ],
584+
[ '[prototype]', [ 'REF', 2 ] ] ],
585585
'6':
586586
[ 'INSTANCE',
587587
'',
588588
[ 'x', 2 ],
589589
[ 'y', 3 ],
590-
[ 'prototype', [ 'REF', 2 ] ] ] } },
590+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
591591
{ stdout: '',
592592
func_name: 'Vector',
593593
stack_to_render:
@@ -647,19 +647,19 @@
647647
'',
648648
[ 'x', 1 ],
649649
[ 'y', 2 ],
650-
[ 'prototype', [ 'REF', 2 ] ] ],
650+
[ '[prototype]', [ 'REF', 2 ] ] ],
651651
'6':
652652
[ 'INSTANCE',
653653
'',
654654
[ 'x', 2 ],
655655
[ 'y', 3 ],
656-
[ 'prototype', [ 'REF', 2 ] ] ],
656+
[ '[prototype]', [ 'REF', 2 ] ] ],
657657
'7':
658658
[ 'INSTANCE',
659659
'',
660660
[ 'x', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
661661
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
662-
[ 'prototype', [ 'REF', 2 ] ] ] } },
662+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
663663
{ stdout: '',
664664
func_name: 'Vector',
665665
stack_to_render:
@@ -719,19 +719,19 @@
719719
'',
720720
[ 'x', 1 ],
721721
[ 'y', 2 ],
722-
[ 'prototype', [ 'REF', 2 ] ] ],
722+
[ '[prototype]', [ 'REF', 2 ] ] ],
723723
'6':
724724
[ 'INSTANCE',
725725
'',
726726
[ 'x', 2 ],
727727
[ 'y', 3 ],
728-
[ 'prototype', [ 'REF', 2 ] ] ],
728+
[ '[prototype]', [ 'REF', 2 ] ] ],
729729
'7':
730730
[ 'INSTANCE',
731731
'',
732732
[ 'x', 3 ],
733733
[ 'y', [ 'JS_SPECIAL_VAL', 'undefined' ] ],
734-
[ 'prototype', [ 'REF', 2 ] ] ] } },
734+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
735735
{ stdout: '',
736736
func_name: 'Vector',
737737
stack_to_render:
@@ -791,19 +791,19 @@
791791
'',
792792
[ 'x', 1 ],
793793
[ 'y', 2 ],
794-
[ 'prototype', [ 'REF', 2 ] ] ],
794+
[ '[prototype]', [ 'REF', 2 ] ] ],
795795
'6':
796796
[ 'INSTANCE',
797797
'',
798798
[ 'x', 2 ],
799799
[ 'y', 3 ],
800-
[ 'prototype', [ 'REF', 2 ] ] ],
800+
[ '[prototype]', [ 'REF', 2 ] ] ],
801801
'7':
802802
[ 'INSTANCE',
803803
'',
804804
[ 'x', 3 ],
805805
[ 'y', 5 ],
806-
[ 'prototype', [ 'REF', 2 ] ] ] } },
806+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
807807
{ stdout: '',
808808
func_name: '',
809809
stack_to_render:
@@ -857,19 +857,19 @@
857857
'',
858858
[ 'x', 1 ],
859859
[ 'y', 2 ],
860-
[ 'prototype', [ 'REF', 2 ] ] ],
860+
[ '[prototype]', [ 'REF', 2 ] ] ],
861861
'6':
862862
[ 'INSTANCE',
863863
'',
864864
[ 'x', 2 ],
865865
[ 'y', 3 ],
866-
[ 'prototype', [ 'REF', 2 ] ] ],
866+
[ '[prototype]', [ 'REF', 2 ] ] ],
867867
'7':
868868
[ 'INSTANCE',
869869
'',
870870
[ 'x', 3 ],
871871
[ 'y', 5 ],
872-
[ 'prototype', [ 'REF', 2 ] ] ] } },
872+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
873873
{ stdout: '',
874874
func_name: '',
875875
stack_to_render: [],
@@ -911,19 +911,19 @@
911911
'',
912912
[ 'x', 1 ],
913913
[ 'y', 2 ],
914-
[ 'prototype', [ 'REF', 2 ] ] ],
914+
[ '[prototype]', [ 'REF', 2 ] ] ],
915915
'6':
916916
[ 'INSTANCE',
917917
'',
918918
[ 'x', 2 ],
919919
[ 'y', 3 ],
920-
[ 'prototype', [ 'REF', 2 ] ] ],
920+
[ '[prototype]', [ 'REF', 2 ] ] ],
921921
'7':
922922
[ 'INSTANCE',
923923
'',
924924
[ 'x', 3 ],
925925
[ 'y', 5 ],
926-
[ 'prototype', [ 'REF', 2 ] ] ] } },
926+
[ '[prototype]', [ 'REF', 2 ] ] ] } },
927927
{ stdout: '{ x: 3, y: 5 }\n',
928928
func_name: '',
929929
stack_to_render: [],
@@ -965,16 +965,16 @@
965965
'',
966966
[ 'x', 1 ],
967967
[ 'y', 2 ],
968-
[ 'prototype', [ 'REF', 2 ] ] ],
968+
[ '[prototype]', [ 'REF', 2 ] ] ],
969969
'6':
970970
[ 'INSTANCE',
971971
'',
972972
[ 'x', 2 ],
973973
[ 'y', 3 ],
974-
[ 'prototype', [ 'REF', 2 ] ] ],
974+
[ '[prototype]', [ 'REF', 2 ] ] ],
975975
'7':
976976
[ 'INSTANCE',
977977
'',
978978
[ 'x', 3 ],
979979
[ 'y', 5 ],
980-
[ 'prototype', [ 'REF', 2 ] ] ] } } ] }
980+
[ '[prototype]', [ 'REF', 2 ] ] ] } } ] }

0 commit comments

Comments
 (0)