mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-15 08:49:25 +02:00
+ disallow WebAssembly reference types in records, objects and classes
This commit is contained in:
parent
8ac46ed38c
commit
fce34eb4bf
@ -2119,7 +2119,7 @@ type_e_cannot_take_address_of_wasm_externref=04132_E_Cannot take the address of
|
|||||||
#
|
#
|
||||||
# Symtable
|
# Symtable
|
||||||
#
|
#
|
||||||
# 05099 is the last used one
|
# 05101 is the last used one
|
||||||
#
|
#
|
||||||
% \section{Symbol handling}
|
% \section{Symbol handling}
|
||||||
% This section lists all the messages that concern the handling of symbols.
|
% This section lists all the messages that concern the handling of symbols.
|
||||||
@ -2443,6 +2443,7 @@ sym_e_symbol_no_capture=05099_E_Symbol "$1" can not be captured
|
|||||||
sym_f_systemunitnotloaded=05100_F_System unit not loaded.
|
sym_f_systemunitnotloaded=05100_F_System unit not loaded.
|
||||||
% The compiler used a function that requires the system unit to be loaded,
|
% The compiler used a function that requires the system unit to be loaded,
|
||||||
% but it was not yet loaded. This is an internal compiler error and must be reported.
|
% but it was not yet loaded. This is an internal compiler error and must be reported.
|
||||||
|
sym_e_wasm_ref_types_cannot_be_used_in_records=05101_E_WebAssembly reference types cannot be used inside records, objects, or classes
|
||||||
%
|
%
|
||||||
% \end{description}
|
% \end{description}
|
||||||
#
|
#
|
||||||
|
@ -692,6 +692,7 @@ const
|
|||||||
sym_e_type_must_be_rec_or_object=05098;
|
sym_e_type_must_be_rec_or_object=05098;
|
||||||
sym_e_symbol_no_capture=05099;
|
sym_e_symbol_no_capture=05099;
|
||||||
sym_f_systemunitnotloaded=05100;
|
sym_f_systemunitnotloaded=05100;
|
||||||
|
sym_e_wasm_ref_types_cannot_be_used_in_records=05101;
|
||||||
cg_e_parasize_too_big=06009;
|
cg_e_parasize_too_big=06009;
|
||||||
cg_e_file_must_call_by_reference=06012;
|
cg_e_file_must_call_by_reference=06012;
|
||||||
cg_e_cant_use_far_pointer_there=06013;
|
cg_e_cant_use_far_pointer_there=06013;
|
||||||
@ -1165,9 +1166,9 @@ const
|
|||||||
option_info=11024;
|
option_info=11024;
|
||||||
option_help_pages=11025;
|
option_help_pages=11025;
|
||||||
|
|
||||||
MsgTxtSize = 91385;
|
MsgTxtSize = 91472;
|
||||||
|
|
||||||
MsgIdxMax : array[1..20] of longint=(
|
MsgIdxMax : array[1..20] of longint=(
|
||||||
28,109,369,133,101,63,148,38,223,71,
|
28,109,369,133,102,63,148,38,223,71,
|
||||||
68,20,30,1,1,1,1,1,1,1
|
68,20,30,1,1,1,1,1,1,1
|
||||||
);
|
);
|
||||||
|
1075
compiler/msgtxt.inc
1075
compiler/msgtxt.inc
File diff suppressed because it is too large
Load Diff
@ -57,7 +57,7 @@ implementation
|
|||||||
systems,
|
systems,
|
||||||
{ symtable }
|
{ symtable }
|
||||||
symconst,symbase,defutil,defcmp,symutil,symcreat,
|
symconst,symbase,defutil,defcmp,symutil,symcreat,
|
||||||
{$if defined(i386) or defined(i8086)}
|
{$if defined(i386) or defined(i8086) or defined(wasm)}
|
||||||
symcpu,
|
symcpu,
|
||||||
{$endif}
|
{$endif}
|
||||||
fmodule,htypechk,procdefutil,
|
fmodule,htypechk,procdefutil,
|
||||||
@ -1779,6 +1779,10 @@ implementation
|
|||||||
|
|
||||||
read_anon_type(hdef,false);
|
read_anon_type(hdef,false);
|
||||||
maybe_guarantee_record_typesym(hdef,symtablestack.top);
|
maybe_guarantee_record_typesym(hdef,symtablestack.top);
|
||||||
|
{$ifdef wasm}
|
||||||
|
if is_wasm_reference_type(hdef) then
|
||||||
|
messagepos(typepos,sym_e_wasm_ref_types_cannot_be_used_in_records);
|
||||||
|
{$endif wasm}
|
||||||
block_type:=bt_var;
|
block_type:=bt_var;
|
||||||
{ allow only static fields reference to struct where they are declared }
|
{ allow only static fields reference to struct where they are declared }
|
||||||
if not (vd_class in options) then
|
if not (vd_class in options) then
|
||||||
|
13
tests/test/wasm/twasmexternref5.pp
Normal file
13
tests/test/wasm/twasmexternref5.pp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmexternref5;
|
||||||
|
|
||||||
|
type
|
||||||
|
TRec = record
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: WasmExternRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
13
tests/test/wasm/twasmexternref5a.pp
Normal file
13
tests/test/wasm/twasmexternref5a.pp
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmexternref5a;
|
||||||
|
|
||||||
|
type
|
||||||
|
TRec = object
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: WasmExternRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
15
tests/test/wasm/twasmexternref5b.pp
Normal file
15
tests/test/wasm/twasmexternref5b.pp
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmexternref5b;
|
||||||
|
|
||||||
|
{$MODE objfpc}
|
||||||
|
|
||||||
|
type
|
||||||
|
TRec = class
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: WasmExternRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
14
tests/test/wasm/twasmfuncref2.pp
Normal file
14
tests/test/wasm/twasmfuncref2.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmfuncref2;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef;
|
||||||
|
TRec = record
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: TWasmFuncRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
14
tests/test/wasm/twasmfuncref2a.pp
Normal file
14
tests/test/wasm/twasmfuncref2a.pp
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmfuncref2a;
|
||||||
|
|
||||||
|
type
|
||||||
|
TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef;
|
||||||
|
TRec = object
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: TWasmFuncRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
16
tests/test/wasm/twasmfuncref2b.pp
Normal file
16
tests/test/wasm/twasmfuncref2b.pp
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{ %cpu=wasm32 }
|
||||||
|
{ %fail }
|
||||||
|
|
||||||
|
program twasmfuncref2b;
|
||||||
|
|
||||||
|
{$MODE objfpc}
|
||||||
|
|
||||||
|
type
|
||||||
|
TWasmFuncRef = function(a: longint; b: int64): longint; WasmFuncRef;
|
||||||
|
TRec = class
|
||||||
|
{ WebAssembly reference types cannot be used inside records, objects, or classes }
|
||||||
|
q: TWasmFuncRef;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
end.
|
Loading…
Reference in New Issue
Block a user