Skip to content

Commit

Permalink
Change constructor tracking to not use type (#29)
Browse files Browse the repository at this point in the history
  • Loading branch information
J3RN authored May 24, 2022
1 parent aed23b2 commit d7861b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions queries/tags.scm
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@
(type_definition
(data_constructors
(data_constructor
name: (constructor_name) @name))) @definition.type
name: (constructor_name) @name))) @definition.constructor
(external_type
(type_name
name: (type_identifier) @name)) @definition.type

(type_identifier) @name @reference.type
(constructor_name) @name @reference.type
(constructor_name) @name @reference.constructor
6 changes: 3 additions & 3 deletions test/tags/frame.gleam
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import gleam/bit_builder
pub type FrameData {
// ^ definition.type
Text(String)
// <- definition.type
// <- definition.constructor
// ^ reference.type
Binary(BitString)
Continuation(BitString)
Ping(BitString)
Pong(BitString)
Close(code: Option(Int), reason: Option(String))
// <- definition.type
// <- definition.constructor
// ^ reference.type
// ^ reference.type
// ^ reference.type
Expand All @@ -42,7 +42,7 @@ fn encode_frame(frame: Frame) -> bit_builder.BitBuilder {
let opcode =
case frame.data {
Continuation(_) -> <<0x0:size(1)>>
// <- reference.type
// <- reference.constructor
Text(_) -> <<0x1:size(1)>>
Binary(_) -> <<0x2:size(1)>>
// 0x3-7 reserved for future non-control frames
Expand Down
2 changes: 1 addition & 1 deletion test/tags/functions.gleam
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
fn record_with_fun_field(record) {
let foo = Bar(baz: fn(x) { x + 1 })
// ^ reference.type
// ^ reference.constructor
foo.baz(41)
record.foobar("hello")

Expand Down

0 comments on commit d7861b2

Please sign in to comment.