Skip to content

Commit

Permalink
Add some keywords, do not eval keywords when debugging
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Mar 20, 2024
1 parent a42a950 commit face892
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/HLAdapter.hx
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,12 @@ class HLAdapter extends DebugSession {
}
}

static var KEYWORDS = [for( k in ["var","new","function","inline","final","if","else","while","do","for","break","continue","return","throw","try","catch","switch","case","default"] ) k => true];
static var KEYWORDS = [for( k in [
// ref: haxe/src/core/ast.ml/s_keyword, without null/true/false
"function","class","static","var","if","else","while","do","for","break","return","continue","extends","implements","import","switch","case","default",
"private","public","try","catch","new","this","throw","extern","enum","in","interface","untyped","cast","override","typedef","dynamic","package","inline",
"using","abstract","macro","final","operator","overload",
] ) k => true];

override function evaluateRequest(response:EvaluateResponse, args:EvaluateArguments) {
//debug("Eval " + args);
Expand All @@ -921,10 +926,7 @@ class HLAdapter extends DebugSession {
if( ~/^\?[A-Za-z0-9_]+$/.match(args.expression) )
args.expression = args.expression.substr(1);
if( KEYWORDS.exists(args.expression) ) {
response.body = {
result : args.expression,
variablesReference : 0,
};
// Do nothing
} else {
var value = dbg.getValue(args.expression);
var v = makeVar("", value);
Expand Down

0 comments on commit face892

Please sign in to comment.