mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-10 10:09:21 +02:00
[PATCH 142/188] adding mutable flag for global variables
From fdd0998697323727e0fbd4af6322eb305f1a8960 Mon Sep 17 00:00:00 2001 From: Dmitry Boyarintsev <skalogryz.lists@gmail.com> Date: Wed, 25 Mar 2020 11:24:36 -0400 git-svn-id: branches/wasm@46138 -
This commit is contained in:
parent
e31e57ceb1
commit
39c720778f
@ -114,9 +114,10 @@ type
|
||||
|
||||
TWasmGlobal = class(TObject)
|
||||
public
|
||||
id : TWasmId;
|
||||
tp : byte; // byte;
|
||||
value : TWasmInstrList;
|
||||
id : TWasmId;
|
||||
tp : byte; // byte;
|
||||
isMutable : Boolean; // is mutable
|
||||
value : TWasmInstrList;
|
||||
LinkInfo : TLinkInfo;
|
||||
ExportInfo : TExportInfo;
|
||||
function StartValue: TWasmInstrList;
|
||||
|
@ -429,15 +429,25 @@ begin
|
||||
allowValue := false;
|
||||
end else if sc.token=weExport then begin
|
||||
// export
|
||||
end else
|
||||
ErrorExpectButFound(sc, 'import or export')
|
||||
end;
|
||||
end;
|
||||
|
||||
if sc.token in WasmTypeTokens then begin
|
||||
TokenTypeToValType(sc.token, dst.tp);
|
||||
// parsing type. Global can be mutable type (mut i32)
|
||||
|
||||
if (sc.token=weOpenBrace) then sc.Next;
|
||||
if sc.token = weMut then begin
|
||||
dst.isMutable := true;
|
||||
sc.Next;
|
||||
end;
|
||||
|
||||
if (sc.token in WasmTypeTokens) then begin
|
||||
TokenTypeToValType(sc.token, dst.tp);
|
||||
sc.Next;
|
||||
end else
|
||||
ErrorExpectButFound(sc, 'type');
|
||||
|
||||
if dst.isMutable then ConsumeToken(sc, weCloseBrace);
|
||||
|
||||
if allowValue and (sc.token = weOpenBrace) then begin
|
||||
sc.Next;
|
||||
ParseInstrList(sc, dst.StartValue);
|
||||
|
Loading…
Reference in New Issue
Block a user