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

semantic,codegen: allow optional positional params #742

Merged
merged 1 commit into from
Jun 21, 2019

Conversation

mmarchini
Copy link
Contributor

Fixes: #735

Copy link
Member

@ajor ajor left a comment

Choose a reason for hiding this comment

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

Looks good, just need some tests to make sure we don't delete this functionality again

@mmarchini
Copy link
Contributor Author

Added some tests. Had to make a few changes in some headers to avoid circular include issues. Please take a look.

Copy link
Member

@ajor ajor left a comment

Choose a reason for hiding this comment

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

Maybe bpftrace.get_param() could contain the default value logic instead? Might need an extra argument like is_in_str

src/ast/ast.cpp Outdated
@@ -29,6 +30,20 @@ void PositionalParameter::accept(Visitor &v) {
v.visit(*this);
}

std::string PositionalParameter::get_value(const BPFtrace &bpftrace)
Copy link
Member

Choose a reason for hiding this comment

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

Don't think this method should be part of the AST - this class shouldn't know about bpftrace at all

@mmarchini
Copy link
Contributor Author

Adding a new parameter to get_param sure looks better :)

Copy link
Member

@ajor ajor left a comment

Choose a reason for hiding this comment

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

Looks good!

@ajor ajor merged commit f2e1345 into bpftrace:master Jun 21, 2019
@ajor ajor mentioned this pull request Jun 21, 2019
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.

optional parameter crash
2 participants