Skip to content

Commit e0bfa4d

Browse files
committed
let positioned arg names start with __ because the random name generator will never come up with names that start with _
1 parent 48ef6f5 commit e0bfa4d

3 files changed

Lines changed: 8 additions & 5 deletions

File tree

src/org/rascalmpl/library/lang/json/IO.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public IValue readJSON(IValue type, ISourceLocation loc, IString dateTimeFormat,
6969
.setParsers(parsers)
7070
.setNulls(unreify(nulls))
7171
.setExplicitConstructorNames(explicitConstructorNames.getValue())
72-
.setExplicitDataTypes(explicitDataTypes.getValue()).read(in, start);
72+
.setExplicitDataTypes(explicitDataTypes.getValue())
73+
.read(in, start);
7374
}
7475
catch (IOException e) {
7576
throw RuntimeExceptionFactory.io(values.string(e.getMessage()), null, null);
@@ -98,7 +99,8 @@ public IValue parseJSON(IValue type, IString src, IString dateTimeFormat, IBool
9899
.setParsers(parsers)
99100
.setNulls(unreify(nulls))
100101
.setExplicitConstructorNames(explicitConstructorNames.getValue())
101-
.setExplicitDataTypes(explicitDataTypes.getValue()).read(in, start);
102+
.setExplicitDataTypes(explicitDataTypes.getValue())
103+
.read(in, start);
102104
}
103105
catch (IOException e) {
104106
throw RuntimeExceptionFactory.io(values.string(e.getMessage()));
@@ -142,7 +144,8 @@ public IString asJSON(IValue value, IBool unpackedLocations, IString dateTimeFor
142144
if (indent.intValue() > 0) {
143145
out.setIndent(" ".substring(0, indent.intValue() % 9));
144146
}
145-
new JsonValueWriter().setCalendarFormat(dateTimeFormat.getValue())
147+
new JsonValueWriter()
148+
.setCalendarFormat(dateTimeFormat.getValue())
146149
.setDatesAsInt(dateTimeAsInt.getValue())
147150
.setUnpackedLocations(unpackedLocations.getValue())
148151
.setDropOrigins(dropOrigins.getValue())

src/org/rascalmpl/library/lang/json/internal/JsonValueReader.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ public IValue visitNode(Type type) throws IOException {
750750
continue;
751751
}
752752

753-
boolean positioned = kwName.startsWith("arg");
753+
boolean positioned = kwName.startsWith("__arg");
754754

755755
if (!isNull()) { // lookahead for null to give default parameters the preference.
756756
IValue val = TF.valueType().accept(this);

src/org/rascalmpl/library/lang/json/internal/JsonValueWriter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ public Void visitNode(INode o) throws IOException {
285285

286286
int i = 0;
287287
for (IValue arg : o) {
288-
out.name("arg" + i++);
288+
out.name("__arg" + i++);
289289
arg.accept(this);
290290
}
291291

0 commit comments

Comments
 (0)