Browse Source

+ added parser support for the 'suspending' directive

Nikolay Nikolov 2 years ago
parent
commit
95d7bdc3da
3 changed files with 11 additions and 2 deletions
  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
              else
                import_nr:=longint(v.svalue);
                import_nr:=longint(v.svalue);
            end;
            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 }
           { default is to used the realname of the procedure }
           if (import_nr=0) and not assigned(import_name) then
           if (import_nr=0) and not assigned(import_name) then
             begin
             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
       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
       however be stored in WebAssembly globals, locals, used in function parameters
       and returns and it can be called.) }
       and returns and it can be called.) }
-    po_wasm_funcref
+    po_wasm_funcref,
+    po_wasm_suspending
   );
   );
   tprocoptions=set of tprocoption;
   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}
       'C-style array-of-const', {po_variadic}
       'objc-related-result-type', {po_objc_related_result_type}
       'objc-related-result-type', {po_objc_related_result_type}
       'po_anonymous', {po_anonymous}
       'po_anonymous', {po_anonymous}
-      '"WASMFUNCREF"' {po_wasm_funcref}
+      '"WASMFUNCREF"', {po_wasm_funcref}
+      '"SUSPENDING"' {po_wasm_suspending}
     );
     );
 
 
 implementation
 implementation

+ 2 - 0
compiler/tokens.pas

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