mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-28 10:19:27 +02:00
* disallow WebAssembly reference types to be declared as var, constref or out parameters
This commit is contained in:
parent
c04c513a5d
commit
773b36c21e
@ -445,7 +445,7 @@ scan_e_unexpected_endif=02108_E_$ENDIF directive found without a matching $IF(N)
|
||||
#
|
||||
# Parser
|
||||
#
|
||||
# 03365 is the last used one
|
||||
# 03366 is the last used one
|
||||
#
|
||||
% \section{Parser messages}
|
||||
% This section lists all parser messages. The parser takes care of the
|
||||
@ -1644,6 +1644,7 @@ parser_w_ignoring_published_property=03365_W_This property will not be published
|
||||
% On a certain target, not all syntax variants of the syscall directive make sense and thus those making
|
||||
% no sense are not supported
|
||||
% 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
|
||||
%
|
||||
% \end{description}
|
||||
%
|
||||
|
@ -479,6 +479,7 @@ const
|
||||
parser_e_absolute_sym_cannot_reference_itself=03363;
|
||||
parser_e_syscall_format_not_support=03364;
|
||||
parser_w_ignoring_published_property=03365;
|
||||
parser_e_wasm_ref_types_can_only_be_passed_by_value=03366;
|
||||
type_e_mismatch=04000;
|
||||
type_e_incompatible_types=04001;
|
||||
type_e_not_equal_types=04002;
|
||||
@ -1159,9 +1160,9 @@ const
|
||||
option_info=11024;
|
||||
option_help_pages=11025;
|
||||
|
||||
MsgTxtSize = 90752;
|
||||
MsgTxtSize = 90816;
|
||||
|
||||
MsgIdxMax : array[1..20] of longint=(
|
||||
28,109,366,134,100,63,148,38,223,71,
|
||||
28,109,367,134,100,63,148,38,223,71,
|
||||
65,20,30,1,1,1,1,1,1,1
|
||||
);
|
||||
|
1241
compiler/msgtxt.inc
1241
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -510,6 +510,10 @@ implementation
|
||||
if explicit_paraloc then
|
||||
Message(parser_e_paraloc_all_paras);
|
||||
end;
|
||||
{$ifdef wasm}
|
||||
if (vs.varspez in [vs_var,vs_constref,vs_out]) and is_wasm_reference_type(vs.vardef) then
|
||||
Message(parser_e_wasm_ref_types_can_only_be_passed_by_value);
|
||||
{$endif wasm}
|
||||
end;
|
||||
until not try_to_consume(_SEMICOLON);
|
||||
|
||||
|
@ -43,6 +43,10 @@ begin
|
||||
testproc6 := nil <> q;
|
||||
end;
|
||||
|
||||
procedure testproc7(const q: WasmExternRef);
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
testproc5(nil);
|
||||
end.
|
||||
|
12
tests/test/wasm/twasmexternref4.pp
Normal file
12
tests/test/wasm/twasmexternref4.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ %cpu=wasm32 }
|
||||
{ %fail }
|
||||
|
||||
program twasmexternref4;
|
||||
|
||||
{ WasmExternRef cannot be declared a var parameter }
|
||||
procedure testproc(var p: WasmExternRef);
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
12
tests/test/wasm/twasmexternref4a.pp
Normal file
12
tests/test/wasm/twasmexternref4a.pp
Normal file
@ -0,0 +1,12 @@
|
||||
{ %cpu=wasm32 }
|
||||
{ %fail }
|
||||
|
||||
program twasmexternref4a;
|
||||
|
||||
{ WasmExternRef cannot be declared a constref parameter }
|
||||
procedure testproc(constref p: WasmExternRef);
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
14
tests/test/wasm/twasmexternref4b.pp
Normal file
14
tests/test/wasm/twasmexternref4b.pp
Normal file
@ -0,0 +1,14 @@
|
||||
{ %cpu=wasm32 }
|
||||
{ %fail }
|
||||
|
||||
program twasmexternref4a;
|
||||
|
||||
{$MODE objfpc}
|
||||
|
||||
{ WasmExternRef cannot be declared an out parameter }
|
||||
procedure testproc(out p: WasmExternRef);
|
||||
begin
|
||||
end;
|
||||
|
||||
begin
|
||||
end.
|
Loading…
Reference in New Issue
Block a user