mirror of
https://github.com/github/codeql.git
synced 2026-07-08 13:05:36 +02:00
Compare commits
27 Commits
codeql-cli
...
mbg/go/1.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e660b852c0 | ||
|
|
da12b33b86 | ||
|
|
fe6d3648ae | ||
|
|
649bf5ac3b | ||
|
|
bd89eb075f | ||
|
|
23d1dfa17d | ||
|
|
f2695d008f | ||
|
|
9ca75369fc | ||
|
|
a6557fc4e5 | ||
|
|
7589186583 | ||
|
|
3a8a7ea67d | ||
|
|
f6e577e791 | ||
|
|
77cf0ac7a7 | ||
|
|
76e27ff74a | ||
|
|
191f712ab3 | ||
|
|
5797dbab91 | ||
|
|
90068f6f7b | ||
|
|
47ad284171 | ||
|
|
221bab7136 | ||
|
|
91946de849 | ||
|
|
cd7cf4f6b4 | ||
|
|
bbe24060f9 | ||
|
|
f4b3dfc408 | ||
|
|
119256452f | ||
|
|
6b1bd05e5c | ||
|
|
299b2e4de8 | ||
|
|
e604749561 |
@@ -15,7 +15,7 @@ local_path_override(
|
||||
# see https://registry.bazel.build/ for a list of available packages
|
||||
|
||||
bazel_dep(name = "platforms", version = "0.0.10")
|
||||
bazel_dep(name = "rules_go", version = "0.49.0")
|
||||
bazel_dep(name = "rules_go", version = "0.49.0-codeql.1")
|
||||
bazel_dep(name = "rules_pkg", version = "0.10.1")
|
||||
bazel_dep(name = "rules_nodejs", version = "6.2.0-codeql.1")
|
||||
bazel_dep(name = "rules_python", version = "0.32.2")
|
||||
@@ -153,7 +153,7 @@ use_repo(
|
||||
)
|
||||
|
||||
go_sdk = use_extension("@rules_go//go:extensions.bzl", "go_sdk")
|
||||
go_sdk.download(version = "1.22.2")
|
||||
go_sdk.download(version = "1.23.0")
|
||||
|
||||
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
|
||||
go_deps.from_file(go_mod = "//go/extractor:go.mod")
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
.NET Core up to 3.1
|
||||
|
||||
.NET 5, .NET 6, .NET 7, .NET 8","``.sln``, ``.csproj``, ``.cs``, ``.cshtml``, ``.xaml``"
|
||||
Go (aka Golang), "Go up to 1.22", "Go 1.11 or more recent", ``.go``
|
||||
Go (aka Golang), "Go up to 1.23", "Go 1.11 or more recent", ``.go``
|
||||
Java,"Java 7 to 22 [5]_","javac (OpenJDK and Oracle JDK),
|
||||
|
||||
Eclipse compiler for Java (ECJ) [6]_",``.java``
|
||||
|
||||
@@ -4,7 +4,7 @@ inputs:
|
||||
go-test-version:
|
||||
description: Which Go version to use for running the tests
|
||||
required: false
|
||||
default: ~1.22.0
|
||||
default: "1.23.0"
|
||||
run-code-checks:
|
||||
description: Whether to run formatting, code and qhelp generation checks
|
||||
required: false
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref);
|
||||
|
||||
diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref,
|
||||
string full_error_message: string ref, int location: @location ref);
|
||||
|
||||
locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref,
|
||||
int endLine: int ref, int endColumn: int ref);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
class Type_ extends @type {
|
||||
string toString() { result = "Type" }
|
||||
}
|
||||
|
||||
// The schema for types and typename are:
|
||||
//
|
||||
// types(unique int id: @type, int kind: int ref);
|
||||
// objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
from Type_ type, int object, int kind
|
||||
where
|
||||
objects(type, object) and
|
||||
types(type, kind) and
|
||||
kind != 40 // @typealias
|
||||
select type, object
|
||||
@@ -0,0 +1,549 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref);
|
||||
|
||||
diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref,
|
||||
string full_error_message: string ref, int location: @location ref);
|
||||
|
||||
locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref,
|
||||
int endLine: int ref, int endColumn: int ref);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
alias_rhs(unique int alias: @typealias ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype
|
||||
| 40 = @typealias;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype | @typealias;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
class Type_ extends @type {
|
||||
string toString() { result = "Type" }
|
||||
}
|
||||
|
||||
class Object_ extends @object {
|
||||
string toString() { result = "Object" }
|
||||
}
|
||||
|
||||
// The schema for types and typename are:
|
||||
//
|
||||
// types(unique int id: @type, int kind: int ref);
|
||||
// type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
from Type_ type, Object_ object, int kind
|
||||
where
|
||||
type_objects(type, object) and
|
||||
types(type, kind) and
|
||||
kind != 40 // @typealias
|
||||
select type, object
|
||||
@@ -0,0 +1,14 @@
|
||||
class Type_ extends @type {
|
||||
string toString() { result = "Type" }
|
||||
}
|
||||
|
||||
// The schema for types and typename are:
|
||||
//
|
||||
// types(unique int id: @type, int kind: int ref);
|
||||
// typename(unique int tp: @type ref, string name: string ref);
|
||||
from Type_ type, string name, int kind
|
||||
where
|
||||
typename(type, name) and
|
||||
types(type, kind) and
|
||||
kind != 40 // @typealias
|
||||
select type, name
|
||||
@@ -0,0 +1,12 @@
|
||||
class Type_ extends @type {
|
||||
string toString() { result = "Type" }
|
||||
}
|
||||
|
||||
// The schema for types is:
|
||||
//
|
||||
// types(unique int id: @type, int kind: int ref);
|
||||
from Type_ type, int kind
|
||||
where
|
||||
types(type, kind) and
|
||||
kind != 40 // @typealias
|
||||
select type, kind
|
||||
@@ -0,0 +1,7 @@
|
||||
description: Remove support for type aliases
|
||||
compatibility: full
|
||||
|
||||
alias_rhs.rel: delete
|
||||
types.rel: run types.qlo
|
||||
typename.rel: run typename.qlo
|
||||
type_objects.rel: run type_objects.qlo
|
||||
@@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var minGoVersion = util.NewSemVer("1.11")
|
||||
var maxGoVersion = util.NewSemVer("1.22")
|
||||
var maxGoVersion = util.NewSemVer("1.23")
|
||||
|
||||
type versionInfo struct {
|
||||
goModVersion util.SemVer // The version of Go found in the go directive in the `go.mod` file.
|
||||
|
||||
@@ -861,6 +861,9 @@ var NamedType = TypeKind.NewBranch("@namedtype", CompositeType)
|
||||
// TypeSetLiteral is the type of type set literals
|
||||
var TypeSetLiteral = TypeKind.NewBranch("@typesetliteraltype", CompositeType)
|
||||
|
||||
// TypeAlias is the type of type aliases
|
||||
var TypeAlias = TypeKind.NewBranch("@typealias", CompositeType)
|
||||
|
||||
// PackageType is the type of packages
|
||||
var PackageType = NewPrimaryKeyType("@package")
|
||||
|
||||
@@ -1142,6 +1145,12 @@ var UnderlyingTypeTable = NewTable("underlying_type",
|
||||
EntityColumn(TypeType, "tp"),
|
||||
)
|
||||
|
||||
// AliasRhsTable is the table associating type aliases with their RHS.
|
||||
var AliasRhsTable = NewTable("alias_rhs",
|
||||
EntityColumn(TypeAlias, "alias").Unique(),
|
||||
EntityColumn(TypeType, "tp"),
|
||||
)
|
||||
|
||||
// ComponentTypesTable is the table associating composite types with their component types
|
||||
var ComponentTypesTable = NewTable("component_types",
|
||||
EntityColumn(CompositeType, "parent"),
|
||||
|
||||
@@ -1607,15 +1607,7 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
|
||||
extractUnderlyingType(tw, lbl, underlying)
|
||||
trackInstantiatedStructFields(tw, tp, origintp)
|
||||
|
||||
entitylbl, exists := tw.Labeler.LookupObjectID(origintp.Obj(), lbl)
|
||||
if entitylbl == trap.InvalidLabel {
|
||||
log.Printf("Omitting type-object binding for unknown object %v.\n", origintp.Obj())
|
||||
} else {
|
||||
if !exists {
|
||||
extractObject(tw, origintp.Obj(), entitylbl)
|
||||
}
|
||||
dbscheme.TypeObjectTable.Emit(tw, lbl, entitylbl)
|
||||
}
|
||||
extractTypeObject(tw, lbl, origintp.Obj())
|
||||
|
||||
// ensure all methods have labels - note that methods do not have a
|
||||
// parent scope, so they are not dealt with by `extractScopes`
|
||||
@@ -1647,6 +1639,12 @@ func extractType(tw *trap.Writer, tp types.Type) trap.Label {
|
||||
}
|
||||
extractComponentType(tw, lbl, i, tildeStr, term.Type())
|
||||
}
|
||||
case *types.Alias:
|
||||
kind = dbscheme.TypeAlias.Index()
|
||||
dbscheme.TypeNameTable.Emit(tw, lbl, tp.Obj().Name())
|
||||
dbscheme.AliasRhsTable.Emit(tw, lbl, extractType(tw, tp.Rhs()))
|
||||
|
||||
extractTypeObject(tw, lbl, tp.Obj())
|
||||
default:
|
||||
log.Fatalf("unexpected type %T", tp)
|
||||
}
|
||||
@@ -1790,6 +1788,19 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
|
||||
fmt.Fprintf(&b, "{%s}", compLbl)
|
||||
}
|
||||
lbl = tw.Labeler.GlobalID(fmt.Sprintf("%s;typesetliteraltype", b.String()))
|
||||
case *types.Alias:
|
||||
// Ensure that the definition of the aliased type gets extracted
|
||||
// (which may be an alias in itself).
|
||||
extractType(tw, tp.Rhs())
|
||||
|
||||
entitylbl, exists := tw.Labeler.LookupObjectID(tp.Obj(), lbl)
|
||||
if entitylbl == trap.InvalidLabel {
|
||||
panic(fmt.Sprintf("Cannot construct label for alias type %v (underlying object is %v).\n", tp, tp.Obj()))
|
||||
}
|
||||
if !exists {
|
||||
extractObject(tw, tp.Obj(), entitylbl)
|
||||
}
|
||||
lbl = tw.Labeler.GlobalID(fmt.Sprintf("{%s};aliastype", entitylbl))
|
||||
default:
|
||||
log.Fatalf("(getTypeLabel) unexpected type %T", tp)
|
||||
}
|
||||
@@ -1798,6 +1809,19 @@ func getTypeLabel(tw *trap.Writer, tp types.Type) (trap.Label, bool) {
|
||||
return lbl, exists
|
||||
}
|
||||
|
||||
// extractTypeObject extracts a single type object and emits it to the type object table.
|
||||
func extractTypeObject(tw *trap.Writer, lbl trap.Label, entity *types.TypeName) {
|
||||
entitylbl, exists := tw.Labeler.LookupObjectID(entity, lbl)
|
||||
if entitylbl == trap.InvalidLabel {
|
||||
log.Printf("Omitting type-object binding for unknown object %v.\n", entity)
|
||||
} else {
|
||||
if !exists {
|
||||
extractObject(tw, entity, entitylbl)
|
||||
}
|
||||
dbscheme.TypeObjectTable.Emit(tw, lbl, entitylbl)
|
||||
}
|
||||
}
|
||||
|
||||
// extractKeyType extracts `key` as the key type of the map type `mp`
|
||||
func extractKeyType(tw *trap.Writer, mp trap.Label, key types.Type) {
|
||||
dbscheme.KeyTypeTable.Emit(tw, mp, extractType(tw, key))
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
module github.com/github/codeql-go/extractor
|
||||
|
||||
go 1.22.0
|
||||
go 1.23
|
||||
|
||||
toolchain go1.23.0
|
||||
|
||||
// when updating this, run
|
||||
// bazel run @rules_go//go -- mod tidy
|
||||
|
||||
4
go/ql/lib/change-notes/2024-08-22-go-1.23-supported.md
Normal file
4
go/ql/lib/change-notes/2024-08-22-go-1.23-supported.md
Normal file
@@ -0,0 +1,4 @@
|
||||
---
|
||||
category: majorAnalysis
|
||||
---
|
||||
* Go 1.23 has been included in the range of supported Go versions.
|
||||
@@ -204,6 +204,8 @@ base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
alias_rhs(unique int alias: @typealias ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
@@ -501,7 +503,8 @@ case @type.kind of
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
| 39 = @typesetliteraltype
|
||||
| 40 = @typealias;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@@ -525,7 +528,7 @@ case @type.kind of
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
| @signaturetype | @namedtype | @typesetliteraltype | @typealias;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
|
||||
@@ -1007,6 +1007,25 @@ class NamedType extends @namedtype, CompositeType {
|
||||
override Type getUnderlyingType() { result = this.getBaseType().getUnderlyingType() }
|
||||
}
|
||||
|
||||
/** An alias type. */
|
||||
class AliasType extends @typealias, CompositeType {
|
||||
/** Gets the aliased type (i.e. that appears on the RHS of the alias definition). */
|
||||
Type getRhs() { alias_rhs(this, result) }
|
||||
|
||||
override Type getUnderlyingType() { result = unalias(this).getUnderlyingType() }
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the non-alias type at the end of the alias chain starting at `t`.
|
||||
*
|
||||
* If `t` is not an alias type then `result` is `t`.
|
||||
*/
|
||||
Type unalias(Type t) {
|
||||
not t instanceof AliasType and result = t
|
||||
or
|
||||
result = unalias(t.(AliasType).getRhs())
|
||||
}
|
||||
|
||||
/**
|
||||
* A type that implements the builtin interface `error`.
|
||||
*/
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,549 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref);
|
||||
|
||||
diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref,
|
||||
string full_error_message: string ref, int location: @location ref);
|
||||
|
||||
locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref,
|
||||
int endLine: int ref, int endColumn: int ref);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
alias_rhs(unique int alias: @typealias ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype
|
||||
| 40 = @typealias;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype | @typealias;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,546 @@
|
||||
/** Auto-generated dbscheme; do not edit. */
|
||||
|
||||
|
||||
/** Duplicate code **/
|
||||
|
||||
duplicateCode(
|
||||
unique int id : @duplication,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
similarCode(
|
||||
unique int id : @similarity,
|
||||
varchar(900) relativePath : string ref,
|
||||
int equivClass : int ref);
|
||||
|
||||
@duplication_or_similarity = @duplication | @similarity;
|
||||
|
||||
tokens(
|
||||
int id : @duplication_or_similarity ref,
|
||||
int offset : int ref,
|
||||
int beginLine : int ref,
|
||||
int beginColumn : int ref,
|
||||
int endLine : int ref,
|
||||
int endColumn : int ref);
|
||||
|
||||
/** External data **/
|
||||
|
||||
externalData(
|
||||
int id : @externalDataElement,
|
||||
varchar(900) path : string ref,
|
||||
int column: int ref,
|
||||
varchar(900) value : string ref
|
||||
);
|
||||
|
||||
snapshotDate(unique date snapshotDate : date ref);
|
||||
|
||||
sourceLocationPrefix(varchar(900) prefix : string ref);
|
||||
|
||||
|
||||
/*
|
||||
* XML Files
|
||||
*/
|
||||
|
||||
xmlEncoding(
|
||||
unique int id: @file ref,
|
||||
string encoding: string ref
|
||||
);
|
||||
|
||||
xmlDTDs(
|
||||
unique int id: @xmldtd,
|
||||
string root: string ref,
|
||||
string publicId: string ref,
|
||||
string systemId: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlElements(
|
||||
unique int id: @xmlelement,
|
||||
string name: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlAttrs(
|
||||
unique int id: @xmlattribute,
|
||||
int elementid: @xmlelement ref,
|
||||
string name: string ref,
|
||||
string value: string ref,
|
||||
int idx: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlNs(
|
||||
int id: @xmlnamespace,
|
||||
string prefixName: string ref,
|
||||
string URI: string ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlHasNs(
|
||||
int elementId: @xmlnamespaceable ref,
|
||||
int nsId: @xmlnamespace ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlComments(
|
||||
unique int id: @xmlcomment,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
xmlChars(
|
||||
unique int id: @xmlcharacters,
|
||||
string text: string ref,
|
||||
int parentid: @xmlparent ref,
|
||||
int idx: int ref,
|
||||
int isCDATA: int ref,
|
||||
int fileid: @file ref
|
||||
);
|
||||
|
||||
@xmlparent = @file | @xmlelement;
|
||||
@xmlnamespaceable = @xmlelement | @xmlattribute;
|
||||
|
||||
xmllocations(
|
||||
int xmlElement: @xmllocatable ref,
|
||||
int location: @location_default ref
|
||||
);
|
||||
|
||||
@xmllocatable = @xmlcharacters | @xmlelement | @xmlcomment | @xmlattribute | @xmldtd | @file | @xmlnamespace;
|
||||
|
||||
compilations(unique int id: @compilation, string cwd: string ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_args(int id: @compilation ref, int num: int ref, string arg: string ref);
|
||||
|
||||
#keyset[id, num, kind]
|
||||
compilation_time(int id: @compilation ref, int num: int ref, int kind: int ref, float secs: float ref);
|
||||
|
||||
diagnostic_for(unique int diagnostic: @diagnostic ref, int compilation: @compilation ref, int file_number: int ref, int file_number_diagnostic_number: int ref);
|
||||
|
||||
compilation_finished(unique int id: @compilation ref, float cpu_seconds: float ref, float elapsed_seconds: float ref);
|
||||
|
||||
#keyset[id, num]
|
||||
compilation_compiling_files(int id: @compilation ref, int num: int ref, int file: @file ref);
|
||||
|
||||
diagnostics(unique int id: @diagnostic, int severity: int ref, string error_tag: string ref, string error_message: string ref,
|
||||
string full_error_message: string ref, int location: @location ref);
|
||||
|
||||
locations_default(unique int id: @location_default, int file: @file ref, int beginLine: int ref, int beginColumn: int ref,
|
||||
int endLine: int ref, int endColumn: int ref);
|
||||
|
||||
numlines(int element_id: @sourceline ref, int num_lines: int ref, int num_code: int ref, int num_comment: int ref);
|
||||
|
||||
files(unique int id: @file, string name: string ref);
|
||||
|
||||
folders(unique int id: @folder, string name: string ref);
|
||||
|
||||
containerparent(int parent: @container ref, unique int child: @container ref);
|
||||
|
||||
has_location(unique int locatable: @locatable ref, int location: @location ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
comment_groups(unique int id: @comment_group, int parent: @file ref, int idx: int ref);
|
||||
|
||||
comments(unique int id: @comment, int kind: int ref, int parent: @comment_group ref, int idx: int ref, string text: string ref);
|
||||
|
||||
doc_comments(unique int node: @documentable ref, int comment: @comment_group ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
exprs(unique int id: @expr, int kind: int ref, int parent: @exprparent ref, int idx: int ref);
|
||||
|
||||
literals(unique int expr: @expr ref, string value: string ref, string raw: string ref);
|
||||
|
||||
constvalues(unique int expr: @expr ref, string value: string ref, string exact: string ref);
|
||||
|
||||
fields(unique int id: @field, int parent: @fieldparent ref, int idx: int ref);
|
||||
|
||||
typeparamdecls(unique int id: @typeparamdecl, int parent: @typeparamdeclparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
stmts(unique int id: @stmt, int kind: int ref, int parent: @stmtparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
decls(unique int id: @decl, int kind: int ref, int parent: @declparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
specs(unique int id: @spec, int kind: int ref, int parent: @gendecl ref, int idx: int ref);
|
||||
|
||||
scopes(unique int id: @scope, int kind: int ref);
|
||||
|
||||
scopenesting(unique int inner: @scope ref, int outer: @scope ref);
|
||||
|
||||
scopenodes(unique int node: @scopenode ref, int scope: @localscope ref);
|
||||
|
||||
objects(unique int id: @object, int kind: int ref, string name: string ref);
|
||||
|
||||
objectscopes(unique int object: @object ref, int scope: @scope ref);
|
||||
|
||||
objecttypes(unique int object: @object ref, int tp: @type ref);
|
||||
|
||||
methodreceivers(unique int method: @object ref, int receiver: @object ref);
|
||||
|
||||
fieldstructs(unique int field: @object ref, int struct: @structtype ref);
|
||||
|
||||
methodhosts(int method: @object ref, int host: @namedtype ref);
|
||||
|
||||
defs(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
uses(int ident: @ident ref, int object: @object ref);
|
||||
|
||||
types(unique int id: @type, int kind: int ref);
|
||||
|
||||
type_of(unique int expr: @expr ref, int tp: @type ref);
|
||||
|
||||
typename(unique int tp: @type ref, string name: string ref);
|
||||
|
||||
key_type(unique int map: @maptype ref, int tp: @type ref);
|
||||
|
||||
element_type(unique int container: @containertype ref, int tp: @type ref);
|
||||
|
||||
base_type(unique int ptr: @pointertype ref, int tp: @type ref);
|
||||
|
||||
underlying_type(unique int named: @namedtype ref, int tp: @type ref);
|
||||
|
||||
#keyset[parent, index]
|
||||
component_types(int parent: @compositetype ref, int index: int ref, string name: string ref, int tp: @type ref);
|
||||
|
||||
array_length(unique int tp: @arraytype ref, string len: string ref);
|
||||
|
||||
type_objects(unique int tp: @type ref, int object: @object ref);
|
||||
|
||||
packages(unique int id: @package, string name: string ref, string path: string ref, int scope: @packagescope ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modexprs(unique int id: @modexpr, int kind: int ref, int parent: @modexprparent ref, int idx: int ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
modtokens(string token: string ref, int parent: @modexpr ref, int idx: int ref);
|
||||
|
||||
#keyset[package, idx]
|
||||
errors(unique int id: @error, int kind: int ref, string msg: string ref, string rawpos: string ref,
|
||||
string file: string ref, int line: int ref, int col: int ref, int package: @package ref, int idx: int ref);
|
||||
|
||||
has_ellipsis(int id: @callorconversionexpr ref);
|
||||
|
||||
variadic(int id: @signaturetype ref);
|
||||
|
||||
#keyset[parent, idx]
|
||||
typeparam(unique int tp: @typeparamtype ref, string name: string ref, int bound: @compositetype ref,
|
||||
int parent: @typeparamparentobject ref, int idx: int ref);
|
||||
|
||||
@container = @file | @folder;
|
||||
|
||||
@locatable = @xmllocatable | @node | @localscope;
|
||||
|
||||
@node = @documentable | @exprparent | @modexprparent | @fieldparent | @stmtparent | @declparent | @typeparamdeclparent
|
||||
| @scopenode | @comment_group | @comment;
|
||||
|
||||
@documentable = @file | @field | @typeparamdecl | @spec | @gendecl | @funcdecl | @modexpr;
|
||||
|
||||
@exprparent = @funcdef | @file | @expr | @field | @stmt | @decl | @typeparamdecl | @spec;
|
||||
|
||||
@modexprparent = @file | @modexpr;
|
||||
|
||||
@fieldparent = @decl | @structtypeexpr | @functypeexpr | @interfacetypeexpr;
|
||||
|
||||
@stmtparent = @funcdef | @stmt | @decl;
|
||||
|
||||
@declparent = @file | @declstmt;
|
||||
|
||||
@typeparamdeclparent = @funcdecl | @typespec;
|
||||
|
||||
@funcdef = @funclit | @funcdecl;
|
||||
|
||||
@scopenode = @file | @functypeexpr | @blockstmt | @ifstmt | @caseclause | @switchstmt | @commclause | @loopstmt;
|
||||
|
||||
@location = @location_default;
|
||||
|
||||
@sourceline = @locatable;
|
||||
|
||||
case @comment.kind of
|
||||
0 = @slashslashcomment
|
||||
| 1 = @slashstarcomment;
|
||||
|
||||
case @expr.kind of
|
||||
0 = @badexpr
|
||||
| 1 = @ident
|
||||
| 2 = @ellipsis
|
||||
| 3 = @intlit
|
||||
| 4 = @floatlit
|
||||
| 5 = @imaglit
|
||||
| 6 = @charlit
|
||||
| 7 = @stringlit
|
||||
| 8 = @funclit
|
||||
| 9 = @compositelit
|
||||
| 10 = @parenexpr
|
||||
| 11 = @selectorexpr
|
||||
| 12 = @indexexpr
|
||||
| 13 = @genericfunctioninstantiationexpr
|
||||
| 14 = @generictypeinstantiationexpr
|
||||
| 15 = @sliceexpr
|
||||
| 16 = @typeassertexpr
|
||||
| 17 = @callorconversionexpr
|
||||
| 18 = @starexpr
|
||||
| 19 = @keyvalueexpr
|
||||
| 20 = @arraytypeexpr
|
||||
| 21 = @structtypeexpr
|
||||
| 22 = @functypeexpr
|
||||
| 23 = @interfacetypeexpr
|
||||
| 24 = @maptypeexpr
|
||||
| 25 = @typesetliteralexpr
|
||||
| 26 = @plusexpr
|
||||
| 27 = @minusexpr
|
||||
| 28 = @notexpr
|
||||
| 29 = @complementexpr
|
||||
| 30 = @derefexpr
|
||||
| 31 = @addressexpr
|
||||
| 32 = @arrowexpr
|
||||
| 33 = @lorexpr
|
||||
| 34 = @landexpr
|
||||
| 35 = @eqlexpr
|
||||
| 36 = @neqexpr
|
||||
| 37 = @lssexpr
|
||||
| 38 = @leqexpr
|
||||
| 39 = @gtrexpr
|
||||
| 40 = @geqexpr
|
||||
| 41 = @addexpr
|
||||
| 42 = @subexpr
|
||||
| 43 = @orexpr
|
||||
| 44 = @xorexpr
|
||||
| 45 = @mulexpr
|
||||
| 46 = @quoexpr
|
||||
| 47 = @remexpr
|
||||
| 48 = @shlexpr
|
||||
| 49 = @shrexpr
|
||||
| 50 = @andexpr
|
||||
| 51 = @andnotexpr
|
||||
| 52 = @sendchantypeexpr
|
||||
| 53 = @recvchantypeexpr
|
||||
| 54 = @sendrcvchantypeexpr;
|
||||
|
||||
@basiclit = @intlit | @floatlit | @imaglit | @charlit | @stringlit;
|
||||
|
||||
@operatorexpr = @logicalexpr | @arithmeticexpr | @bitwiseexpr | @unaryexpr | @binaryexpr;
|
||||
|
||||
@logicalexpr = @logicalunaryexpr | @logicalbinaryexpr;
|
||||
|
||||
@arithmeticexpr = @arithmeticunaryexpr | @arithmeticbinaryexpr;
|
||||
|
||||
@bitwiseexpr = @bitwiseunaryexpr | @bitwisebinaryexpr;
|
||||
|
||||
@unaryexpr = @logicalunaryexpr | @bitwiseunaryexpr | @arithmeticunaryexpr | @derefexpr | @addressexpr | @arrowexpr;
|
||||
|
||||
@logicalunaryexpr = @notexpr;
|
||||
|
||||
@bitwiseunaryexpr = @complementexpr;
|
||||
|
||||
@arithmeticunaryexpr = @plusexpr | @minusexpr;
|
||||
|
||||
@binaryexpr = @logicalbinaryexpr | @bitwisebinaryexpr | @arithmeticbinaryexpr | @comparison;
|
||||
|
||||
@logicalbinaryexpr = @lorexpr | @landexpr;
|
||||
|
||||
@bitwisebinaryexpr = @shiftexpr | @orexpr | @xorexpr | @andexpr | @andnotexpr;
|
||||
|
||||
@arithmeticbinaryexpr = @addexpr | @subexpr | @mulexpr | @quoexpr | @remexpr;
|
||||
|
||||
@shiftexpr = @shlexpr | @shrexpr;
|
||||
|
||||
@comparison = @equalitytest | @relationalcomparison;
|
||||
|
||||
@equalitytest = @eqlexpr | @neqexpr;
|
||||
|
||||
@relationalcomparison = @lssexpr | @leqexpr | @gtrexpr | @geqexpr;
|
||||
|
||||
@chantypeexpr = @sendchantypeexpr | @recvchantypeexpr | @sendrcvchantypeexpr;
|
||||
|
||||
case @stmt.kind of
|
||||
0 = @badstmt
|
||||
| 1 = @declstmt
|
||||
| 2 = @emptystmt
|
||||
| 3 = @labeledstmt
|
||||
| 4 = @exprstmt
|
||||
| 5 = @sendstmt
|
||||
| 6 = @incstmt
|
||||
| 7 = @decstmt
|
||||
| 8 = @gostmt
|
||||
| 9 = @deferstmt
|
||||
| 10 = @returnstmt
|
||||
| 11 = @breakstmt
|
||||
| 12 = @continuestmt
|
||||
| 13 = @gotostmt
|
||||
| 14 = @fallthroughstmt
|
||||
| 15 = @blockstmt
|
||||
| 16 = @ifstmt
|
||||
| 17 = @caseclause
|
||||
| 18 = @exprswitchstmt
|
||||
| 19 = @typeswitchstmt
|
||||
| 20 = @commclause
|
||||
| 21 = @selectstmt
|
||||
| 22 = @forstmt
|
||||
| 23 = @rangestmt
|
||||
| 24 = @assignstmt
|
||||
| 25 = @definestmt
|
||||
| 26 = @addassignstmt
|
||||
| 27 = @subassignstmt
|
||||
| 28 = @mulassignstmt
|
||||
| 29 = @quoassignstmt
|
||||
| 30 = @remassignstmt
|
||||
| 31 = @andassignstmt
|
||||
| 32 = @orassignstmt
|
||||
| 33 = @xorassignstmt
|
||||
| 34 = @shlassignstmt
|
||||
| 35 = @shrassignstmt
|
||||
| 36 = @andnotassignstmt;
|
||||
|
||||
@incdecstmt = @incstmt | @decstmt;
|
||||
|
||||
@assignment = @simpleassignstmt | @compoundassignstmt;
|
||||
|
||||
@simpleassignstmt = @assignstmt | @definestmt;
|
||||
|
||||
@compoundassignstmt = @addassignstmt | @subassignstmt | @mulassignstmt | @quoassignstmt | @remassignstmt
|
||||
| @andassignstmt | @orassignstmt | @xorassignstmt | @shlassignstmt | @shrassignstmt | @andnotassignstmt;
|
||||
|
||||
@branchstmt = @breakstmt | @continuestmt | @gotostmt | @fallthroughstmt;
|
||||
|
||||
@switchstmt = @exprswitchstmt | @typeswitchstmt;
|
||||
|
||||
@loopstmt = @forstmt | @rangestmt;
|
||||
|
||||
case @decl.kind of
|
||||
0 = @baddecl
|
||||
| 1 = @importdecl
|
||||
| 2 = @constdecl
|
||||
| 3 = @typedecl
|
||||
| 4 = @vardecl
|
||||
| 5 = @funcdecl;
|
||||
|
||||
@gendecl = @importdecl | @constdecl | @typedecl | @vardecl;
|
||||
|
||||
case @spec.kind of
|
||||
0 = @importspec
|
||||
| 1 = @valuespec
|
||||
| 2 = @typedefspec
|
||||
| 3 = @aliasspec;
|
||||
|
||||
@typespec = @typedefspec | @aliasspec;
|
||||
|
||||
case @object.kind of
|
||||
0 = @pkgobject
|
||||
| 1 = @decltypeobject
|
||||
| 2 = @builtintypeobject
|
||||
| 3 = @declconstobject
|
||||
| 4 = @builtinconstobject
|
||||
| 5 = @declvarobject
|
||||
| 6 = @declfunctionobject
|
||||
| 7 = @builtinfunctionobject
|
||||
| 8 = @labelobject;
|
||||
|
||||
@typeparamparentobject = @decltypeobject | @declfunctionobject;
|
||||
|
||||
@declobject = @decltypeobject | @declconstobject | @declvarobject | @declfunctionobject;
|
||||
|
||||
@builtinobject = @builtintypeobject | @builtinconstobject | @builtinfunctionobject;
|
||||
|
||||
@typeobject = @decltypeobject | @builtintypeobject;
|
||||
|
||||
@valueobject = @constobject | @varobject | @functionobject;
|
||||
|
||||
@constobject = @declconstobject | @builtinconstobject;
|
||||
|
||||
@varobject = @declvarobject;
|
||||
|
||||
@functionobject = @declfunctionobject | @builtinfunctionobject;
|
||||
|
||||
case @scope.kind of
|
||||
0 = @universescope
|
||||
| 1 = @packagescope
|
||||
| 2 = @localscope;
|
||||
|
||||
case @type.kind of
|
||||
0 = @invalidtype
|
||||
| 1 = @boolexprtype
|
||||
| 2 = @inttype
|
||||
| 3 = @int8type
|
||||
| 4 = @int16type
|
||||
| 5 = @int32type
|
||||
| 6 = @int64type
|
||||
| 7 = @uinttype
|
||||
| 8 = @uint8type
|
||||
| 9 = @uint16type
|
||||
| 10 = @uint32type
|
||||
| 11 = @uint64type
|
||||
| 12 = @uintptrtype
|
||||
| 13 = @float32type
|
||||
| 14 = @float64type
|
||||
| 15 = @complex64type
|
||||
| 16 = @complex128type
|
||||
| 17 = @stringexprtype
|
||||
| 18 = @unsafepointertype
|
||||
| 19 = @boolliteraltype
|
||||
| 20 = @intliteraltype
|
||||
| 21 = @runeliteraltype
|
||||
| 22 = @floatliteraltype
|
||||
| 23 = @complexliteraltype
|
||||
| 24 = @stringliteraltype
|
||||
| 25 = @nilliteraltype
|
||||
| 26 = @typeparamtype
|
||||
| 27 = @arraytype
|
||||
| 28 = @slicetype
|
||||
| 29 = @structtype
|
||||
| 30 = @pointertype
|
||||
| 31 = @interfacetype
|
||||
| 32 = @tupletype
|
||||
| 33 = @signaturetype
|
||||
| 34 = @maptype
|
||||
| 35 = @sendchantype
|
||||
| 36 = @recvchantype
|
||||
| 37 = @sendrcvchantype
|
||||
| 38 = @namedtype
|
||||
| 39 = @typesetliteraltype;
|
||||
|
||||
@basictype = @booltype | @numerictype | @stringtype | @literaltype | @invalidtype | @unsafepointertype;
|
||||
|
||||
@booltype = @boolexprtype | @boolliteraltype;
|
||||
|
||||
@numerictype = @integertype | @floattype | @complextype;
|
||||
|
||||
@integertype = @signedintegertype | @unsignedintegertype;
|
||||
|
||||
@signedintegertype = @inttype | @int8type | @int16type | @int32type | @int64type | @intliteraltype | @runeliteraltype;
|
||||
|
||||
@unsignedintegertype = @uinttype | @uint8type | @uint16type | @uint32type | @uint64type | @uintptrtype;
|
||||
|
||||
@floattype = @float32type | @float64type | @floatliteraltype;
|
||||
|
||||
@complextype = @complex64type | @complex128type | @complexliteraltype;
|
||||
|
||||
@stringtype = @stringexprtype | @stringliteraltype;
|
||||
|
||||
@literaltype = @boolliteraltype | @intliteraltype | @runeliteraltype | @floatliteraltype | @complexliteraltype
|
||||
| @stringliteraltype | @nilliteraltype;
|
||||
|
||||
@compositetype = @typeparamtype | @containertype | @structtype | @pointertype | @interfacetype | @tupletype
|
||||
| @signaturetype | @namedtype | @typesetliteraltype;
|
||||
|
||||
@containertype = @arraytype | @slicetype | @maptype | @chantype;
|
||||
|
||||
@chantype = @sendchantype | @recvchantype | @sendrcvchantype;
|
||||
|
||||
case @modexpr.kind of
|
||||
0 = @modcommentblock
|
||||
| 1 = @modline
|
||||
| 2 = @modlineblock
|
||||
| 3 = @modlparen
|
||||
| 4 = @modrparen;
|
||||
|
||||
case @error.kind of
|
||||
0 = @unknownerror
|
||||
| 1 = @listerror
|
||||
| 2 = @parseerror
|
||||
| 3 = @typeerror;
|
||||
|
||||
@@ -0,0 +1,2 @@
|
||||
description: Add support for type aliases
|
||||
compatibility: full
|
||||
@@ -41,7 +41,7 @@ module UntrustedToPassthroughTypeConversionConfig implements DataFlow::ConfigSig
|
||||
additional predicate isSinkToPassthroughType(DataFlow::TypeCastNode sink, PassthroughTypeName name) {
|
||||
exists(Type typ |
|
||||
typ = sink.getResultType() and
|
||||
typ.getUnderlyingType*().hasQualifiedName("html/template", name)
|
||||
unalias(typ).hasQualifiedName("html/template", name)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ module PassthroughTypeConversionToTemplateExecutionCallConfig implements DataFlo
|
||||
) {
|
||||
exists(Type typ |
|
||||
typ = source.getResultType() and
|
||||
typ.getUnderlyingType*().hasQualifiedName("html/template", name)
|
||||
unalias(typ).hasQualifiedName("html/template", name)
|
||||
)
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| -:0:0:0:0 | package ; expected main |
|
||||
| -:0:0:0:0 | package ; expected package main |
|
||||
| broken2/test1.go:4:2:4:2 | undefined: fmt |
|
||||
| broken2/test1.go:5:2:5:2 | undefined: fmt |
|
||||
| broken2/test1.go:5:14:5:14 | undefined: a |
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
| main.go:3:6:3:11 | status | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | status |
|
||||
| main.go:5:6:5:12 | intlist | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | []int |
|
||||
| main.go:5:6:5:12 | intlist | package github.com/github/codeql-go/ql/test/library-tests/semmle/go/Decl | intlist |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| -:0:0:0:0 | package ; expected nonexistent |
|
||||
| -:0:0:0:0 | package ; expected package nonexistent |
|
||||
| vendor/github.com/github/nonexistent/bad.go:1:57:1:57 | expected ';', found 'EOF' |
|
||||
| vendor/github.com/github/nonexistent/bad.go:1:57:1:57 | expected 'IDENT', found 'EOF' |
|
||||
| vendor/github.com/github/nonexistent/bad.go:1:57:1:57 | expected 'package', found 'EOF' |
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
| genericFunctions.go:25:2:25:33 | generic function instantiation expression | genericFunctions.go:25:2:25:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:25:30:25:32 | int |
|
||||
| genericFunctions.go:26:2:26:36 | generic function instantiation expression | genericFunctions.go:26:2:26:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:26:30:26:35 | string |
|
||||
| genericFunctions.go:44:6:44:48 | generic function instantiation expression | genericFunctions.go:44:6:44:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:44:35:44:40 | string |
|
||||
| genericFunctions.go:44:6:44:48 | generic function instantiation expression | genericFunctions.go:44:6:44:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:44:43:44:47 | int64 |
|
||||
| genericFunctions.go:45:6:45:50 | generic function instantiation expression | genericFunctions.go:45:6:45:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:45:35:45:40 | string |
|
||||
| genericFunctions.go:45:6:45:50 | generic function instantiation expression | genericFunctions.go:45:6:45:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:45:43:45:49 | float64 |
|
||||
| genericFunctions.go:141:6:141:41 | generic function instantiation expression | genericFunctions.go:141:6:141:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:141:35:141:40 | string |
|
||||
| genericFunctions.go:146:6:146:55 | generic function instantiation expression | genericFunctions.go:146:6:146:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:146:49:146:54 | string |
|
||||
| genericFunctions.go:27:2:27:33 | generic function instantiation expression | genericFunctions.go:27:2:27:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:27:30:27:32 | int |
|
||||
| genericFunctions.go:28:2:28:36 | generic function instantiation expression | genericFunctions.go:28:2:28:28 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:28:30:28:35 | string |
|
||||
| genericFunctions.go:46:6:46:48 | generic function instantiation expression | genericFunctions.go:46:6:46:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:46:35:46:40 | string |
|
||||
| genericFunctions.go:46:6:46:48 | generic function instantiation expression | genericFunctions.go:46:6:46:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:46:43:46:47 | int64 |
|
||||
| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:47:35:47:40 | string |
|
||||
| genericFunctions.go:47:6:47:50 | generic function instantiation expression | genericFunctions.go:47:6:47:33 | GenericFunctionTwoTypeParams | 1 | genericFunctions.go:47:43:47:49 | float64 |
|
||||
| genericFunctions.go:149:6:149:41 | generic function instantiation expression | genericFunctions.go:149:6:149:33 | GenericFunctionInAnotherFile | 0 | genericFunctions.go:149:35:149:40 | string |
|
||||
| genericFunctions.go:154:6:154:55 | generic function instantiation expression | genericFunctions.go:154:6:154:47 | selection of GenericFunctionInAnotherPackage | 0 | genericFunctions.go:154:49:154:54 | string |
|
||||
|
||||
@@ -1,30 +1,45 @@
|
||||
| E | Ordered |
|
||||
| E | any |
|
||||
| E | comparable |
|
||||
| E | interface { } |
|
||||
| E1 | interface { } |
|
||||
| E2 | interface { } |
|
||||
| Edge | EdgeConstraint |
|
||||
| Edge | interface { } |
|
||||
| E | interface { ~uint16 \| ~uint32 } |
|
||||
| E1 | any |
|
||||
| E2 | any |
|
||||
| F | floaty |
|
||||
| K | comparable |
|
||||
| Node | NodeConstraint |
|
||||
| Node | interface { } |
|
||||
| S | interface { } |
|
||||
| K | any |
|
||||
| N | interface { int64 \| uint64 } |
|
||||
| S | interface { ~[]E } |
|
||||
| S1 | interface { ~[]E1 } |
|
||||
| S2 | interface { ~[]E2 } |
|
||||
| SF2 | interface { } |
|
||||
| SG2 | interface { } |
|
||||
| Slice | interface { ~[]E } |
|
||||
| T | Ordered |
|
||||
| T | any |
|
||||
| T | comparable |
|
||||
| T | interface { string \| []uint8 } |
|
||||
| T | interface { } |
|
||||
| T1 | interface { } |
|
||||
| T2 | interface { } |
|
||||
| TF1 | interface { } |
|
||||
| TF2 | interface { } |
|
||||
| TG1 | interface { } |
|
||||
| TG2 | interface { } |
|
||||
| U | interface { } |
|
||||
| V | interface { int64 \| float64 } |
|
||||
| T1 | any |
|
||||
| T2 | any |
|
||||
| TP101 | any |
|
||||
| TP102 | comparable |
|
||||
| TP103 | interface { int64 \| float64 } |
|
||||
| TP104 | interface { } |
|
||||
| TP105 | any |
|
||||
| TP106 | any |
|
||||
| TP107 | interface { } |
|
||||
| TP108 | interface { } |
|
||||
| TP109 | any |
|
||||
| TP110 | any |
|
||||
| TP111 | any |
|
||||
| TP112 | any |
|
||||
| TP113 | any |
|
||||
| TP114 | any |
|
||||
| TP115 | any |
|
||||
| TP116 | any |
|
||||
| TP117 | any |
|
||||
| TP118 | NodeConstraint |
|
||||
| TP119 | EdgeConstraint |
|
||||
| TP120 | NodeConstraint |
|
||||
| TP121 | EdgeConstraint |
|
||||
| TP122 | NodeConstraint |
|
||||
| TP123 | EdgeConstraint |
|
||||
| TP200 | any |
|
||||
| V | any |
|
||||
| bytes | interface { []uint8 \| string } |
|
||||
|
||||
@@ -2,18 +2,20 @@ package main
|
||||
|
||||
import "github.com/anotherpkg"
|
||||
|
||||
type T1 map[string][]string
|
||||
type T2 T1
|
||||
type DefinedType1 map[string][]string
|
||||
type DefinedType2 DefinedType1
|
||||
type AliasType1 = DefinedType2
|
||||
type AliasType2 = AliasType1
|
||||
|
||||
// A generic function with one type parameter
|
||||
func GenericFunctionOneTypeParam[T any](t T) T {
|
||||
var r T
|
||||
func GenericFunctionOneTypeParam[TP101 any](t TP101) TP101 {
|
||||
var r TP101
|
||||
return r
|
||||
}
|
||||
|
||||
// A generic function with two type parameter
|
||||
func GenericFunctionTwoTypeParams[K comparable, V int64 | float64](m map[K]V) V {
|
||||
var s V
|
||||
func GenericFunctionTwoTypeParams[TP102 comparable, TP103 int64 | float64](m map[TP102]TP103) TP103 {
|
||||
var s TP103
|
||||
for _, v := range m {
|
||||
s += v
|
||||
}
|
||||
@@ -70,32 +72,38 @@ func generic_functions() {
|
||||
// Slice write
|
||||
sliceVar[0] = -1
|
||||
|
||||
// Access a map through two type aliases
|
||||
aliasedMap := T2{"key": []string{"value"}}
|
||||
// Access a map through two named types
|
||||
mapThroughNamedTypes := DefinedType2{"key": []string{"value"}}
|
||||
// Map read
|
||||
_ = aliasedMap["key"]
|
||||
_ = mapThroughNamedTypes["key"]
|
||||
// Map write
|
||||
aliasedMap["key"][0] = "new value"
|
||||
mapThroughNamedTypes["key"][0] = "new value"
|
||||
// Access a map through two type aliases and two named types
|
||||
mapThroughAliasedTypes := AliasType2{"key": []string{"value"}}
|
||||
// Map read
|
||||
_ = mapThroughAliasedTypes["key"]
|
||||
// Map write
|
||||
mapThroughAliasedTypes["key"][0] = "new value"
|
||||
}
|
||||
|
||||
type GenericStruct1[T any] struct {
|
||||
type GenericStruct1[TP104 interface{}] struct {
|
||||
}
|
||||
|
||||
type GenericStruct2[S, T any] struct {
|
||||
type GenericStruct2[TP105, TP106 any] struct {
|
||||
}
|
||||
|
||||
func (x GenericStruct1[TF1]) f1() TF1 {
|
||||
var r TF1
|
||||
func (x GenericStruct1[TP107]) f1() TP107 {
|
||||
var r TP107
|
||||
return r
|
||||
}
|
||||
|
||||
func (x *GenericStruct1[TG1]) g1() {
|
||||
func (x *GenericStruct1[TP108]) g1() {
|
||||
}
|
||||
|
||||
func (x GenericStruct2[SF2, TF2]) f2() {
|
||||
func (x GenericStruct2[TP109, TP110]) f2() {
|
||||
}
|
||||
|
||||
func (x *GenericStruct2[SG2, TG2]) g2() {
|
||||
func (x *GenericStruct2[TP111, TP112]) g2() {
|
||||
}
|
||||
|
||||
func call_methods_with_generic_receiver() {
|
||||
@@ -108,34 +116,34 @@ func call_methods_with_generic_receiver() {
|
||||
x2.g2()
|
||||
}
|
||||
|
||||
type Element[S any] struct {
|
||||
list *List[S]
|
||||
type Element[TP113 any] struct {
|
||||
list *List[TP113]
|
||||
}
|
||||
|
||||
type List[T any] struct {
|
||||
root Element[T]
|
||||
type List[TP114 any] struct {
|
||||
root Element[TP114]
|
||||
}
|
||||
|
||||
// Len is the number of elements in the list.
|
||||
func (l *List[U]) MyLen() int {
|
||||
func (l *List[TP115]) MyLen() int {
|
||||
return 0
|
||||
}
|
||||
|
||||
type NodeConstraint[Edge any] interface {
|
||||
Edges() []Edge
|
||||
type NodeConstraint[TP116 any] interface {
|
||||
Edges() []TP116
|
||||
}
|
||||
|
||||
type EdgeConstraint[Node any] interface {
|
||||
Nodes() (from, to Node)
|
||||
type EdgeConstraint[TP117 any] interface {
|
||||
Nodes() (from, to TP117)
|
||||
}
|
||||
|
||||
type Graph[Node NodeConstraint[Edge], Edge EdgeConstraint[Node]] struct{}
|
||||
type Graph[TP118 NodeConstraint[TP119], TP119 EdgeConstraint[TP118]] struct{}
|
||||
|
||||
func New[Node NodeConstraint[Edge], Edge EdgeConstraint[Node]](nodes []Node) *Graph[Node, Edge] {
|
||||
func New[TP120 NodeConstraint[TP121], TP121 EdgeConstraint[TP120]](nodes []TP120) *Graph[TP120, TP121] {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (g *Graph[Node, Edge]) ShortestPath(from, to Node) []Edge { return []Edge{} }
|
||||
func (g *Graph[TP122, TP123]) ShortestPath(from, to TP122) []TP123 { return []TP123{} }
|
||||
|
||||
func callFunctionsInAnotherFile() {
|
||||
_ = GenericFunctionInAnotherFile[string]("world")
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package main
|
||||
|
||||
func GenericFunctionInAnotherFile[T any](t T) T {
|
||||
var r T
|
||||
func GenericFunctionInAnotherFile[TP200 any](t TP200) TP200 {
|
||||
var r TP200
|
||||
return r
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 0 | genericFunctions2.go:3:42:3:42 | t |
|
||||
| genericFunctions.go:9:6:9:32 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:9:41:9:41 | t |
|
||||
| genericFunctions.go:15:6:15:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:15:68:15:68 | m |
|
||||
| genericFunctions.go:87:30:87:31 | f1 | -1 | genericFunctions.go:87:7:87:7 | x |
|
||||
| genericFunctions.go:92:31:92:32 | g1 | -1 | genericFunctions.go:92:7:92:7 | x |
|
||||
| genericFunctions.go:95:35:95:36 | f2 | -1 | genericFunctions.go:95:7:95:7 | x |
|
||||
| genericFunctions.go:98:36:98:37 | g2 | -1 | genericFunctions.go:98:7:98:7 | x |
|
||||
| genericFunctions.go:120:19:120:23 | MyLen | -1 | genericFunctions.go:120:7:120:7 | l |
|
||||
| genericFunctions.go:134:6:134:8 | New | 0 | genericFunctions.go:134:64:134:68 | nodes |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | 0 | genericFunctions.go:138:42:138:45 | from |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | 1 | genericFunctions.go:138:48:138:49 | to |
|
||||
| genericFunctions.go:138:29:138:40 | ShortestPath | -1 | genericFunctions.go:138:7:138:7 | g |
|
||||
| genericFunctions2.go:3:6:3:33 | GenericFunctionInAnotherFile | 0 | genericFunctions2.go:3:46:3:46 | t |
|
||||
| genericFunctions.go:11:6:11:32 | GenericFunctionOneTypeParam | 0 | genericFunctions.go:11:45:11:45 | t |
|
||||
| genericFunctions.go:17:6:17:33 | GenericFunctionTwoTypeParams | 0 | genericFunctions.go:17:76:17:76 | m |
|
||||
| genericFunctions.go:95:32:95:33 | f1 | -1 | genericFunctions.go:95:7:95:7 | x |
|
||||
| genericFunctions.go:100:33:100:34 | g1 | -1 | genericFunctions.go:100:7:100:7 | x |
|
||||
| genericFunctions.go:103:39:103:40 | f2 | -1 | genericFunctions.go:103:7:103:7 | x |
|
||||
| genericFunctions.go:106:40:106:41 | g2 | -1 | genericFunctions.go:106:7:106:7 | x |
|
||||
| genericFunctions.go:128:23:128:27 | MyLen | -1 | genericFunctions.go:128:7:128:7 | l |
|
||||
| genericFunctions.go:142:6:142:8 | New | 0 | genericFunctions.go:142:68:142:72 | nodes |
|
||||
| genericFunctions.go:146:31:146:42 | ShortestPath | 0 | genericFunctions.go:146:44:146:47 | from |
|
||||
| genericFunctions.go:146:31:146:42 | ShortestPath | 1 | genericFunctions.go:146:50:146:51 | to |
|
||||
| genericFunctions.go:146:31:146:42 | ShortestPath | -1 | genericFunctions.go:146:7:146:7 | g |
|
||||
| main.go:7:6:7:7 | f1 | 0 | main.go:7:9:7:9 | x |
|
||||
| main.go:9:12:9:13 | f2 | 0 | main.go:9:15:9:15 | x |
|
||||
| main.go:9:12:9:13 | f2 | 1 | main.go:9:18:9:18 | y |
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
| genericFunctions2.go:3:1:6:1 | function declaration | FuncDecl | 0 | genericFunctions2.go:3:35:3:39 | type parameter declaration | 0 | genericFunctions2.go:3:35:3:35 | T | genericFunctions2.go:3:37:3:39 | any | interface { } |
|
||||
| genericFunctions.go:9:1:12:1 | function declaration | FuncDecl | 0 | genericFunctions.go:9:34:9:38 | type parameter declaration | 0 | genericFunctions.go:9:34:9:34 | T | genericFunctions.go:9:36:9:38 | any | interface { } |
|
||||
| genericFunctions.go:15:1:21:1 | function declaration | FuncDecl | 0 | genericFunctions.go:15:35:15:46 | type parameter declaration | 0 | genericFunctions.go:15:35:15:35 | K | genericFunctions.go:15:37:15:46 | comparable | comparable |
|
||||
| genericFunctions.go:15:1:21:1 | function declaration | FuncDecl | 1 | genericFunctions.go:15:49:15:65 | type parameter declaration | 0 | genericFunctions.go:15:49:15:49 | V | genericFunctions.go:15:51:15:65 | type set literal | interface { int64 \| float64 } |
|
||||
| genericFunctions.go:81:6:82:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:81:21:81:25 | type parameter declaration | 0 | genericFunctions.go:81:21:81:21 | T | genericFunctions.go:81:23:81:25 | any | interface { } |
|
||||
| genericFunctions.go:84:6:85:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:84:21:84:28 | type parameter declaration | 0 | genericFunctions.go:84:21:84:21 | S | genericFunctions.go:84:26:84:28 | any | interface { } |
|
||||
| genericFunctions.go:84:6:85:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:84:21:84:28 | type parameter declaration | 1 | genericFunctions.go:84:24:84:24 | T | genericFunctions.go:84:26:84:28 | any | interface { } |
|
||||
| genericFunctions.go:111:6:113:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:111:14:111:18 | type parameter declaration | 0 | genericFunctions.go:111:14:111:14 | S | genericFunctions.go:111:16:111:18 | any | interface { } |
|
||||
| genericFunctions.go:115:6:117:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:115:11:115:15 | type parameter declaration | 0 | genericFunctions.go:115:11:115:11 | T | genericFunctions.go:115:13:115:15 | any | interface { } |
|
||||
| genericFunctions.go:124:6:126:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:124:21:124:28 | type parameter declaration | 0 | genericFunctions.go:124:21:124:24 | Edge | genericFunctions.go:124:26:124:28 | any | interface { } |
|
||||
| genericFunctions.go:128:6:130:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:128:21:128:28 | type parameter declaration | 0 | genericFunctions.go:128:21:128:24 | Node | genericFunctions.go:128:26:128:28 | any | interface { } |
|
||||
| genericFunctions.go:132:6:132:73 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:132:12:132:36 | type parameter declaration | 0 | genericFunctions.go:132:12:132:15 | Node | genericFunctions.go:132:17:132:36 | generic type instantiation expression | NodeConstraint |
|
||||
| genericFunctions.go:132:6:132:73 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:132:39:132:63 | type parameter declaration | 0 | genericFunctions.go:132:39:132:42 | Edge | genericFunctions.go:132:44:132:63 | generic type instantiation expression | EdgeConstraint |
|
||||
| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 0 | genericFunctions.go:134:10:134:34 | type parameter declaration | 0 | genericFunctions.go:134:10:134:13 | Node | genericFunctions.go:134:15:134:34 | generic type instantiation expression | NodeConstraint |
|
||||
| genericFunctions.go:134:1:136:1 | function declaration | FuncDecl | 1 | genericFunctions.go:134:37:134:61 | type parameter declaration | 0 | genericFunctions.go:134:37:134:40 | Edge | genericFunctions.go:134:42:134:61 | generic type instantiation expression | EdgeConstraint |
|
||||
| genericFunctions2.go:3:1:6:1 | function declaration | FuncDecl | 0 | genericFunctions2.go:3:35:3:43 | type parameter declaration | 0 | genericFunctions2.go:3:35:3:39 | TP200 | genericFunctions2.go:3:41:3:43 | any | any |
|
||||
| genericFunctions.go:11:1:14:1 | function declaration | FuncDecl | 0 | genericFunctions.go:11:34:11:42 | type parameter declaration | 0 | genericFunctions.go:11:34:11:38 | TP101 | genericFunctions.go:11:40:11:42 | any | any |
|
||||
| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 0 | genericFunctions.go:17:35:17:50 | type parameter declaration | 0 | genericFunctions.go:17:35:17:39 | TP102 | genericFunctions.go:17:41:17:50 | comparable | comparable |
|
||||
| genericFunctions.go:17:1:23:1 | function declaration | FuncDecl | 1 | genericFunctions.go:17:53:17:73 | type parameter declaration | 0 | genericFunctions.go:17:53:17:57 | TP103 | genericFunctions.go:17:59:17:73 | type set literal | interface { int64 \| float64 } |
|
||||
| genericFunctions.go:89:6:90:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:89:21:89:37 | type parameter declaration | 0 | genericFunctions.go:89:21:89:25 | TP104 | genericFunctions.go:89:27:89:37 | interface type | interface { } |
|
||||
| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 0 | genericFunctions.go:92:21:92:25 | TP105 | genericFunctions.go:92:34:92:36 | any | any |
|
||||
| genericFunctions.go:92:6:93:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:92:21:92:36 | type parameter declaration | 1 | genericFunctions.go:92:28:92:32 | TP106 | genericFunctions.go:92:34:92:36 | any | any |
|
||||
| genericFunctions.go:119:6:121:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:119:14:119:22 | type parameter declaration | 0 | genericFunctions.go:119:14:119:18 | TP113 | genericFunctions.go:119:20:119:22 | any | any |
|
||||
| genericFunctions.go:123:6:125:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:123:11:123:19 | type parameter declaration | 0 | genericFunctions.go:123:11:123:15 | TP114 | genericFunctions.go:123:17:123:19 | any | any |
|
||||
| genericFunctions.go:132:6:134:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:132:21:132:29 | type parameter declaration | 0 | genericFunctions.go:132:21:132:25 | TP116 | genericFunctions.go:132:27:132:29 | any | any |
|
||||
| genericFunctions.go:136:6:138:1 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:136:21:136:29 | type parameter declaration | 0 | genericFunctions.go:136:21:136:25 | TP117 | genericFunctions.go:136:27:136:29 | any | any |
|
||||
| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 0 | genericFunctions.go:140:12:140:38 | type parameter declaration | 0 | genericFunctions.go:140:12:140:16 | TP118 | genericFunctions.go:140:18:140:38 | generic type instantiation expression | NodeConstraint |
|
||||
| genericFunctions.go:140:6:140:77 | type declaration specifier | TypeSpec | 1 | genericFunctions.go:140:41:140:67 | type parameter declaration | 0 | genericFunctions.go:140:41:140:45 | TP119 | genericFunctions.go:140:47:140:67 | generic type instantiation expression | EdgeConstraint |
|
||||
| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 0 | genericFunctions.go:142:10:142:36 | type parameter declaration | 0 | genericFunctions.go:142:10:142:14 | TP120 | genericFunctions.go:142:16:142:36 | generic type instantiation expression | NodeConstraint |
|
||||
| genericFunctions.go:142:1:144:1 | function declaration | FuncDecl | 1 | genericFunctions.go:142:39:142:65 | type parameter declaration | 0 | genericFunctions.go:142:39:142:43 | TP121 | genericFunctions.go:142:45:142:65 | generic type instantiation expression | EdgeConstraint |
|
||||
|
||||
@@ -53,10 +53,10 @@ input.go:
|
||||
# 20| 0: [CallExpr] call to Println
|
||||
# 20| Type = (int, error)
|
||||
# 20| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 20| Type = func([]interface { }) int, error
|
||||
# 20| Type = func([]any) int, error
|
||||
# 20| 0: [Ident, PackageName] fmt
|
||||
# 20| 1: [FunctionName, Ident] Println
|
||||
# 20| Type = func([]interface { }) int, error
|
||||
# 20| Type = func([]any) int, error
|
||||
# 20| 1: [StringLit] "Hi"
|
||||
# 20| Type = string
|
||||
# 20| Value = [StringLit] Hi
|
||||
@@ -203,10 +203,10 @@ input.go:
|
||||
# 52| 0: [CallExpr] call to Println
|
||||
# 52| Type = (int, error)
|
||||
# 52| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 52| Type = func([]interface { }) int, error
|
||||
# 52| Type = func([]any) int, error
|
||||
# 52| 0: [Ident, PackageName] fmt
|
||||
# 52| 1: [FunctionName, Ident] Println
|
||||
# 52| Type = func([]interface { }) int, error
|
||||
# 52| Type = func([]any) int, error
|
||||
# 52| 1: [StringLit] "Heard from ch1"
|
||||
# 52| Type = string
|
||||
# 52| Value = [StringLit] Heard from ch1
|
||||
@@ -229,20 +229,20 @@ input.go:
|
||||
# 54| 0: [CallExpr] call to Println
|
||||
# 54| Type = (int, error)
|
||||
# 54| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 54| Type = func([]interface { }) int, error
|
||||
# 54| Type = func([]any) int, error
|
||||
# 54| 0: [Ident, PackageName] fmt
|
||||
# 54| 1: [FunctionName, Ident] Println
|
||||
# 54| Type = func([]interface { }) int, error
|
||||
# 54| Type = func([]any) int, error
|
||||
# 54| 1: [Ident, VariableName] a
|
||||
# 54| Type = [1]float32
|
||||
# 55| 2: [ExprStmt] expression statement
|
||||
# 55| 0: [CallExpr] call to Println
|
||||
# 55| Type = (int, error)
|
||||
# 55| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 55| Type = func([]interface { }) int, error
|
||||
# 55| Type = func([]any) int, error
|
||||
# 55| 0: [Ident, PackageName] fmt
|
||||
# 55| 1: [FunctionName, Ident] Println
|
||||
# 55| Type = func([]interface { }) int, error
|
||||
# 55| Type = func([]any) int, error
|
||||
# 55| 1: [Ident, VariableName] w
|
||||
# 55| Type = bool
|
||||
# 56| 2: [CommClause] comm clause
|
||||
@@ -250,10 +250,10 @@ input.go:
|
||||
# 57| 0: [CallExpr] call to Println
|
||||
# 57| Type = (int, error)
|
||||
# 57| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 57| Type = func([]interface { }) int, error
|
||||
# 57| Type = func([]any) int, error
|
||||
# 57| 0: [Ident, PackageName] fmt
|
||||
# 57| 1: [FunctionName, Ident] Println
|
||||
# 57| Type = func([]interface { }) int, error
|
||||
# 57| Type = func([]any) int, error
|
||||
# 58| 3: [CommClause] comm clause
|
||||
# 58| 0: [SendStmt] send statement
|
||||
# 58| 0: [Ident, VariableName] ch1
|
||||
@@ -297,10 +297,10 @@ input.go:
|
||||
# 67| 0: [CallExpr] call to Println
|
||||
# 67| Type = (int, error)
|
||||
# 67| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 67| Type = func([]interface { }) int, error
|
||||
# 67| Type = func([]any) int, error
|
||||
# 67| 0: [Ident, PackageName] fmt
|
||||
# 67| 1: [FunctionName, Ident] Println
|
||||
# 67| Type = func([]interface { }) int, error
|
||||
# 67| Type = func([]any) int, error
|
||||
# 67| 1: [Ident, VariableName] x
|
||||
# 67| Type = int
|
||||
# 68| 2: [BlockStmt] block statement
|
||||
@@ -316,10 +316,10 @@ input.go:
|
||||
# 69| 0: [CallExpr] call to Println
|
||||
# 69| Type = (int, error)
|
||||
# 69| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 69| Type = func([]interface { }) int, error
|
||||
# 69| Type = func([]any) int, error
|
||||
# 69| 0: [Ident, PackageName] fmt
|
||||
# 69| 1: [FunctionName, Ident] Println
|
||||
# 69| Type = func([]interface { }) int, error
|
||||
# 69| Type = func([]any) int, error
|
||||
# 69| 1: [MinusExpr] -...
|
||||
# 69| Type = int
|
||||
# 69| 0: [Ident, VariableName] x
|
||||
@@ -474,10 +474,10 @@ input.go:
|
||||
# 115| 0: [CallExpr] call to Println
|
||||
# 115| Type = (int, error)
|
||||
# 115| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 115| Type = func([]interface { }) int, error
|
||||
# 115| Type = func([]any) int, error
|
||||
# 115| 0: [Ident, PackageName] fmt
|
||||
# 115| 1: [FunctionName, Ident] Println
|
||||
# 115| Type = func([]interface { }) int, error
|
||||
# 115| Type = func([]any) int, error
|
||||
# 115| 1: [Ident, VariableName] y
|
||||
# 115| Type = interface { }
|
||||
# 116| 1: [CaseClause] case clause
|
||||
@@ -566,10 +566,10 @@ input.go:
|
||||
# 138| 0: [CallExpr] call to Print
|
||||
# 138| Type = (int, error)
|
||||
# 138| 0: [FunctionName, SelectorExpr] selection of Print
|
||||
# 138| Type = func([]interface { }) int, error
|
||||
# 138| Type = func([]any) int, error
|
||||
# 138| 0: [Ident, PackageName] fmt
|
||||
# 138| 1: [FunctionName, Ident] Print
|
||||
# 138| Type = func([]interface { }) int, error
|
||||
# 138| Type = func([]any) int, error
|
||||
# 138| 1: [Ident, VariableName] x
|
||||
# 138| Type = int
|
||||
# 141| 1: [RangeStmt] range statement
|
||||
@@ -584,10 +584,10 @@ input.go:
|
||||
# 142| 0: [CallExpr] call to Print
|
||||
# 142| Type = (int, error)
|
||||
# 142| 0: [FunctionName, SelectorExpr] selection of Print
|
||||
# 142| Type = func([]interface { }) int, error
|
||||
# 142| Type = func([]any) int, error
|
||||
# 142| 0: [Ident, PackageName] fmt
|
||||
# 142| 1: [FunctionName, Ident] Print
|
||||
# 142| Type = func([]interface { }) int, error
|
||||
# 142| Type = func([]any) int, error
|
||||
# 142| 1: [Ident, VariableName] i
|
||||
# 142| Type = int
|
||||
# 142| 2: [Ident, VariableName] v
|
||||
|
||||
@@ -33,10 +33,10 @@ input.go:
|
||||
# 20| 0: [CallExpr] call to Println
|
||||
# 20| Type = (int, error)
|
||||
# 20| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 20| Type = func([]interface { }) int, error
|
||||
# 20| Type = func([]any) int, error
|
||||
# 20| 0: [Ident, PackageName] fmt
|
||||
# 20| 1: [FunctionName, Ident] Println
|
||||
# 20| Type = func([]interface { }) int, error
|
||||
# 20| Type = func([]any) int, error
|
||||
# 20| 1: [StringLit] "Hi"
|
||||
# 20| Type = string
|
||||
# 20| Value = [StringLit] Hi
|
||||
@@ -183,10 +183,10 @@ input.go:
|
||||
# 52| 0: [CallExpr] call to Println
|
||||
# 52| Type = (int, error)
|
||||
# 52| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 52| Type = func([]interface { }) int, error
|
||||
# 52| Type = func([]any) int, error
|
||||
# 52| 0: [Ident, PackageName] fmt
|
||||
# 52| 1: [FunctionName, Ident] Println
|
||||
# 52| Type = func([]interface { }) int, error
|
||||
# 52| Type = func([]any) int, error
|
||||
# 52| 1: [StringLit] "Heard from ch1"
|
||||
# 52| Type = string
|
||||
# 52| Value = [StringLit] Heard from ch1
|
||||
@@ -209,20 +209,20 @@ input.go:
|
||||
# 54| 0: [CallExpr] call to Println
|
||||
# 54| Type = (int, error)
|
||||
# 54| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 54| Type = func([]interface { }) int, error
|
||||
# 54| Type = func([]any) int, error
|
||||
# 54| 0: [Ident, PackageName] fmt
|
||||
# 54| 1: [FunctionName, Ident] Println
|
||||
# 54| Type = func([]interface { }) int, error
|
||||
# 54| Type = func([]any) int, error
|
||||
# 54| 1: [Ident, VariableName] a
|
||||
# 54| Type = [1]float32
|
||||
# 55| 2: [ExprStmt] expression statement
|
||||
# 55| 0: [CallExpr] call to Println
|
||||
# 55| Type = (int, error)
|
||||
# 55| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 55| Type = func([]interface { }) int, error
|
||||
# 55| Type = func([]any) int, error
|
||||
# 55| 0: [Ident, PackageName] fmt
|
||||
# 55| 1: [FunctionName, Ident] Println
|
||||
# 55| Type = func([]interface { }) int, error
|
||||
# 55| Type = func([]any) int, error
|
||||
# 55| 1: [Ident, VariableName] w
|
||||
# 55| Type = bool
|
||||
# 56| 2: [CommClause] comm clause
|
||||
@@ -230,10 +230,10 @@ input.go:
|
||||
# 57| 0: [CallExpr] call to Println
|
||||
# 57| Type = (int, error)
|
||||
# 57| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 57| Type = func([]interface { }) int, error
|
||||
# 57| Type = func([]any) int, error
|
||||
# 57| 0: [Ident, PackageName] fmt
|
||||
# 57| 1: [FunctionName, Ident] Println
|
||||
# 57| Type = func([]interface { }) int, error
|
||||
# 57| Type = func([]any) int, error
|
||||
# 58| 3: [CommClause] comm clause
|
||||
# 58| 0: [SendStmt] send statement
|
||||
# 58| 0: [Ident, VariableName] ch1
|
||||
@@ -277,10 +277,10 @@ input.go:
|
||||
# 67| 0: [CallExpr] call to Println
|
||||
# 67| Type = (int, error)
|
||||
# 67| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 67| Type = func([]interface { }) int, error
|
||||
# 67| Type = func([]any) int, error
|
||||
# 67| 0: [Ident, PackageName] fmt
|
||||
# 67| 1: [FunctionName, Ident] Println
|
||||
# 67| Type = func([]interface { }) int, error
|
||||
# 67| Type = func([]any) int, error
|
||||
# 67| 1: [Ident, VariableName] x
|
||||
# 67| Type = int
|
||||
# 68| 2: [BlockStmt] block statement
|
||||
@@ -296,10 +296,10 @@ input.go:
|
||||
# 69| 0: [CallExpr] call to Println
|
||||
# 69| Type = (int, error)
|
||||
# 69| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 69| Type = func([]interface { }) int, error
|
||||
# 69| Type = func([]any) int, error
|
||||
# 69| 0: [Ident, PackageName] fmt
|
||||
# 69| 1: [FunctionName, Ident] Println
|
||||
# 69| Type = func([]interface { }) int, error
|
||||
# 69| Type = func([]any) int, error
|
||||
# 69| 1: [MinusExpr] -...
|
||||
# 69| Type = int
|
||||
# 69| 0: [Ident, VariableName] x
|
||||
@@ -454,10 +454,10 @@ input.go:
|
||||
# 115| 0: [CallExpr] call to Println
|
||||
# 115| Type = (int, error)
|
||||
# 115| 0: [FunctionName, SelectorExpr] selection of Println
|
||||
# 115| Type = func([]interface { }) int, error
|
||||
# 115| Type = func([]any) int, error
|
||||
# 115| 0: [Ident, PackageName] fmt
|
||||
# 115| 1: [FunctionName, Ident] Println
|
||||
# 115| Type = func([]interface { }) int, error
|
||||
# 115| Type = func([]any) int, error
|
||||
# 115| 1: [Ident, VariableName] y
|
||||
# 115| Type = interface { }
|
||||
# 116| 1: [CaseClause] case clause
|
||||
@@ -546,10 +546,10 @@ input.go:
|
||||
# 138| 0: [CallExpr] call to Print
|
||||
# 138| Type = (int, error)
|
||||
# 138| 0: [FunctionName, SelectorExpr] selection of Print
|
||||
# 138| Type = func([]interface { }) int, error
|
||||
# 138| Type = func([]any) int, error
|
||||
# 138| 0: [Ident, PackageName] fmt
|
||||
# 138| 1: [FunctionName, Ident] Print
|
||||
# 138| Type = func([]interface { }) int, error
|
||||
# 138| Type = func([]any) int, error
|
||||
# 138| 1: [Ident, VariableName] x
|
||||
# 138| Type = int
|
||||
# 141| 1: [RangeStmt] range statement
|
||||
@@ -564,10 +564,10 @@ input.go:
|
||||
# 142| 0: [CallExpr] call to Print
|
||||
# 142| Type = (int, error)
|
||||
# 142| 0: [FunctionName, SelectorExpr] selection of Print
|
||||
# 142| Type = func([]interface { }) int, error
|
||||
# 142| Type = func([]any) int, error
|
||||
# 142| 0: [Ident, PackageName] fmt
|
||||
# 142| 1: [FunctionName, Ident] Print
|
||||
# 142| Type = func([]interface { }) int, error
|
||||
# 142| Type = func([]any) int, error
|
||||
# 142| 1: [Ident, VariableName] i
|
||||
# 142| Type = int
|
||||
# 142| 2: [Ident, VariableName] v
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias | string | string |
|
||||
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignatureAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignature | func(T) T |
|
||||
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.SecondAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias | string |
|
||||
| github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.TypeAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericArray | [10]T |
|
||||
10
go/ql/test/library-tests/semmle/go/Types/Aliases.ql
Normal file
10
go/ql/test/library-tests/semmle/go/Types/Aliases.ql
Normal file
@@ -0,0 +1,10 @@
|
||||
import go
|
||||
|
||||
string getQualifiedNameIfExists(Type t) {
|
||||
if exists(t.getQualifiedName()) then result = t.getQualifiedName() else result = t.pp()
|
||||
}
|
||||
|
||||
from AliasType at, string filepath
|
||||
where at.hasLocationInfo(filepath, _, _, _, _) and filepath != ""
|
||||
select getQualifiedNameIfExists(at), getQualifiedNameIfExists(at.getRhs()),
|
||||
getQualifiedNameIfExists(at.getUnderlyingType())
|
||||
@@ -1,3 +1,5 @@
|
||||
| aliases.go:3:6:3:15 | FirstAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.FirstAlias |
|
||||
| aliases.go:4:6:4:16 | SecondAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.SecondAlias |
|
||||
| cyclic.go:3:6:3:6 | s | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.s |
|
||||
| cyclic.go:7:6:7:6 | t | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.t |
|
||||
| cyclic.go:12:6:12:6 | u | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.u |
|
||||
@@ -29,7 +31,9 @@
|
||||
| generic.go:47:6:47:16 | MyInterface | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.MyInterface |
|
||||
| generic.go:67:6:67:22 | HasBlankTypeParam | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParam |
|
||||
| generic.go:68:6:68:23 | HasBlankTypeParams | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.HasBlankTypeParams |
|
||||
| generic.go:82:6:82:14 | TypeAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.TypeAlias |
|
||||
| generic.go:84:6:84:21 | GenericSignature | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignature |
|
||||
| generic.go:85:6:85:26 | GenericSignatureAlias | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.GenericSignatureAlias |
|
||||
| interface.go:3:6:3:7 | i0 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i0 |
|
||||
| interface.go:5:6:5:7 | i1 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i1 |
|
||||
| interface.go:9:6:9:7 | i2 | github.com/github/codeql-go/ql/test/library-tests/semmle/go/Types.i2 |
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
| aliases.go:3:6:3:15 | FirstAlias | FirstAlias |
|
||||
| aliases.go:4:6:4:16 | SecondAlias | SecondAlias |
|
||||
| cyclic.go:3:6:3:6 | s | s |
|
||||
| cyclic.go:7:6:7:6 | t | t |
|
||||
| cyclic.go:12:6:12:6 | u | u |
|
||||
@@ -29,7 +31,9 @@
|
||||
| generic.go:47:6:47:16 | MyInterface | MyInterface |
|
||||
| generic.go:67:6:67:22 | HasBlankTypeParam | HasBlankTypeParam |
|
||||
| generic.go:68:6:68:23 | HasBlankTypeParams | HasBlankTypeParams |
|
||||
| generic.go:82:6:82:14 | TypeAlias | TypeAlias |
|
||||
| generic.go:84:6:84:21 | GenericSignature | GenericSignature |
|
||||
| generic.go:85:6:85:26 | GenericSignatureAlias | GenericSignatureAlias |
|
||||
| interface.go:3:6:3:7 | i0 | i0 |
|
||||
| interface.go:5:6:5:7 | i1 | i1 |
|
||||
| interface.go:9:6:9:7 | i2 | i2 |
|
||||
|
||||
4
go/ql/test/library-tests/semmle/go/Types/aliases.go
Normal file
4
go/ql/test/library-tests/semmle/go/Types/aliases.go
Normal file
@@ -0,0 +1,4 @@
|
||||
package main
|
||||
|
||||
type FirstAlias = string
|
||||
type SecondAlias = FirstAlias
|
||||
@@ -1,5 +1,5 @@
|
||||
| -:0:0:0:0 | malformed import path "github.com/github/codeql-go/ql/test/query-tests/Diagnostics/invalid{": invalid char '{' |
|
||||
| -:0:0:0:0 | package ; expected main |
|
||||
| -:0:0:0:0 | package ; expected package main |
|
||||
| bad.go:3:1:3:1 | expected 'package', found avvu |
|
||||
| bad.go:3:1:3:1 | expected 'package', found avvu |
|
||||
| bad.go:3:5:3:5 | expected 'IDENT', found newline |
|
||||
|
||||
@@ -4,4 +4,4 @@
|
||||
| Extraction failed with error expected 'IDENT', found newline | 2 |
|
||||
| Extraction failed with error expected 'package', found avvu | 2 |
|
||||
| Extraction failed with error malformed import path "github.com/github/codeql-go/ql/test/query-tests/Diagnostics/invalid{": invalid char '{' | 2 |
|
||||
| Extraction failed with error package ; expected main | 2 |
|
||||
| Extraction failed with error package ; expected package main | 2 |
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
| -:0:0:0:0 | package ; expected main |
|
||||
| -:0:0:0:0 | package ; expected package main |
|
||||
| empty-file.go:1:1:1:1 | expected ';', found 'EOF' |
|
||||
| empty-file.go:1:1:1:1 | expected 'IDENT', found 'EOF' |
|
||||
| empty-file.go:1:1:1:1 | expected 'package', found 'EOF' |
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
module(
|
||||
name = "rules_go",
|
||||
version = "0.49.0-codeql.1",
|
||||
compatibility_level = 0,
|
||||
repo_name = "io_bazel_rules_go",
|
||||
)
|
||||
|
||||
# The custom repo_name is used to prevent our bazel_features polyfill for WORKSPACE builds from
|
||||
# conflicting with the real bazel_features repo.
|
||||
bazel_dep(name = "bazel_features", version = "1.9.1", repo_name = "io_bazel_rules_go_bazel_features")
|
||||
bazel_dep(name = "bazel_skylib", version = "1.2.0")
|
||||
bazel_dep(name = "platforms", version = "0.0.10")
|
||||
bazel_dep(name = "rules_proto", version = "6.0.0")
|
||||
bazel_dep(name = "protobuf", version = "3.19.2", repo_name = "com_google_protobuf")
|
||||
|
||||
go_sdk = use_extension("//go:extensions.bzl", "go_sdk")
|
||||
go_sdk.download(
|
||||
name = "go_default_sdk",
|
||||
version = "1.21.8",
|
||||
)
|
||||
use_repo(
|
||||
go_sdk,
|
||||
"go_toolchains",
|
||||
# This name is ugly on purpose to avoid a conflict with a user-named SDK.
|
||||
"io_bazel_rules_nogo",
|
||||
)
|
||||
|
||||
register_toolchains("@go_toolchains//:all")
|
||||
|
||||
bazel_dep(name = "gazelle", version = "0.36.0")
|
||||
|
||||
go_deps = use_extension("@gazelle//:extensions.bzl", "go_deps")
|
||||
go_deps.from_file(go_mod = "//:go.mod")
|
||||
use_repo(
|
||||
go_deps,
|
||||
"com_github_gogo_protobuf",
|
||||
"com_github_golang_mock",
|
||||
"com_github_golang_protobuf",
|
||||
"org_golang_google_genproto",
|
||||
"org_golang_google_grpc",
|
||||
"org_golang_google_grpc_cmd_protoc_gen_go_grpc",
|
||||
"org_golang_google_protobuf",
|
||||
"org_golang_x_net",
|
||||
"org_golang_x_tools",
|
||||
# Exported by gazelle specifically for rules_go.
|
||||
"bazel_gazelle_go_repository_config",
|
||||
)
|
||||
@@ -0,0 +1,20 @@
|
||||
Taken from https://github.com/bazelbuild/rules_go/pull/4050/commits/55b4c07d3244c829c11f297335550f19fcc718bd
|
||||
diff --git a/go/private/context.bzl b/go/private/context.bzl
|
||||
index ad0270fe..0243a231 100644
|
||||
--- a/go/private/context.bzl
|
||||
+++ b/go/private/context.bzl
|
||||
@@ -439,6 +439,14 @@ def go_context(
|
||||
#
|
||||
# See https://go.dev/doc/toolchain for more info.
|
||||
"GOTOOLCHAIN": "local",
|
||||
+
|
||||
+ # NOTE(#4049): Since Go 1.23.0, os.Readlink (and consequently
|
||||
+ # filepath.EvalSymlinks) stopped treating Windows mount points and
|
||||
+ # reparse points (junctions) as symbolic links. Bazel uses junctions
|
||||
+ # when constructing exec roots, and we use filepath.EvalSymlinks in
|
||||
+ # GoStdlib, so this broke us. Setting GODEBUG=winsymlink=0 restores
|
||||
+ # the old behavior.
|
||||
+ "GODEBUG": "winsymlink=0",
|
||||
}
|
||||
|
||||
# Path mapping can't map the values of environment variables, so we pass GOROOT to the action
|
||||
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"integrity": "sha256-2T7wLx5yyC2Ls9UWlRmzYWezPPaMJSUl47nT1d0UPec=",
|
||||
"strip_prefix": "",
|
||||
"url": "https://github.com/bazelbuild/rules_go/releases/download/v0.49.0/rules_go-v0.49.0.zip",
|
||||
"patches": {
|
||||
"disable_winsymlink.patch": "sha256-o2DWpbkv9TK80evwEQCdDFSXGLlgoT5BZg7MnvE77Go="
|
||||
},
|
||||
"patch_strip": 1
|
||||
}
|
||||
33
misc/bazel/registry/modules/rules_go/metadata.json
Normal file
33
misc/bazel/registry/modules/rules_go/metadata.json
Normal file
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"homepage": "https://github.com/bazelbuild/rules_go",
|
||||
"maintainers": [
|
||||
{
|
||||
"email": "fabian@meumertzhe.im",
|
||||
"github": "fmeum",
|
||||
"name": "Fabian Meumertzheim"
|
||||
},
|
||||
{
|
||||
"email": "zplin@uber.com",
|
||||
"github": "linzhp",
|
||||
"name": "Zhongpeng Lin"
|
||||
},
|
||||
{
|
||||
"email": "tfrench@uber.com",
|
||||
"github": "tyler-french",
|
||||
"name": "Tyler French"
|
||||
}
|
||||
],
|
||||
"repository": [
|
||||
"github:bazelbuild/rules_go"
|
||||
],
|
||||
"versions": [
|
||||
"0.49.0-codeql.1"
|
||||
],
|
||||
"yanked_versions": {
|
||||
"0.33.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
|
||||
"0.34.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
|
||||
"0.35.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
|
||||
"0.36.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher",
|
||||
"0.37.0": "Obsolete experimental version that emits debug prints. Update to 0.39.1 or higher"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user