Răsfoiți Sursa

Make all type-2 opcode parsers concrete to avoid type limit

We're hitting up against the type limit on this gigantic parser type, and
it's only going to get worse as we implement more and more of the opcodes.
We solve(?) this by making each individual parser concrete before choice!-ing
them all together, but I wonder if there's a way we could do this
automatically within the choice macro or something?
Isaac Woods 4 ani în urmă
părinte
comite
28e46b3cd2
1 a modificat fișierele cu 12 adăugiri și 10 ștergeri
  1. 12 10
      aml/src/type2.rs

+ 12 - 10
aml/src/type2.rs

@@ -38,20 +38,22 @@ where
      *
      * NOTE: MethodInvocation should always appear last in the choice.
      */
+    // TODO: we're struggling a little with the type limit here, is there a better way than making everything
+    // concrete?
     make_parser_concrete!(comment_scope(
         DebugVerbosity::AllScopes,
         "Type2Opcode",
         choice!(
-            def_and(),
-            def_buffer(),
-            def_l_equal(),
-            def_l_greater(),
-            def_l_or(),
-            def_package(),
-            def_shift_left(),
-            def_shift_right(),
-            def_store(),
-            method_invocation()
+            make_parser_concrete!(def_and()),
+            make_parser_concrete!(def_buffer()),
+            make_parser_concrete!(def_l_equal()),
+            make_parser_concrete!(def_l_greater()),
+            make_parser_concrete!(def_l_or()),
+            make_parser_concrete!(def_package()),
+            make_parser_concrete!(def_shift_left()),
+            make_parser_concrete!(def_shift_right()),
+            make_parser_concrete!(def_store()),
+            make_parser_concrete!(method_invocation())
         ),
     ))
 }