aboutsummaryrefslogtreecommitdiff
path: root/libphobos/src/std/json.d
diff options
context:
space:
mode:
authorIain Buclaw <ibuclaw@gdcproject.org>2022-08-25 19:04:50 +0200
committerIain Buclaw <ibuclaw@gdcproject.org>2022-08-28 00:16:34 +0200
commitb7a586beae1027ea0c82411637920a5032d1dedf (patch)
tree4c41a84c4113e90cd0caaa7aa9925f4232dc22d5 /libphobos/src/std/json.d
parentcace77f4fb8df18c01dfdf9040cc944eedef1147 (diff)
downloadgcc-b7a586beae1027ea0c82411637920a5032d1dedf.zip
gcc-b7a586beae1027ea0c82411637920a5032d1dedf.tar.gz
gcc-b7a586beae1027ea0c82411637920a5032d1dedf.tar.bz2
d: Merge upstream dmd 817610b16d, phobos b578dfad9
D front-end changes: - Import latest bug fixes to mainline. Phobos changes: - Import latest bug fixes to mainline. - std.logger module has been moved out of experimental. - Removed std.experimental.typecons module. gcc/d/ChangeLog: * dmd/MERGE: Merge upstream dmd 817610b16d. * d-ctfloat.cc (CTFloat::parse): Update for new front-end interface. * d-lang.cc (d_parse_file): Likewise. * expr.cc (ExprVisitor::visit (AssignExp *)): Remove handling of array assignments to non-trivial static and dynamic arrays. * runtime.def (ARRAYASSIGN): Remove. (ARRAYASSIGN_L): Remove. (ARRAYASSIGN_R): Remove. libphobos/ChangeLog: * libdruntime/MERGE: Merge upstream druntime 817610b16d. * libdruntime/Makefile.am (DRUNTIME_DSOURCES): Add core/internal/array/arrayassign.d. * libdruntime/Makefile.in: Regenerate. * src/MERGE: Merge upstream phobos b578dfad9. * src/Makefile.am (PHOBOS_DSOURCES): Remove std/experimental/typecons.d. Add std/logger package. * src/Makefile.in: Regenerate.
Diffstat (limited to 'libphobos/src/std/json.d')
-rw-r--r--libphobos/src/std/json.d28
1 files changed, 11 insertions, 17 deletions
diff --git a/libphobos/src/std/json.d b/libphobos/src/std/json.d
index c6e746a..ac397e5 100644
--- a/libphobos/src/std/json.d
+++ b/libphobos/src/std/json.d
@@ -1537,19 +1537,15 @@ if (isOutputRange!(Out,char))
toStringImpl!char(str);
}
- // recursive @safe inference is broken here
- // workaround: if json.put is @safe, we should be too,
- // so annotate the recursion as @safe manually
- static if (isSafe!({ json.put(""); }))
- {
- void delegate(ref const JSONValue, ulong) @safe toValue;
- }
- else
- {
- void delegate(ref const JSONValue, ulong) @system toValue;
- }
+ /* make the function infer @system when json.put() is @system
+ */
+ if (0)
+ json.put(' ');
- void toValueImpl(ref const JSONValue value, ulong indentLevel)
+ /* Mark as @trusted because json.put() may be @system. This has difficulty
+ * inferring @safe because it is recursive.
+ */
+ void toValueImpl(ref const JSONValue value, ulong indentLevel) @trusted
{
void putTabs(ulong additionalIndent = 0)
{
@@ -1594,7 +1590,7 @@ if (isOutputRange!(Out,char))
json.put(':');
if (pretty)
json.put(' ');
- toValue(member, indentLevel + 1);
+ toValueImpl(member, indentLevel + 1);
}
}
@@ -1631,7 +1627,7 @@ if (isOutputRange!(Out,char))
if (i)
putCharAndEOL(',');
putTabs(1);
- toValue(el, indentLevel + 1);
+ toValueImpl(el, indentLevel + 1);
}
putEOL();
putTabs();
@@ -1710,9 +1706,7 @@ if (isOutputRange!(Out,char))
}
}
- toValue = &toValueImpl;
-
- toValue(root, 0);
+ toValueImpl(root, 0);
}
// https://issues.dlang.org/show_bug.cgi?id=12897