use of com.nextgenactionscript.vscode.debug.responses.Variable in project vscode-nextgenas by BowlerHatLLC.
the class SWFDebugSession method variables.
public void variables(Response response, VariablesRequest.VariablesArguments arguments) {
List<Variable> variables = new ArrayList<>();
try {
Value swfValue = null;
long variablesReference = arguments.variablesReference;
int frameId = -1;
if (variablesReference < 1000) {
frameId = (int) variablesReference / 10;
variablesReference -= frameId * 10;
}
flash.tools.debugger.Variable[] members = null;
if (variablesReference == LOCAL_VARIABLES_REFERENCE) {
Frame[] swfFrames = swfSession.getFrames();
if (frameId >= 0 && frameId < swfFrames.length) {
Frame swfFrame = swfFrames[frameId];
flash.tools.debugger.Variable[] args = swfFrame.getArguments(swfSession);
flash.tools.debugger.Variable[] locals = swfFrame.getLocals(swfSession);
flash.tools.debugger.Variable swfThis = swfFrame.getThis(swfSession);
int memberCount = locals.length + args.length;
int offset = 0;
if (swfThis != null) {
offset = 1;
}
members = new flash.tools.debugger.Variable[memberCount + offset];
if (swfThis != null) {
members[0] = swfThis;
}
System.arraycopy(args, 0, members, offset, args.length);
System.arraycopy(locals, 0, members, args.length + offset, locals.length);
} else {
members = new flash.tools.debugger.Variable[0];
}
} else {
swfValue = swfSession.getValue(arguments.variablesReference);
members = swfValue.getMembers(swfSession);
}
for (flash.tools.debugger.Variable member : members) {
Value memberValue = member.getValue();
Variable variable = new Variable();
variable.name = member.getName();
variable.type = memberValue.getTypeName();
long id = memberValue.getId();
if (id != Value.UNKNOWN_ID) {
variable.value = memberValue.getTypeName();
variable.variablesReference = memberValue.getId();
} else {
if (memberValue.getType() == VariableType.STRING) {
variable.value = "\"" + memberValue.getValueAsString() + "\"";
} else {
variable.value = memberValue.getValueAsString();
}
}
variables.add(variable);
}
} catch (PlayerDebugException e) {
//ignore
}
sendResponse(response, new VariablesResponseBody(variables));
}
Aggregations