Commit 7290a90 1 parent 6acbde7 commit 7290a90 Copy full SHA for 7290a90
File tree 3 files changed +12
-30
lines changed
3 files changed +12
-30
lines changed Original file line number Diff line number Diff line change @@ -44,10 +44,10 @@ test('serialize static data', t => {
44
44
body : '{"@qclass":"-Infinity"}' ,
45
45
slots : [ ] ,
46
46
} ) ;
47
- t . deepEqual ( ser ( Symbol . for ( 'sym1' ) ) , {
48
- body : '{"@qclass":"symbol","key":"sym1"}' ,
49
- slots : [ ] ,
50
- } ) ;
47
+ // t.deepEqual(ser(Symbol.for('sym1')), {
48
+ // body: '{"@qclass ":"symbol","key":"sym1"}',
49
+ // slots: [],
50
+ // });
51
51
let bn ;
52
52
try {
53
53
bn = BigInt ( 4 ) ;
@@ -91,7 +91,7 @@ test('unserialize static data', t => {
91
91
t . ok ( Object . is ( uns ( '{"@qclass":"NaN"}' ) , NaN ) ) ;
92
92
t . deepEqual ( uns ( '{"@qclass":"Infinity"}' ) , Infinity ) ;
93
93
t . deepEqual ( uns ( '{"@qclass":"-Infinity"}' ) , - Infinity ) ;
94
- t . deepEqual ( uns ( '{"@qclass":"symbol", "key":"sym1"}' ) , Symbol . for ( 'sym1' ) ) ;
94
+ // t.deepEqual(uns('{"@qclass ":"symbol", "key":"sym1"}'), Symbol.for('sym1'));
95
95
96
96
// Normal json reviver cannot make properties with undefined values
97
97
t . deepEqual ( uns ( '[{"@qclass":"undefined"}]' ) , [ undefined ] ) ;
Original file line number Diff line number Diff line change @@ -169,7 +169,7 @@ export function sameValueZero(x, y) {
169
169
170
170
// How would val be passed? For primitive values, the answer is
171
171
// * 'null' for null
172
- // * throwing an error for an unregistered symbol
172
+ // * throwing an error for a symbol, whether registered or not.
173
173
// * that value's typeof string for all other primitive values
174
174
// For frozen objects, the possible answers
175
175
// * 'copyRecord' for non-empty records with only data properties
@@ -225,10 +225,7 @@ export function passStyleOf(val) {
225
225
return typestr ;
226
226
}
227
227
case 'symbol' : {
228
- if ( Symbol . keyFor ( val ) === undefined ) {
229
- throw new TypeError ( 'Cannot pass unregistered symbols' ) ;
230
- }
231
- return typestr ;
228
+ throw new TypeError ( 'Cannot pass symbols' ) ;
232
229
}
233
230
default : {
234
231
throw new TypeError ( `unrecognized typeof ${ typestr } ` ) ;
@@ -364,13 +361,6 @@ export function makeMarshal(
364
361
}
365
362
return val ;
366
363
}
367
- case 'symbol' : {
368
- const key = Symbol . keyFor ( val ) ;
369
- return harden ( {
370
- [ QCLASS ] : 'symbol' ,
371
- key,
372
- } ) ;
373
- }
374
364
case 'bigint' : {
375
365
return harden ( {
376
366
[ QCLASS ] : 'bigint' ,
@@ -498,14 +488,6 @@ export function makeMarshal(
498
488
case '-Infinity' : {
499
489
return - Infinity ;
500
490
}
501
- case 'symbol' : {
502
- if ( typeof rawTree . key !== 'string' ) {
503
- throw new TypeError (
504
- `invalid symbol key typeof ${ typeof rawTree . key } ` ,
505
- ) ;
506
- }
507
- return Symbol . for ( rawTree . key ) ;
508
- }
509
491
case 'bigint' : {
510
492
if ( typeof rawTree . digits !== 'string' ) {
511
493
throw new TypeError (
Original file line number Diff line number Diff line change @@ -29,10 +29,10 @@ test('serialize static data', t => {
29
29
body : '{"@qclass":"-Infinity"}' ,
30
30
slots : [ ] ,
31
31
} ) ;
32
- t . deepEqual ( ser ( Symbol . for ( 'sym1' ) ) , {
33
- body : '{"@qclass":"symbol","key":"sym1"}' ,
34
- slots : [ ] ,
35
- } ) ;
32
+ // t.deepEqual(ser(Symbol.for('sym1')), {
33
+ // body: '{"@qclass ":"symbol","key":"sym1"}',
34
+ // slots: [],
35
+ // });
36
36
let bn ;
37
37
try {
38
38
bn = BigInt ( 4 ) ;
@@ -80,7 +80,7 @@ test('unserialize static data', t => {
80
80
t . ok ( Object . is ( uns ( '{"@qclass":"NaN"}' ) , NaN ) ) ;
81
81
t . deepEqual ( uns ( '{"@qclass":"Infinity"}' ) , Infinity ) ;
82
82
t . deepEqual ( uns ( '{"@qclass":"-Infinity"}' ) , - Infinity ) ;
83
- t . deepEqual ( uns ( '{"@qclass":"symbol", "key":"sym1"}' ) , Symbol . for ( 'sym1' ) ) ;
83
+ // t.deepEqual(uns('{"@qclass ":"symbol", "key":"sym1"}'), Symbol.for('sym1'));
84
84
85
85
// Normal json reviver cannot make properties with undefined values
86
86
t . deepEqual ( uns ( '[{"@qclass":"undefined"}]' ) , [ undefined ] ) ;
You can’t perform that action at this time.
0 commit comments