Browse Source

+ added parser support for the 'suspending' directive

Nikolay Nikolov 2 năm trước cách đây
mục cha
commit
95d7bdc3da
3 tập tin đã thay đổi với 11 bổ sung2 xóa
  1. 5 0
      compiler/pdecsub.pas
  2. 4 2
      compiler/symconst.pas
  3. 2 0
      compiler/tokens.pas

+ 5 - 0
compiler/pdecsub.pas

@@ -2401,6 +2401,11 @@ begin
              else
                import_nr:=longint(v.svalue);
            end;
+          if (target_info.system in systems_wasm) and (idtoken=_SUSPENDING) then
+           begin
+             consume(_SUSPENDING);
+             include(procoptions,po_wasm_suspending);
+           end;
           { default is to used the realname of the procedure }
           if (import_nr=0) and not assigned(import_name) then
             begin

+ 4 - 2
compiler/symconst.pas

@@ -452,7 +452,8 @@ type
       means it cannot be stored in linear memory or have its address taken. It can
       however be stored in WebAssembly globals, locals, used in function parameters
       and returns and it can be called.) }
-    po_wasm_funcref
+    po_wasm_funcref,
+    po_wasm_suspending
   );
   tprocoptions=set of tprocoption;
 
@@ -1120,7 +1121,8 @@ inherited_objectoptions : tobjectoptions = [oo_has_virtual,oo_has_private,oo_has
       'C-style array-of-const', {po_variadic}
       'objc-related-result-type', {po_objc_related_result_type}
       'po_anonymous', {po_anonymous}
-      '"WASMFUNCREF"' {po_wasm_funcref}
+      '"WASMFUNCREF"', {po_wasm_funcref}
+      '"SUSPENDING"' {po_wasm_suspending}
     );
 
 implementation

+ 2 - 0
compiler/tokens.pas

@@ -291,6 +291,7 @@ type
     _OPENSTRING,
     _RIGHTSHIFT,
     _SPECIALIZE,
+    _SUSPENDING,
     _VECTORCALL,
     _CONSTRUCTOR,
     _GREATERTHAN,
@@ -634,6 +635,7 @@ const
       (str:'OPENSTRING'    ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'RIGHTSHIFT'    ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
       (str:'SPECIALIZE'    ;special:false;keyword:[m_none];op:NOTOKEN),
+      (str:'SUSPENDING'    ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'VECTORCALL'    ;special:false;keyword:[m_none];op:NOTOKEN),
       (str:'CONSTRUCTOR'   ;special:false;keyword:alllanguagemodes-[m_iso,m_extpas];op:NOTOKEN),
       (str:'GREATERTHAN'   ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }