Search in sources :

Example 86 with JSONObject

use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.

the class PropertyDescriptor method createJSON.

private static JSONObject createJSON(String name, RemoteObject value, Boolean writable, RemoteObject get, RemoteObject set, boolean configurable, boolean enumerable, Boolean wasThrown, Boolean isOwn, RemoteObject symbol) {
    JSONObject json = new JSONObject();
    json.put("name", name);
    if (value != null && get == null) {
        json.put("value", value.toJSON());
    }
    json.putOpt("writable", writable);
    if (get != null) {
        json.put("get", get.toJSON());
    }
    if (set != null) {
        json.put("set", set.toJSON());
    }
    json.put("configurable", configurable);
    json.put("enumerable", enumerable);
    json.putOpt("wasThrown", wasThrown);
    json.putOpt("isOwn", isOwn);
    if (symbol != null) {
        json.put("symbol", symbol.toJSON());
    }
    return json;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 87 with JSONObject

use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.

the class RuntimeCallFrame method toJSON.

JSONObject toJSON() {
    JSONObject json = new JSONObject();
    json.put("functionName", functionName);
    json.put("scriptId", Integer.toString(scriptId));
    json.put("url", url);
    // 0-based in the protocol
    json.put("lineNumber", line - 1);
    // 0-based in the protocol
    json.put("columnNumber", column - 1);
    return json;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 88 with JSONObject

use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.

the class ScriptTypeProfile method toJSON.

public JSONObject toJSON() {
    JSONObject json = new JSONObject();
    json.put("scriptId", Integer.toString(scriptId));
    json.put("url", url);
    json.put("entries", TypeProfileEntry.toJSON(entries));
    return json;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject)

Example 89 with JSONObject

use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.

the class CustomPreview method createJSON.

private static JSONObject createJSON(DebugValue debugValue, DebugValue config, DebugValue headerValue, DebugValue bodyFunction, InspectorExecutionContext context) {
    JSONObject json = new JSONObject();
    json.put(HEADER, value2JSON(headerValue, context).toString());
    if (bodyFunction != null) {
        RemoteObject bodyFunctionRemote = context.getRemoteObjectsHandler().getRemote(bodyFunction);
        RemoteObjectsHandler objectsHandler = context.getRemoteObjectsHandler();
        objectsHandler.registerCustomPreviewBody(bodyFunctionRemote.getId(), bodyFunction);
        if (config != null) {
            // If there is an config object, register it for callFunctionOn() call.
            String objectId = objectsHandler.getRemote(debugValue).getId();
            objectsHandler.registerCustomPreviewConfig(objectId, config);
        }
        json.put(BODY_GETTER_ID, bodyFunctionRemote.getId());
    }
    return json;
}
Also used : JSONObject(com.oracle.truffle.tools.utils.json.JSONObject) RemoteObjectsHandler(com.oracle.truffle.tools.chromeinspector.RemoteObjectsHandler)

Example 90 with JSONObject

use of com.oracle.truffle.tools.utils.json.JSONObject in project graal by oracle.

the class FunctionCoverage method toJSON.

private JSONObject toJSON() {
    JSONObject json = new JSONObject();
    json.put("functionName", functionName);
    json.put("ranges", CoverageRange.toJSON(ranges));
    json.put("isBlockCoverage", isBlockCoverage);
    return 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