Search in sources :

Example 91 with JSONObject

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);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 92 with JSONObject

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;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 93 with JSONObject

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;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 94 with JSONObject

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;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) JSONArray(com.oracle.truffle.tools.utils.json.JSONArray) List(java.util.List) ArrayList(java.util.ArrayList) Map(java.util.Map) HashMap(java.util.HashMap)

Example 95 with JSONObject

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);
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Aggregations

JSONObject (com.oracle.truffle.tools.utils.json.JSONObject)318 JSONArray (com.oracle.truffle.tools.utils.json.JSONArray)71 ArrayList (java.util.ArrayList)20 Params (com.oracle.truffle.tools.chromeinspector.commands.Params)18 DebugValue (com.oracle.truffle.api.debug.DebugValue)14 DebugException (com.oracle.truffle.api.debug.DebugException)11 CommandProcessException (com.oracle.truffle.tools.chromeinspector.server.CommandProcessException)10 SourceSection (com.oracle.truffle.api.source.SourceSection)8 HashMap (java.util.HashMap)8 List (java.util.List)8 Collection (java.util.Collection)7 Breakpoint (com.oracle.truffle.api.debug.Breakpoint)6 Source (com.oracle.truffle.api.source.Source)6 Map (java.util.Map)6 LanguageInfo (com.oracle.truffle.api.nodes.LanguageInfo)5 NoSuspendedThreadException (com.oracle.truffle.tools.chromeinspector.InspectorExecutionContext.NoSuspendedThreadException)5 RemoteObject (com.oracle.truffle.tools.chromeinspector.types.RemoteObject)5 JSONTokener (com.oracle.truffle.tools.utils.json.JSONTokener)5 Test (org.junit.Test)5 Location (com.oracle.truffle.tools.chromeinspector.types.Location)4