Skip to content
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

JS-188 Directive can be used as a Statement #4742

Merged
merged 2 commits into from
Jun 18, 2024
Merged

Conversation

quentin-jaquier-sonarsource
Copy link
Contributor

No description provided.

@@ -104,7 +104,7 @@ public record ClassExpression(Location loc, Optional<Identifier> id, Optional<Ex
public record ConditionalExpression(Location loc, Expression test, Expression alternate, Expression consequent) implements Expression {}
public record ContinueStatement(Location loc, Optional<Identifier> label) implements Statement {}
public record DebuggerStatement(Location loc) implements Statement {}
public record Directive(Location loc, Literal expression, String directive) implements DirectiveOrModuleDeclarationOrStatement {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rename the top interface ModuleDeclarationOrStatement since Directive is a child of Statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interface was introduced as the type of Program is:

export interface Program extends BaseNode {
    // ...
    body: Array<Directive | Statement | ModuleDeclaration>;
}

On one hand, we might want to match this definition, on the other, you are right that it is redundant. No strong feeling on this one, do you think that it is worth it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I'm not quite sure. How will it be used on the Sonar-Armor side?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, let's keep it as it is, and come back at it if there is a need.

Copy link
Contributor

@ilia-kebets-sonarsource ilia-kebets-sonarsource left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ilia-kebets-sonarsource ilia-kebets-sonarsource merged commit 42d6116 into master Jun 18, 2024
20 of 21 checks passed
@ilia-kebets-sonarsource ilia-kebets-sonarsource deleted the qj/JS-188 branch June 18, 2024 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants