tree-sitter-javascript icon indicating copy to clipboard operation
tree-sitter-javascript copied to clipboard

Add optional_chain named field

Open stackmystack opened this issue 2 years ago • 2 comments

Optional chaining property/array access and optional function calls now produce an optional_chain named field.

When traversing a parsed program, once can retrieve the operator by looking at the source code, indeed, but it seems hacky (in a bad sense).

Checklist:

  • [x] All tests pass in CI.
  • [x] The script/parse-examples passes without issues.
  • [x] There are sufficient tests for the new fix/feature.
  • [x] Grammar rules have not been renamed unless absolutely necessary.
  • [x] The conflicts section hasn't grown too much.
  • [x] The parser size hasn't grown too much (check the value of STATE_COUNT in src/parser.c).

stackmystack avatar Jul 19 '22 13:07 stackmystack

Hello, is this the right place for these kinds of PRs?

stackmystack avatar Aug 01 '22 14:08 stackmystack

Hi @stackmystack. Yes, this is the right place for such PRs. Sorry for the delays! For this particular issue, I'm not sure how field() is used in general as it's not a feature we use in semgrep. That's why I'd like to refer to @maxbrunsfeld.

mjambon avatar Aug 10 '22 00:08 mjambon

Also you get CI failures: "Error in query file "highlights.scm"

aryx avatar Aug 18 '22 09:08 aryx

Hello @aryx, I fixed the test-suite, it was working in the initial submission and got broken with a rebase which I didn't check. All green now.

The windows failure in the CI seems to be a node issue.

stackmystack avatar Aug 18 '22 12:08 stackmystack