mirror of
https://github.com/abhigyanpatwari/GitNexus.git
synced 2026-11-12 08:41:34 +00:00
feat(go): add builtInNames set to Go language provider (#1886)
* feat(go): add builtInNames set to Go language provider Add GO_BUILT_INS (15 functions, 18 types, 3 values) to the Go LanguageProvider for parity with the other 13 language providers. The set is converted to an isBuiltInName predicate by defineLanguage() and consumed by the type-env return-type lookup to short-circuit lookups for Go built-in symbols. * feat(go): add Go 1.18+ and 1.21 predeclared identifiers to builtInNames Add `clear`, `min`, `max` (Go 1.21 builtins), `any`, `comparable` (Go 1.18 type aliases), and `iota` (predeclared constant) to GO_BUILT_INS for complete coverage of the Go specification. --------- Co-authored-by: Gergő Magyar <gergomagyar@icloud.com>
This commit is contained in:
parent
7b38b8aae2
commit
d71fd1688b
1 changed files with 51 additions and 0 deletions
|
|
@ -39,6 +39,56 @@ import {
|
|||
interpretGoTypeBinding,
|
||||
} from './go/index.js';
|
||||
|
||||
const GO_BUILT_INS: ReadonlySet<string> = new Set([
|
||||
// built-in functions
|
||||
'make',
|
||||
'new',
|
||||
'len',
|
||||
'cap',
|
||||
'append',
|
||||
'copy',
|
||||
'delete',
|
||||
'close',
|
||||
'panic',
|
||||
'recover',
|
||||
'print',
|
||||
'println',
|
||||
'complex',
|
||||
'real',
|
||||
'imag',
|
||||
'clear',
|
||||
'min',
|
||||
'max',
|
||||
// built-in types
|
||||
'error',
|
||||
'bool',
|
||||
'string',
|
||||
'int',
|
||||
'int8',
|
||||
'int16',
|
||||
'int32',
|
||||
'int64',
|
||||
'uint',
|
||||
'uint8',
|
||||
'uint16',
|
||||
'uint32',
|
||||
'uint64',
|
||||
'uintptr',
|
||||
'float32',
|
||||
'float64',
|
||||
'complex64',
|
||||
'complex128',
|
||||
'byte',
|
||||
'rune',
|
||||
'any',
|
||||
'comparable',
|
||||
// built-in values
|
||||
'true',
|
||||
'false',
|
||||
'nil',
|
||||
'iota',
|
||||
]);
|
||||
|
||||
export const goProvider = defineLanguage({
|
||||
id: SupportedLanguages.Go,
|
||||
extensions: ['.go'],
|
||||
|
|
@ -92,6 +142,7 @@ export const goProvider = defineLanguage({
|
|||
variableExtractor: createVariableExtractor(goVariableConfig),
|
||||
classExtractor: createClassExtractor(goClassConfig),
|
||||
heritageExtractor: createHeritageExtractor(goHeritageConfig),
|
||||
builtInNames: GO_BUILT_INS,
|
||||
|
||||
// ── RFC #909 Ring 3: scope-based resolution hooks ──────────
|
||||
emitScopeCaptures: emitGoScopeCaptures,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue