Skip to content

Commit 6f05963

Browse files
committed
Remove idx column from tokeninfo tables.
1 parent c183e05 commit 6f05963

File tree

5 files changed

+7
-21
lines changed

5 files changed

+7
-21
lines changed

extractor/src/extractor.rs

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,6 @@ pub fn extract(
190190
// TODO: should we handle path strings that are not valid UTF8 better?
191191
path: format!("{}", path.display()),
192192
file_label: *file_label,
193-
token_counter: 0,
194193
toplevel_child_counter: 0,
195194
stack: Vec::new(),
196195
language_prefix,
@@ -300,8 +299,6 @@ struct Visitor<'a> {
300299
source: &'a Vec<u8>,
301300
/// A TrapWriter to accumulate trap entries
302301
trap_writer: &'a mut TrapWriter,
303-
/// A counter for tokens
304-
token_counter: usize,
305302
/// A counter for top-level child nodes
306303
toplevel_child_counter: usize,
307304
/// Language prefix
@@ -426,12 +423,10 @@ impl Visitor<'_> {
426423
Arg::Label(id),
427424
Arg::Int(*kind_id),
428425
Arg::Label(self.file_label),
429-
Arg::Int(self.token_counter),
430426
sliced_source_arg(self.source, node),
431427
Arg::Label(loc),
432428
],
433429
);
434-
self.token_counter += 1;
435430
}
436431
EntryKind::Table {
437432
fields,

generator/src/main.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -312,13 +312,6 @@ fn create_tokeninfo<'a>(name: &'a str, type_name: &'a str) -> dbscheme::Table<'a
312312
ql_type: ql::Type::AtType("file"),
313313
ql_type_is_ref: true,
314314
},
315-
dbscheme::Column {
316-
unique: false,
317-
db_type: dbscheme::DbColumnType::Int,
318-
name: "idx",
319-
ql_type: ql::Type::Int,
320-
ql_type_is_ref: true,
321-
},
322315
dbscheme::Column {
323316
unique: false,
324317
db_type: dbscheme::DbColumnType::String,

generator/src/ql_gen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -119,22 +119,22 @@ pub fn create_ast_node_class<'a>(ast_node: &'a str, ast_node_parent: &'a str) ->
119119
}
120120

121121
pub fn create_token_class<'a>(token_type: &'a str, tokeninfo: &'a str) -> ql::Class<'a> {
122-
let tokeninfo_arity = 6;
122+
let tokeninfo_arity = 5;
123123
let get_value = ql::Predicate {
124124
qldoc: Some(String::from("Gets the value of this token.")),
125125
name: "getValue",
126126
overridden: false,
127127
return_type: Some(ql::Type::String),
128128
formal_parameters: vec![],
129-
body: create_get_field_expr_for_column_storage("result", tokeninfo, 3, tokeninfo_arity),
129+
body: create_get_field_expr_for_column_storage("result", tokeninfo, 2, tokeninfo_arity),
130130
};
131131
let get_location = ql::Predicate {
132132
qldoc: Some(String::from("Gets the location of this token.")),
133133
name: "getLocation",
134134
overridden: true,
135135
return_type: Some(ql::Type::Normal("Location")),
136136
formal_parameters: vec![],
137-
body: create_get_field_expr_for_column_storage("result", tokeninfo, 4, tokeninfo_arity),
137+
body: create_get_field_expr_for_column_storage("result", tokeninfo, 3, tokeninfo_arity),
138138
};
139139
let to_string = ql::Predicate {
140140
qldoc: Some(String::from(

ql/lib/codeql/ruby/ast/internal/TreeSitter.qll

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,10 @@ module Ruby {
3434
/** A token. */
3535
class Token extends @ruby_token, AstNode {
3636
/** Gets the value of this token. */
37-
string getValue() { ruby_tokeninfo(this, _, _, _, result, _) }
37+
string getValue() { ruby_tokeninfo(this, _, _, result, _) }
3838

3939
/** Gets the location of this token. */
40-
override Location getLocation() { ruby_tokeninfo(this, _, _, _, _, result) }
40+
override Location getLocation() { ruby_tokeninfo(this, _, _, _, result) }
4141

4242
/** Gets a string representation of this element. */
4343
override string toString() { result = getValue() }
@@ -1875,10 +1875,10 @@ module Erb {
18751875
/** A token. */
18761876
class Token extends @erb_token, AstNode {
18771877
/** Gets the value of this token. */
1878-
string getValue() { erb_tokeninfo(this, _, _, _, result, _) }
1878+
string getValue() { erb_tokeninfo(this, _, _, result, _) }
18791879

18801880
/** Gets the location of this token. */
1881-
override Location getLocation() { erb_tokeninfo(this, _, _, _, _, result) }
1881+
override Location getLocation() { erb_tokeninfo(this, _, _, _, result) }
18821882

18831883
/** Gets a string representation of this element. */
18841884
override string toString() { result = getValue() }

ql/lib/ruby.dbscheme

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1206,7 +1206,6 @@ ruby_tokeninfo(
12061206
unique int id: @ruby_token,
12071207
int kind: int ref,
12081208
int file: @file ref,
1209-
int idx: int ref,
12101209
string value: string ref,
12111210
int loc: @location ref
12121211
);
@@ -1294,7 +1293,6 @@ erb_tokeninfo(
12941293
unique int id: @erb_token,
12951294
int kind: int ref,
12961295
int file: @file ref,
1297-
int idx: int ref,
12981296
string value: string ref,
12991297
int loc: @location ref
13001298
);

0 commit comments

Comments
 (0)