Browse Source

+ print a proper error message if a suspending external is used on a non-WebAssembly platform

Nikolay Nikolov 2 years ago
parent
commit
8acf2e3ff3
4 changed files with 427 additions and 400 deletions
  1. 2 1
      compiler/msg/errore.msg
  2. 3 2
      compiler/msgidx.inc
  3. 397 397
      compiler/msgtxt.inc
  4. 25 0
      compiler/pdecsub.pas

+ 2 - 1
compiler/msg/errore.msg

@@ -445,7 +445,7 @@ scan_e_unexpected_endif=02108_E_$ENDIF directive found without a matching $IF(N)
 #
 # Parser
 #
-# 03367 is the last used one
+# 03368 is the last used one
 #
 % \section{Parser messages}
 % This section lists all parser messages. The parser takes care of the
@@ -1646,6 +1646,7 @@ parser_w_ignoring_published_property=03365_W_This property will not be published
 % Declarations like \var{var i: Integer absolute i;} are not allowed
 parser_e_wasm_ref_types_can_only_be_passed_by_value=03366_E_WebAssembly reference types can only be passed by value
 parser_e_promising_exports_not_supported_on_current_platform=03367_E_Declaring exports as 'promising' is WebAssembly-specific and is not supported on the current platform
+parser_e_suspending_externals_not_supported_on_current_platform=03368_E_Declaring externals as 'suspending' is WebAssembly-specific and is not supported on the current platform
 %
 % \end{description}
 %

+ 3 - 2
compiler/msgidx.inc

@@ -481,6 +481,7 @@ const
   parser_w_ignoring_published_property=03365;
   parser_e_wasm_ref_types_can_only_be_passed_by_value=03366;
   parser_e_promising_exports_not_supported_on_current_platform=03367;
+  parser_e_suspending_externals_not_supported_on_current_platform=03368;
   type_e_mismatch=04000;
   type_e_incompatible_types=04001;
   type_e_not_equal_types=04002;
@@ -1160,9 +1161,9 @@ const
   option_info=11024;
   option_help_pages=11025;
 
-  MsgTxtSize = 90851;
+  MsgTxtSize = 90964;
 
   MsgIdxMax : array[1..20] of longint=(
-    28,109,368,133,100,63,148,38,223,71,
+    28,109,369,133,100,63,148,38,223,71,
     65,20,30,1,1,1,1,1,1,1
   );

File diff suppressed because it is too large
+ 397 - 397
compiler/msgtxt.inc


+ 25 - 0
compiler/pdecsub.pas

@@ -2401,6 +2401,31 @@ begin
              else
                import_nr:=longint(v.svalue);
            end;
+          if (idtoken=_SUSPENDING) then
+           begin
+             if (target_info.system in systems_wasm) then
+              begin
+                consume(_SUSPENDING);
+                include(procoptions,po_wasm_suspending);
+                synthetickind:=tsk_wasm_suspending_first;
+                if idtoken=_FIRST then
+                  consume(_FIRST)
+                else if idtoken=_LAST then
+                  begin
+                    consume(_LAST);
+                    synthetickind:=tsk_wasm_suspending_last;
+                  end;
+              end
+             else
+              begin
+                message(parser_e_suspending_externals_not_supported_on_current_platform);
+                consume(_SUSPENDING);
+                if idtoken=_FIRST then
+                  consume(_FIRST)
+                else if idtoken=_LAST then
+                  consume(_LAST);
+              end;
+           end;
           if (target_info.system in systems_wasm) and (idtoken=_SUSPENDING) then
            begin
              consume(_SUSPENDING);

Some files were not shown because too many files changed in this diff