-
Notifications
You must be signed in to change notification settings - Fork 115
[WIP] Приоритет операторов вместо рекурсивного спуска и другие оптимизации #1651
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
base: develop
Are you sure you want to change the base?
Changes from all commits
b16a0dc
c3ee3e3
39da396
269a431
2f378fe
9ae791c
7a99161
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -16,6 +16,12 @@ public class UnaryOperationNode : NonTerminalNode | |||||||||||||||||||||||
| public UnaryOperationNode(Lexem operation) : base(NodeKind.UnaryOperation, operation) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| Operation = operation.Token; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| public UnaryOperationNode(BslSyntaxNode arg, Lexem operation) : base(NodeKind.UnaryOperation, operation) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| Operation = operation.Token; | ||||||||||||||||||||||||
| AddChild(arg); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+21
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Potential null child propagation. The Consider adding a null guard or ensuring callers handle the error case before constructing the node. 🛡️ Proposed defensive check public UnaryOperationNode(BslSyntaxNode arg, Lexem operation) : base(NodeKind.UnaryOperation, operation)
{
Operation = operation.Token;
- AddChild(arg);
+ if (arg != null)
+ AddChild(arg);
}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
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.
Same null child concern applies here.
Both
firstArgandsecondArgcan benullwhen expression parsing fails. TheBuildExpressionmethod returnsdefaulton syntax errors (line 1290 in DefaultBslParser.cs), which would result in null children being added to the node.Consider defensive null checks consistent with
UnaryOperationNode.🛡️ Proposed defensive check
public BinaryOperationNode(BslSyntaxNode firstArg, BslSyntaxNode secondArg, Lexem operation) : base(NodeKind.BinaryOperation, operation) { Operation = operation.Token; - AddChild(firstArg); - AddChild(secondArg); + if (firstArg != null) + AddChild(firstArg); + if (secondArg != null) + AddChild(secondArg); }📝 Committable suggestion
🤖 Prompt for AI Agents