jeff-hykin / better-cpp-syntax

💾 The source of VS Code's C++ syntax highlighting
GNU General Public License v3.0
155 stars 30 forks source link

Pointer/dot access not recognized inside function call inside switch statement in C #486

Open nickelpro opened 4 years ago

nickelpro commented 4 years ago

Checklist

The code with a problem is:

typedef struct {
  int a;
} struct_t;

int func(int a) {
  return a;
}

void test(void) {
  struct_t s;
  struct_t *ptr;

  func(s.a);
  func(ptr->a);

  switch(1) {
    case 1:
      func(s.a);
      func(ptr->a);
  }
}

It looks like:

2020-07-09-021115_691x422_scrot

It should look like:

2020-07-09-021201_647x419_scrot

Confirmed with with scope inspector that inside the switch they're being scoped as keyword.operator.c not dot/pointer access. Works fine outside a function call and confirmed to work in .cpp files.