@@ -371,19 +371,56 @@ class NQP::World is HLL::World {
371
371
372
372
# Associates a signature with a routine.
373
373
method set_routine_signature ($ routine , $ types , $ definednesses ) {
374
- # Fixup code depends on if we have the routine in the SC for
375
- # fixing up. Deserialization always goes on the blockref.
376
- my $ fixup := PAST::Op. new ( : pirop(' set_sub_multisig vPPP' ), $ types , $ definednesses );
377
- if pir:: defined ($ routine <compile_time_dummy >) {
378
- $ fixup . unshift (self . get_slot_past_for_object($ routine <compile_time_dummy >));
374
+ # Build signature object and put it in place now.
375
+ my $ sig_type := self . find_sym([' NQPSignature' ]);
376
+ my $ sig_obj := nqp ::create($ sig_type );
377
+ nqp ::bindattr($ sig_obj , $ sig_type , ' $!types' , $ types );
378
+ nqp ::bindattr($ sig_obj , $ sig_type , ' $!definednesses' , $ definednesses );
379
+ my $ slot := self . add_object($ sig_obj );
380
+
381
+ if self . is_precompilation_mode() {
382
+ unless $ NEW_SER {
383
+ my $ types_past := PAST::Op. new ( : pasttype(' list' ) );
384
+ my $ definednesses_past := PAST::Op. new ( : pasttype(' list' ) );
385
+ for $ types {
386
+ $ types_past . push (pir:: isa ($ _ , ' Undef' ) ?? $ _ !! self . get_ref($ _ ));
387
+ }
388
+ for $ definednesses {
389
+ $ definednesses_past . push ($ _ );
390
+ }
391
+ self . add_fixup_task(: deserialize_past(PAST::Stmts. new (
392
+ self . add_object_to_cur_sc_past($ slot ,
393
+ PAST::Op. new ( : pirop(' repr_instance_of__PP' ), self . get_ref($ sig_type ) )),
394
+ PAST::Op. new ( : pirop(' setattribute__vPPsP' ),
395
+ self . get_ref($ sig_obj ),
396
+ self . get_ref($ sig_type ),
397
+ ' $!types' ,
398
+ $ types_past ),
399
+ PAST::Op. new ( : pirop(' setattribute__vPPsP' ),
400
+ self . get_ref($ sig_obj ),
401
+ self . get_ref($ sig_type ),
402
+ ' $!definednesses' ,
403
+ $ definednesses_past )
404
+ )));
405
+ }
406
+ self . add_fixup_task(: deserialize_past(PAST::Op. new (
407
+ : pirop(' set_sub_multisig vPP' ),
408
+ PAST::Val. new ( : value($ routine ) ),
409
+ self . get_ref($ sig_obj )
410
+ )));
379
411
}
380
412
else {
381
- $ fixup . unshift (PAST::Val. new ( : value($ routine ) ));
413
+ # Fixup code depends on if we have the routine in the SC for
414
+ # fixing up.
415
+ my $ fixup := PAST::Op. new ( : pirop(' set_sub_multisig vPP' ), self . get_ref($ sig_obj ) );
416
+ if pir:: defined ($ routine <compile_time_dummy >) {
417
+ $ fixup . unshift (self . get_slot_past_for_object($ routine <compile_time_dummy >));
418
+ }
419
+ else {
420
+ $ fixup . unshift (PAST::Val. new ( : value($ routine ) ));
421
+ }
422
+ self . add_fixup_task(: fixup_past($ fixup ));
382
423
}
383
- my $ des := PAST::Op. new ( : pirop(' set_sub_multisig vPPP' ),
384
- PAST::Val. new ( : value($ routine ) ), $ types , $ definednesses
385
- );
386
- self . add_fixup_task(: deserialize_past($ des ), : fixup_past($ fixup ));
387
424
}
388
425
389
426
# This handles associating the role body with a role declaration.
@@ -575,7 +612,7 @@ class NQP::World is HLL::World {
575
612
method known_sym ($/ , @ name ) {
576
613
my $ known := 0 ;
577
614
try {
578
- self . find_sym(@ name , $/ );
615
+ self . find_sym(@ name );
579
616
$ known := 1 ;
580
617
}
581
618
$ known
@@ -584,9 +621,9 @@ class NQP::World is HLL::World {
584
621
# Finds a symbol that has a known value at compile time from the
585
622
# perspective of the current scope. Checks for lexicals, then if
586
623
# that fails tries package lookup.
587
- method find_sym (@ name , $/ ) {
624
+ method find_sym (@ name ) {
588
625
# Make sure it's not an empty name.
589
- unless + @ name { $/ . CURSOR . panic (" Cannot look up empty name" ); }
626
+ unless + @ name { pir::die (" Cannot look up empty name" ); }
590
627
591
628
# If it's a single-part name, look through the lexical
592
629
# scopes.
0 commit comments