Skip to content

Commit 81cf6a1

Browse files
committed
Fix Copy value try to eval value, by using a fake evalName
1 parent ab5e8b4 commit 81cf6a1

File tree

1 file changed

+20
-8
lines changed

1 file changed

+20
-8
lines changed

src/HLAdapter.hx

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -728,30 +728,36 @@ class HLAdapter extends DebugSession {
728728
case VPointer(_):
729729
var fields = dbg.eval.getFields(value);
730730
if( fields != null && fields.length > 0 )
731-
return { name : name, type : tstr, value : tstr + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), namedVariables : fields.length };
731+
return { name : name, type : tstr, value : tstr + pstr, evaluateName : evalName ?? "#" + tstr, variablesReference : allocValue(VValue(value, evalName)), namedVariables : fields.length };
732732
case VEnum(c,values,_) if( values.length > 0 ):
733733
var str = c + "(" + [for( v in values ) switch( v.v ) {
734734
case VEnum(c,values,_) if( values.length == 0 ): c;
735735
case VPointer(_), VEnum(_), VArray(_), VMap(_), VBytes(_): "...";
736736
default: dbg.eval.valueStr(v);
737737
}].join(", ")+")";
738-
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), namedVariables : values.length };
738+
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName ?? "#" + str, variablesReference : allocValue(VValue(value, evalName)), namedVariables : values.length };
739739
case VArray(_, len, _, _), VMap(_, len, _, _):
740-
return { name : name, type : tstr, value : dbg.eval.valueStr(value) + pstr, evaluateName : evalName, variablesReference : len == 0 ? 0 : allocValue(VValue(value, evalName)), indexedVariables : len };
740+
var str = dbg.eval.valueStr(value);
741+
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName ?? "#" + str, variablesReference : len == 0 ? 0 : allocValue(VValue(value, evalName)), indexedVariables : len };
741742
case VBytes(len, _):
742743
switch( value.hint ) {
743744
case HReadBytes(t, _):
744-
return { name : name, type : dbg.eval.typeStr(t), value : dbg.eval.valueStr(value), evaluateName : evalName, variablesReference : 0 };
745+
var str = dbg.eval.valueStr(value);
746+
return { name : name, type : dbg.eval.typeStr(t), value : str, evaluateName : evalName ?? "#" + str, variablesReference : 0 };
745747
default:
746748
}
747-
return { name : name, type : tstr, value : tstr+":"+len + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : (len+15)>>4 };
749+
var str = tstr+":"+len;
750+
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName ?? "#" + str, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : (len+15)>>4 };
748751
case VClosure(f,context,_):
749-
return { name : name, type : tstr, value : dbg.eval.funStr(f, value.hint == HPointer) + pstr, evaluateName : evalName, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : 2 };
752+
var str = dbg.eval.funStr(f, value.hint == HPointer);
753+
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName ?? "#" + str, variablesReference : allocValue(VValue(value, evalName)), indexedVariables : 2 };
750754
case VInlined(fields):
751-
return { name : name, type : tstr, value : dbg.eval.valueStr(value), evaluateName : evalName, variablesReference : fields.length == 0 ? 0 : allocValue(VValue(value, evalName)), namedVariables : fields.length };
755+
var str = dbg.eval.valueStr(value);
756+
return { name : name, type : tstr, value : str, evaluateName : evalName ?? "#" + str, variablesReference : fields.length == 0 ? 0 : allocValue(VValue(value, evalName)), namedVariables : fields.length };
752757
default:
753758
}
754-
return { name : name, type : tstr, value : dbg.eval.valueStr(value) + pstr, evaluateName : evalName, variablesReference : 0 };
759+
var str = dbg.eval.valueStr(value);
760+
return { name : name, type : tstr, value : str + pstr, evaluateName : evalName ?? "#" + str, variablesReference : 0 };
755761
}
756762

757763
override function variablesRequest(response:VariablesResponse, args:VariablesArguments) {
@@ -1055,6 +1061,12 @@ class HLAdapter extends DebugSession {
10551061
default:
10561062
debug("Unsupported command " + args.expression);
10571063
}
1064+
} else if( args.expression.charCodeAt(0) == '#'.code ) {
1065+
// Fake evalName for Copy value request
1066+
response.body = {
1067+
result : args.expression.substr(1),
1068+
variablesReference : 0,
1069+
};
10581070
} else {
10591071
var value = dbg.getValue(args.expression);
10601072
var v = makeVar("", value);

0 commit comments

Comments
 (0)