mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-01 16:10:18 +02:00
+ also allow declaring an external as 'suspending first'
This commit is contained in:
parent
0f89852908
commit
4d62764fa3
@ -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;
|
||||
|
@ -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),
|
||||
|
34
tests/test/wasm/tjspromise1a.pp
Normal file
34
tests/test/wasm/tjspromise1a.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user