Conversation
XGo_Env: support fileline param (token.Position)
tryFileLine: remote log & add comments
tryFileLine: use relFile of fileName
XGo_Env: remove fileline support
cl/_testgop: map-field-access (#2571)
Map Field Access with Comma‐ok Propagation #2572
doc: struct vs. tuple
README fix
doc: tuple in minispec
fix: prevent duplicate XGo_Init calls in embedded types
shouldCallXGoInit refactor
dql/xml,html: dump
dql: reflects,golang; encoding: yaml,golang
dql: xgo; encoding: xgo; encoding.Object
dql: map as NodeSet
Compile range expressions before entering the for-range block scope so that auto-generated type assertion statements (e.g. _autoGo_1) are emitted to the correct outer scope instead of the loop body. Fixes #2629 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com>
Revert the XGo-side workaround (reordering compileExpr before ForRange) and instead update gogen to v1.21.2-0.20260216045904-8435674ebccf which properly fixes the scoping issue in ForRange/RangeAssignThen/End. See goplus/gogen#593 Generated with [codeagent](https://github.com/qbox/codeagent) Co-authored-by: xushiwei <396972+xushiwei@users.noreply.github.com>
cl: fix DQL for-range scoping bug with auto-generated type assertions
demo: dql-json
goplus/mod v0.19.2
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.6 #2634 +/- ##
==========================================
+ Coverage 93.96% 94.10% +0.14%
==========================================
Files 34 32 -2
Lines 9797 9964 +167
==========================================
+ Hits 9206 9377 +171
+ Misses 421 419 -2
+ Partials 170 168 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary of ChangesHello @xushiwei, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly expands XGo's capabilities by introducing a powerful DOM Query Language (DQL) for querying structured data and enhancing the framework for domain-specific text literals. It includes a major overhaul of the compiler to support these new language constructs, accompanied by extensive documentation and new test cases to ensure a robust and expressive development experience. Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Changelog
Ignored Files
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is a very impressive pull request that introduces the powerful Data Query Language (DQL) feature, along with a major refactoring of encoding packages and a significant documentation effort. The DQL implementation is well-designed and extensible, providing a unified query interface for various data formats like JSON, XML, HTML, and even Go/XGo source code. The cleanup of the typesalias workaround and the bump to Go 1.24 are also welcome modernizations. I've found a couple of potential issues in the new DQL compiler logic that need attention, but overall, this is a fantastic contribution.
| } | ||
|
|
||
| func compileAnySelectorExpr(ctx *blockCtx, lhs int, v *ast.AnySelectorExpr) { | ||
| compileExpr(ctx, 0, v.X) |
There was a problem hiding this comment.
It seems there's a potential bug here. The lhs argument to compileExpr is 0, which typically means the expression's result is discarded. However, the subsequent call to convMapToNodeSet (and its underlying call to cb.Get(-1)) expects the result of v.X to be on the stack. This will likely lead to a compiler panic or incorrect code generation.
Other similar functions in this file, like compileSelectorExpr and compileCondExpr, use compileExpr(ctx, 1, ...) to ensure the result is available. This should probably be compileExpr(ctx, 1, v.X) as well.
| compileExpr(ctx, 0, v.X) | |
| compileExpr(ctx, 1, v.X) |
| If().DefineVarStart(0, nameVal, nameErr). | ||
| Val(varSelf).MemberVal("XGo_first", 0, v).CallWith(0, 2, 0, v) | ||
| firstRet := cb.Get(-1) | ||
| nodeType := firstRet.Type.(*types.Tuple).At(0).Type() | ||
| varYield := newNodeSeqParam(pkgTypes, nodeType) | ||
| cb.EndInit(1).VarVal(nameErr).Val(nil).BinaryOp(gotoken.EQL).Then(). |
There was a problem hiding this comment.
The logic here hardcodes the assumption that the XGo_first method returns two values (a node and an error), by using CallWith(0, 2, ...) and DefineVarStart(0, nameVal, nameErr).
This assumption doesn't hold for all NodeSet implementations. For example, the TestErrCondExpr test case uses a NodeSet2 whose XGo_first method returns only a single value, causing a compilation error.
To make this more robust, the compiler should inspect the signature of XGo_first. Based on the number of return values, it should generate different code for variable assignment and error handling.
- If
XGo_firstreturns two values, the current logic is correct. - If
XGo_firstreturns one value, it should be assigned directly to_xgo_val, and the error handling block should be skipped.
No description provided.