|
@@ -32232,6 +32232,7 @@ begin
|
|
|
' Run;',
|
|
|
' Run(3);',
|
|
|
'']);
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
ConvertProgram;
|
|
|
CheckSource('TestAsync_Proc',
|
|
|
LinesToStr([ // statements
|
|
@@ -32296,6 +32297,7 @@ begin
|
|
|
' if Fly()=p then ;',
|
|
|
' end;',
|
|
|
'']);
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
ConvertProgram;
|
|
|
CheckSource('TestAsync_CallResultIsPromise',
|
|
|
LinesToStr([ // statements
|
|
@@ -32454,6 +32456,7 @@ begin
|
|
|
LinesToStr([
|
|
|
'$mod.Run(1);'
|
|
|
]));
|
|
|
+ SetExpectedPasResolverError('Await without promise',nAwaitWithoutPromise);
|
|
|
end;
|
|
|
|
|
|
procedure TTestModule.TestAWait_ExternalClassPromise;
|
|
@@ -32502,17 +32505,18 @@ begin
|
|
|
'']),
|
|
|
LinesToStr([
|
|
|
]));
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
end;
|
|
|
|
|
|
procedure TTestModule.TestAsync_AnonymousProc;
|
|
|
begin
|
|
|
StartProgram(false);
|
|
|
Add([
|
|
|
+ '{$mode objfpc}',
|
|
|
'{$modeswitch externalclass}',
|
|
|
'type',
|
|
|
' TJSPromise = class external name ''Promise''',
|
|
|
' end;',
|
|
|
- '{$mode objfpc}',
|
|
|
'type',
|
|
|
' TFunc = reference to function(x: double): word; async;',
|
|
|
'function Crawl(d: double = 1.3): word; async;',
|
|
@@ -32544,6 +32548,7 @@ begin
|
|
|
'$mod.Func = async function (c) {',
|
|
|
'};',
|
|
|
'']));
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
end;
|
|
|
|
|
|
procedure TTestModule.TestAsync_ProcType;
|
|
@@ -32561,6 +32566,11 @@ begin
|
|
|
'procedure Run(e:longint); async;',
|
|
|
'begin',
|
|
|
'end;',
|
|
|
+ 'procedure Fly(p: TProc); async;',
|
|
|
+ 'begin',
|
|
|
+ ' await(p);',
|
|
|
+ ' await(p());',
|
|
|
+ 'end;',
|
|
|
'var',
|
|
|
' RefFunc: TRefFunc;',
|
|
|
' Func: TFunc;',
|
|
@@ -32581,6 +32591,7 @@ begin
|
|
|
' if Proc=ProcB then ;',
|
|
|
' ']);
|
|
|
ConvertProgram;
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
CheckSource('TestAsync_ProcType',
|
|
|
LinesToStr([ // statements
|
|
|
'this.Crawl = async function (d) {',
|
|
@@ -32589,6 +32600,10 @@ begin
|
|
|
'};',
|
|
|
'this.Run = async function (e) {',
|
|
|
'};',
|
|
|
+ 'this.Fly = async function (p) {',
|
|
|
+ ' await p(7);',
|
|
|
+ ' await p(7);',
|
|
|
+ '};',
|
|
|
'this.RefFunc = null;',
|
|
|
'this.Func = null;',
|
|
|
'this.Proc = null;',
|
|
@@ -32697,6 +32712,7 @@ begin
|
|
|
'']),
|
|
|
LinesToStr([
|
|
|
'']));
|
|
|
+ CheckResolverUnexpectedHints();
|
|
|
end;
|
|
|
|
|
|
|