-
-
Notifications
You must be signed in to change notification settings - Fork 13
Feat/event listener return value #246
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
Conversation
WalkthroughThis PR introduces an encoder mechanism for attribute rules in the code generation system. It adds a new Possibly related PRs
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
scripting/internal/xhr/xmlhttp_request_generated.go (1)
203-209:responseproperty implementation incomplete—responseType is currently ignored.
XMLHttpRequest.responseshould return different types depending onresponseType(e.g., string for "", ArrayBuffer for "arraybuffer", Blob for "blob", parsed Object for "json" per the W3C spec). Currently,Response()always returns a string regardless ofresponseType. TheresponseTypefield is stored but never used to branch response handling. UsingEncodeStringunconditionally is inconsistent with the specification. Implement conditional response handling based onresponseTypevalue.
| func (f GoFunction) Generate() *jen.Statement { | ||
| if f.Package == "" { | ||
| return jen.Id(f.Name) | ||
| } | ||
| return jen.Qual(f.Package, f.Name) | ||
| } |
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.
🧹 Nitpick | 🔵 Trivial
Consider defensive check for empty Name.
If Generate() is called when Name is empty, it will produce jen.Id("") which may generate invalid Go code. While IsZero() exists for callers to guard against this, consider adding a defensive check or documenting the expected usage.
♻️ Optional: Add defensive handling
func (f GoFunction) Generate() *jen.Statement {
+ if f.Name == "" {
+ return jen.Null() // or panic with descriptive message
+ }
if f.Package == "" {
return jen.Id(f.Name)
}
return jen.Qual(f.Package, f.Name)
}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| func (f GoFunction) Generate() *jen.Statement { | |
| if f.Package == "" { | |
| return jen.Id(f.Name) | |
| } | |
| return jen.Qual(f.Package, f.Name) | |
| } | |
| func (f GoFunction) Generate() *jen.Statement { | |
| if f.Name == "" { | |
| return jen.Null() // or panic with descriptive message | |
| } | |
| if f.Package == "" { | |
| return jen.Id(f.Name) | |
| } | |
| return jen.Qual(f.Package, f.Name) | |
| } |
No description provided.