+ also allow declaring an external as 'suspending first'

This commit is contained in:
Nikolay Nikolov 2023-06-13 09:56:44 +03:00
parent 0f89852908
commit 4d62764fa3
3 changed files with 39 additions and 1 deletions

View File

@ -2406,7 +2406,9 @@ begin
consume(_SUSPENDING);
include(procoptions,po_wasm_suspending);
synthetickind:=tsk_wasm_suspending;
if idtoken=_LAST then
if idtoken=_FIRST then
consume(_FIRST)
else if idtoken=_LAST then
begin
consume(_LAST);
synthetickind:=tsk_wasm_suspending_last;

View File

@ -163,6 +163,7 @@ type
_EQUAL,
_FAR16,
_FINAL,
_FIRST,
_INDEX,
_LABEL,
_LOCAL,
@ -509,6 +510,7 @@ const
(str:'EQUAL' ;special:false;keyword:[m_none];op:NOTOKEN), { delphi operator name }
(str:'FAR16' ;special:false;keyword:[m_none];op:NOTOKEN),
(str:'FINAL' ;special:false;keyword:[m_none];op:NOTOKEN),
(str:'FIRST' ;special:false;keyword:[m_none];op:NOTOKEN),
(str:'INDEX' ;special:false;keyword:[m_none];op:NOTOKEN),
(str:'LABEL' ;special:false;keyword:alllanguagemodes;op:NOTOKEN),
(str:'LOCAL' ;special:false;keyword:[m_none];op:NOTOKEN),

View File

@ -0,0 +1,34 @@
{ %cpu=wasm32 }
{ %norun }
library tjspromise1;
var
state: double;
function init_state: double; external 'js';
function compute_delta: double; external 'js' suspending first;
procedure init;
begin
state := init_state;
end;
function get_state: double;
begin
get_state := state;
end;
function update_state: double;
begin
state := state + compute_delta;
update_state := state;
end;
exports
get_state,
update_state promising;
begin
init;
end.