Rename kw() to keyword() also in C++

This commit is contained in:
Johannes Altmanninger 2023-04-19 18:42:26 +02:00
parent e4f6169a01
commit 12ce42a2f9
4 changed files with 12 additions and 10 deletions

View file

@ -4031,7 +4031,7 @@ pub mod ast_ffi {
unsafe fn pointer_eq(self: &NodeFfi<'_>, rhs: &NodeFfi) -> bool; unsafe fn pointer_eq(self: &NodeFfi<'_>, rhs: &NodeFfi) -> bool;
unsafe fn has_value(self: &NodeFfi<'_>) -> bool; unsafe fn has_value(self: &NodeFfi<'_>) -> bool;
unsafe fn kw(self: &NodeFfi<'_>) -> ParseKeyword; unsafe fn keyword(self: &NodeFfi<'_>) -> ParseKeyword;
unsafe fn token_type(self: &NodeFfi<'_>) -> ParseTokenType; unsafe fn token_type(self: &NodeFfi<'_>) -> ParseTokenType;
unsafe fn has_source(self: &NodeFfi<'_>) -> bool; unsafe fn has_source(self: &NodeFfi<'_>) -> bool;
@ -4129,7 +4129,8 @@ pub mod ast_ffi {
fn describe(self: &Statement) -> UniquePtr<CxxWString>; fn describe(self: &Statement) -> UniquePtr<CxxWString>;
fn kw(self: &JobConjunctionDecorator) -> ParseKeyword; #[cxx_name = "keyword"]
fn keyword_ffi(self: &JobConjunctionDecorator) -> ParseKeyword;
fn decoration(self: &DecoratedStatement) -> StatementDecoration; fn decoration(self: &DecoratedStatement) -> StatementDecoration;
fn is_argument(self: &ArgumentOrRedirection) -> bool; fn is_argument(self: &ArgumentOrRedirection) -> bool;
@ -4507,7 +4508,7 @@ impl<'a> NodeFfi<'a> {
fn pointer_eq(&self, rhs: &NodeFfi) -> bool { fn pointer_eq(&self, rhs: &NodeFfi) -> bool {
std::ptr::eq(self.as_node().as_ptr(), rhs.as_node().as_ptr()) std::ptr::eq(self.as_node().as_ptr(), rhs.as_node().as_ptr())
} }
fn kw(&self) -> ParseKeyword { fn keyword(&self) -> ParseKeyword {
self.as_node().as_keyword().unwrap().keyword() self.as_node().as_keyword().unwrap().keyword()
} }
fn token_type(&self) -> ParseTokenType { fn token_type(&self) -> ParseTokenType {
@ -4698,7 +4699,7 @@ impl Statement {
} }
impl JobConjunctionDecorator { impl JobConjunctionDecorator {
fn kw(&self) -> ParseKeyword { fn keyword_ffi(&self) -> ParseKeyword {
self.keyword() self.keyword()
} }
fn source_range_ffi(&self) -> SourceRange { fn source_range_ffi(&self) -> SourceRange {

View file

@ -898,7 +898,7 @@ static bool range_is_potential_path(const wcstring &src, const source_range_t &r
void highlighter_t::visit_keyword(const ast::node_t *kw) { void highlighter_t::visit_keyword(const ast::node_t *kw) {
highlight_role_t role = highlight_role_t::normal; highlight_role_t role = highlight_role_t::normal;
switch (kw->kw()) { switch (kw->keyword()) {
case parse_keyword_t::kw_begin: case parse_keyword_t::kw_begin:
case parse_keyword_t::kw_builtin: case parse_keyword_t::kw_builtin:
case parse_keyword_t::kw_case: case parse_keyword_t::kw_case:

View file

@ -1490,7 +1490,7 @@ end_execution_reason_t parse_execution_context_t::test_and_run_1_job_conjunction
// Maybe skip the job if it has a leading and/or. // Maybe skip the job if it has a leading and/or.
bool skip = false; bool skip = false;
if (jc.has_decorator()) { if (jc.has_decorator()) {
switch (jc.decorator().kw()) { switch (jc.decorator().keyword()) {
case parse_keyword_t::kw_and: case parse_keyword_t::kw_and:
// AND. Skip if the last job failed. // AND. Skip if the last job failed.
skip = parser->get_last_status() != 0; skip = parser->get_last_status() != 0;

View file

@ -884,10 +884,11 @@ static bool detect_errors_in_backgrounded_job(const ast::job_pipeline_t &job,
if (const job_conjunction_t *next = jlist->at(index + 1)) { if (const job_conjunction_t *next = jlist->at(index + 1)) {
if (next->has_decorator()) { if (next->has_decorator()) {
const auto &deco = next->decorator(); const auto &deco = next->decorator();
assert( assert((deco.keyword() == parse_keyword_t::kw_and ||
(deco.kw() == parse_keyword_t::kw_and || deco.kw() == parse_keyword_t::kw_or) && deco.keyword() == parse_keyword_t::kw_or) &&
"Unexpected decorator keyword"); "Unexpected decorator keyword");
const wchar_t *deco_name = (deco.kw() == parse_keyword_t::kw_and ? L"and" : L"or"); const wchar_t *deco_name =
(deco.keyword() == parse_keyword_t::kw_and ? L"and" : L"or");
errored = append_syntax_error(parse_errors, deco.source_range().start, errored = append_syntax_error(parse_errors, deco.source_range().start,
deco.source_range().length, deco.source_range().length,
BOOL_AFTER_BACKGROUND_ERROR_MSG, deco_name); BOOL_AFTER_BACKGROUND_ERROR_MSG, deco_name);