tests/Symbol/Table/Shared: lookup shared symbols in catalog
authorMichael Wallner <mike@php.net>
Mon, 27 Dec 2021 13:47:27 +0000 (14:47 +0100)
committerMichael Wallner <mike@php.net>
Fri, 31 Dec 2021 08:18:12 +0000 (09:18 +0100)
tests/Symbol/Table/Shared.phpt

index 8740f0177eec7875a7917dbbb4834b026f252eb6..4227bdd1f54b08b096b1c3ffaa53ec59808fe916 100644 (file)
@@ -28,7 +28,15 @@ foreach (str_split($buf, 8) as $line) {
 echo "\n";
 
 $u = new ion\Unserializer\PHP(multiSequence: true);
-var_dump($u->unserialize($buf));
+var_dump($s = $u->unserialize($buf));
+
+foreach ($s as $sym) {
+       /** @var ion\Symbol $sym */
+       $t = $c->findBest($sym->importLocation->name);
+       $r = $t->findLocal($sym->importLocation->location);
+       printf("%s: %s@%d\n", $r->value, $sym->importLocation->name,
+               $sym->importLocation->location);
+}
 
 $u = new ion\Unserializer\PHP(multiSequence: true,
        readerOptions: new ion\Reader\Options(
@@ -104,6 +112,10 @@ array(4) {
     }
   }
 }
+shared1: shared@1
+shared1: shared@1
+shared2: shared@2
+shared2: shared@2
 on_context_change
 array(4) {
   [0]=>