use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.
the class CallArgument method get.
public static CallArgument get(JSONObject json) {
Object value = json.opt("unserializableValue");
if (value != null) {
if (POSITIVE_INFINITY_STR.equals(value)) {
value = Double.POSITIVE_INFINITY;
} else if (NEGATIVE_INFINITY_STR.equals(value)) {
value = Double.NEGATIVE_INFINITY;
} else if (NAN_STR.equals(value)) {
value = Double.NaN;
} else if ("-0".equals(value) || "-0.0".equals(value)) {
value = NEGATIVE_ZERO;
}
} else {
value = json.opt("value");
if (value == JSONObject.NULL) {
value = null;
}
}
String objectId = json.optString("objectId", null);
return new CallArgument(value, objectId, json.length() == 0);
}
use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.
the class JSONPrinter method sourceJSON.
private static JSONObject sourceJSON(SourceCoverage coverage) {
final JSONObject sourceJson = new JSONObject();
sourceJson.put("name", coverage.getSource().getName());
sourceJson.put("path", coverage.getSource().getPath());
sourceJson.put("roots", rootsJson(coverage.getRoots()));
return sourceJson;
}
use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.
the class JSONPrinter method sourceSectionJson.
private static JSONObject sourceSectionJson(SourceSection section) {
JSONObject sourceSection = new JSONObject();
sourceSection.put("characters", section.getCharacters());
sourceSection.put("start_line", section.getStartLine());
sourceSection.put("end_line", section.getEndLine());
sourceSection.put("start_column", section.getStartColumn());
sourceSection.put("end_column", section.getEndColumn());
sourceSection.put("char_index", section.getCharIndex());
sourceSection.put("char_end_index", section.getCharEndIndex());
sourceSection.put("char_length", section.getCharLength());
return sourceSection;
}
use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.
the class WorkspaceEdit method setChanges.
public WorkspaceEdit setChanges(Map<String, List<TextEdit>> changes) {
if (changes != null) {
final JSONObject json = new JSONObject();
for (Map.Entry<String, List<TextEdit>> entry : changes.entrySet()) {
final JSONArray jsonArr = new JSONArray();
for (TextEdit textEdit : entry.getValue()) {
jsonArr.put(textEdit.jsonData);
}
json.put(entry.getKey(), jsonArr);
}
jsonData.put("changes", json);
}
return this;
}
use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.
the class WorkspaceFolder method create.
public static WorkspaceFolder create(String uri, String name) {
final JSONObject json = new JSONObject();
json.put("uri", uri);
json.put("name", name);
return new WorkspaceFolder(json);
}
Aggregations