Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory attributes / fix deprecations #45

Merged
merged 1 commit into from
Nov 12, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
fix memory attributes
WebFreak001 committed Nov 11, 2023
commit 2ee9e73a15d4cb16f1c2f8c1f3dfebb93a23ba05
2 changes: 1 addition & 1 deletion source/mir/deser/ion.d
Original file line number Diff line number Diff line change
@@ -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
6 changes: 4 additions & 2 deletions source/mir/deser/json.d
Original file line number Diff line number Diff line change
@@ -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)
@@ -45,7 +45,9 @@ template deserializeJson(T)
}
}
deserializeIon!T(value, data);
});
}

mir_json2ion(text, &callback);
}
}

12 changes: 6 additions & 6 deletions source/mir/deser/package.d
Original file line number Diff line number Diff line change
@@ -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);
@@ -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,
@@ -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_,
@@ -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_,
@@ -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;
2 changes: 1 addition & 1 deletion source/mir/ion/value.d
Original file line number Diff line number Diff line change
@@ -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);
}