-
Notifications
You must be signed in to change notification settings - Fork 4.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Methods on primitives 65707 #66654
Methods on primitives 65707 #66654
Conversation
Tagging subscribers to this area: @thaystg Issue DetailsFixes #65707. Does not fix:
|
Tagging subscribers to 'arch-wasm': @lewing Issue DetailsFixes #65707. Does not fix:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In the current state, this is very hard to read, mainly due to the EvaluationExpression.cs
being split. I suggest either moving the split into a separate PR, or redo the commits, so the first one is just the split, with no other changes. And then the other commits on top of that. That would allow seeing what exactly is being changed.
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Outdated
Show resolved
Hide resolved
0188f0a
to
6e3021f
Compare
f319658
to
5567e88
Compare
Please expand the PR description to explain what is being done in this PR, and why. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other than a few small suggestions, this looks good to me!
src/mono/wasm/debugger/BrowserDebugProxy/ExpressionEvaluator.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/BrowserDebugProxy/MemberReferenceResolver.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs
Outdated
Show resolved
Hide resolved
src/mono/wasm/debugger/DebuggerTestSuite/EvaluateOnCallFrameTests.cs
Outdated
Show resolved
Hide resolved
Some cases to fix in future PRs:
.. but it should fail because |
Fixes #65707 and
fixes #65670.
If a result is an array, it enables to get its properties.
Before: evaluation of methods on a primitive value in debugger window did not work, threw "cannot evaluate".
Now: we are getting a proper reply for most of cases with exceptions listed below. To achieve it, we are replacing variables in evaluated script, which means we are appending at the beginning a list of used variables in a form:
and running to script to get the result that we want to return to the user.
Does not fix:
ToList in: someString.Split(".", 2, StringSplitOptions.None).ToList()
int_arr**.Length** (#66823)
myList + "Asd #65707 (comment)
Changes:
EvaluateExpression
->ExpressionEvaluator
andFindVariableNMethodCall
->ExpressionSyntaxReplacer
,FindVariableNMethodCall.methodCall
->ExpressionSyntaxReplacer.methodCalls
.ResolveMemberAccessExpressions
andResolveIdentifiers
intoResolve
that iterates through a collection and resolves accessExpression or identifier by a function accepting a single element. It's neater.ResolveMethodCalls
we are no longer using the regular procedure of asking the runtime to evaluate it because it would throw an exception - runtime has no means of evaluating objects that have noobjectId
. Instead inReplaceMethodCall
, we replace the values used in the script and append them at the beginning to evaluate the expression on the debugger side.boolean
return type. Before we were treating boolean as a complex object after evaluating an expression . We granted it "object" type inConvertCSharpToJSType
. Thus, we had to use TObject in tests when checking the value from a function that returned bool. It was confusing so bool scenario was added inConvertCSharpToJSType
and tests were adjusted accordingly.ValueTypeClass.ToJObject()
. Enum has its value in the first field, even though it does not have fields in the same sense typical ValueType, e.g. structure has. To get the value of Non-Enum we need to additionally ask runtime for this info, so we keep this value null till we need it. We have to save Enum's value there because we will need it during the script's variables replacement procedure.FindStaticMemberInType
(full = with namespace) because we need it for Enums inConvertJSToCSharpLocalVariableAssignment
to constructvalueRet
correctly. If we cut the namespace the script will throw during compilation because script will not be able to cast integer to Enum - it will not recognise the Enum's name as correct.