Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change constructor tracking to not use type #29

Merged
merged 2 commits into from
May 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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