|
@@ -429,15 +429,25 @@ begin
|
|
allowValue := false;
|
|
allowValue := false;
|
|
end else if sc.token=weExport then begin
|
|
end else if sc.token=weExport then begin
|
|
// export
|
|
// export
|
|
- end else
|
|
|
|
- ErrorExpectButFound(sc, 'import or export')
|
|
|
|
|
|
+ end;
|
|
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;
|
|
sc.Next;
|
|
end;
|
|
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
|
|
if allowValue and (sc.token = weOpenBrace) then begin
|
|
sc.Next;
|
|
sc.Next;
|
|
ParseInstrList(sc, dst.StartValue);
|
|
ParseInstrList(sc, dst.StartValue);
|