浏览代码

+ added parser support for the 'suspending' directive

Nikolay Nikolov 2 年之前
父节点
当前提交
95d7bdc3da
共有 3 个文件被更改,包括 11 次插入2 次删除
  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 }