Skip to content

Commit

Permalink
fix memory attributes (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
WebFreak001 authored Nov 12, 2023
1 parent dd8af70 commit b03e3b8
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion source/mir/deser/ion.d
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ template deserializeIon(T, bool annotated = false)
tableMapBuffer.put(id);
}
if (auto exception = deserializeValue!(keys, TableKind.scopeRuntime)(ionValue, value, symbolTable, tableMapBuffer.data, optionalAnnotations))
throw exception;
throw (() @trusted => cast() exception)();
}}

/// ditto
Expand Down
6 changes: 4 additions & 2 deletions source/mir/deser/json.d
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ template deserializeJson(T)
import mir.deser.ion: deserializeIon;
import mir.ion.exception: ionException, ionErrorMsg, IonParserMirException;

mir_json2ion(text, (error, data)
auto callback(IonErrorInfo error, scope const ubyte[] data)
{
enum nogc = __traits(compiles, (scope ref T value, const(ubyte)[] data)@nogc { deserializeIon!T(value, data); });
if (error.code)
Expand All @@ -45,7 +45,9 @@ template deserializeJson(T)
}
}
deserializeIon!T(value, data);
});
}

mir_json2ion(text, &callback);
}
}

Expand Down
12 changes: 6 additions & 6 deletions source/mir/deser/package.d
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ package template hasScoped(T)
enum hasScoped = false;
}

IonException deserializeValue_(T)(scope IonDescribedValue data, scope ref T value)
IonException deserializeValue_(T)(scope IonDescribedValue data, return scope ref T value)
if (isFirstOrderSerdeType!T)
{
return deserializeValueImpl(data, value).ionException;
}

IonException deserializeValue_(T, P...)(scope IonDescribedValue data, scope ref T value, scope const P p)
IonException deserializeValue_(T, P...)(scope IonDescribedValue data, return scope ref T value, scope const P p)
if (isFirstOrderSerdeType!T)
{
return deserializeValue_!T(data, value);
Expand Down Expand Up @@ -166,7 +166,7 @@ template deserializeValue(string[] symbolTable, TableKind tableKind)

private IonException deserializeValueMember(string member, T)(
scope IonDescribedValue data,
scope ref T value,
return scope ref T value,
scope ref SerdeFlags!T requiredFlags,
scope RuntimeSymbolTable table,
scope const(uint)[] tableIndex,
Expand Down Expand Up @@ -377,7 +377,7 @@ template deserializeValue(string[] symbolTable, TableKind tableKind)
+/
IonException deserializeValue(T, Annotations...)(
scope IonDescribedValue data,
scope ref T value,
return scope ref T value,
scope RuntimeSymbolTable table,
scope const(uint)[] tableIndex,
scope Annotations annotations_,
Expand Down Expand Up @@ -1234,7 +1234,7 @@ template deserializeValue(string[] symbolTable, TableKind tableKind)

IonException deserializeValue(T, Annotations...)(
scope IonDescribedValue data,
scope ref T value,
return scope ref T value,
scope RuntimeSymbolTable table,
scope const(uint)[] tableIndex,
scope Annotations annotations_,
Expand Down Expand Up @@ -1512,7 +1512,7 @@ template deserializeValue(string[] symbolTable, TableKind tableKind)
static if (anySatisfy!(templateOr!(isStringMap, isAssociativeArray, hasLikeStruct, hasFallbackStruct, hasDiscriminatedField), Types))
{
case IonTypeCode.struct_:
{
{
static if (anySatisfy!(isStringMap, Types))
{
alias isMapType = isStringMap;
Expand Down
2 changes: 1 addition & 1 deletion source/mir/ion/value.d
Original file line number Diff line number Diff line change
Expand Up @@ -2706,7 +2706,7 @@ const:

///
@safe pure nothrow @nogc
IonStructWithSymbols withSymbols(return scope const(char[])[] symbolTable) return
IonStructWithSymbols withSymbols(return scope const(char[])[] symbolTable) return scope
{
return IonStructWithSymbols(this, symbolTable);
}
Expand Down

0 comments on commit b03e3b8

Please sign in to comment.