Skip to content

Conversation

@aspeddro
Copy link
Collaborator

@aspeddro aspeddro commented Dec 5, 2022

Bug Fix

  1. Decorator before polyvar_type:
type barStyle = @string [
  | #default
  | @as("light-content") #lightContent
  | @as("dark-content") #darkContent
]
yarn run v1.22.19
$ /home/pedro/Desktop/projects/tree-sitter-rescript/node_modules/.bin/tree-sitter parse ../../test-filetypes/rescript_print.res
(source_file [0, 0] - [5, 0]
  (type_declaration [0, 0] - [4, 1]
    (type_identifier [0, 5] - [0, 13])
    (ERROR [0, 16] - [0, 23]
      (decorator [0, 16] - [0, 23]
        (decorator_identifier [0, 17] - [0, 23])))
    (polyvar_type [0, 24] - [4, 1]
      (polyvar_declaration [1, 4] - [1, 12]
        (polyvar_identifier [1, 4] - [1, 12]))
      (polyvar_declaration [2, 4] - [2, 38]
        (decorator [2, 4] - [2, 24]
          (decorator_identifier [2, 5] - [2, 7])
          (decorator_arguments [2, 7] - [2, 24]
            (string [2, 8] - [2, 23]
              (string_fragment [2, 9] - [2, 22]))))
        (polyvar_identifier [2, 25] - [2, 38]))
      (polyvar_declaration [3, 4] - [3, 36]
        (decorator [3, 4] - [3, 23]
          (decorator_identifier [3, 5] - [3, 7])
          (decorator_arguments [3, 7] - [3, 23]
            (string [3, 8] - [3, 22]
              (string_fragment [3, 9] - [3, 21]))))
        (polyvar_identifier [3, 24] - [3, 36])))))
../../test-filetypes/rescript_print.res	0 ms	(ERROR [0, 16] - [0, 23])
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
  1. Decorator after labeled_argument
call(~a=@this (a, b) => a + b)
yarn run v1.22.19
$ /home/pedro/Desktop/projects/tree-sitter-rescript/node_modules/.bin/tree-sitter parse ../../test-filetypes/rescript_print.res
(source_file [0, 0] - [1, 0]
  (expression_statement [0, 0] - [0, 30]
    (call_expression [0, 0] - [0, 30]
      function: (value_identifier [0, 0] - [0, 4])
      arguments: (arguments [0, 4] - [0, 30]
        (labeled_argument [0, 5] - [0, 29]
          label: (value_identifier [0, 6] - [0, 7])
          (ERROR [0, 8] - [0, 13]
            (ERROR [0, 9] - [0, 13]))
          value: (function [0, 14] - [0, 29]
            parameters: (formal_parameters [0, 14] - [0, 20]
              (parameter [0, 15] - [0, 16]
                (value_identifier [0, 15] - [0, 16]))
              (parameter [0, 18] - [0, 19]
                (value_identifier [0, 18] - [0, 19])))
            body: (binary_expression [0, 24] - [0, 29]
              left: (value_identifier [0, 24] - [0, 25])
              right: (value_identifier [0, 28] - [0, 29]))))))))
../../test-filetypes/rescript_print.res	0 ms	(ERROR [0, 8] - [0, 13])
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Add more support for:

  • Array/Array pattern [@decorator 1, @decorator 2]
  • List/List pattern list{@decorator hd, @decorator tail}
  • Tuple/Tuple pattern (See rescript-tea) (@decorator 1, @decorator 2)

Test

Add rescript-nodejs to test wild
@nkrkv nkrkv merged commit 65b4288 into rescript-lang:main Dec 6, 2022
@nkrkv
Copy link
Collaborator

nkrkv commented Dec 6, 2022

Special thanks for the rescript-nodejs inclusion

@aspeddro aspeddro deleted the decorated-take-3 branch December 6, 2022 14:38
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