MCPcopy Create free account
hub / github.com/nsf/gocode / init

Function init

decl.go:1418–1492  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1416var g_universe_scope = new_scope(nil)
1417
1418func init() {
1419 builtin := ast.NewIdent("built-in")
1420
1421 add_type := func(name string) {
1422 d := new_decl(name, decl_type, g_universe_scope)
1423 d.typ = builtin
1424 g_universe_scope.add_named_decl(d)
1425 }
1426 add_type("bool")
1427 add_type("byte")
1428 add_type("complex64")
1429 add_type("complex128")
1430 add_type("float32")
1431 add_type("float64")
1432 add_type("int8")
1433 add_type("int16")
1434 add_type("int32")
1435 add_type("int64")
1436 add_type("string")
1437 add_type("uint8")
1438 add_type("uint16")
1439 add_type("uint32")
1440 add_type("uint64")
1441 add_type("int")
1442 add_type("uint")
1443 add_type("uintptr")
1444 add_type("rune")
1445
1446 add_const := func(name string) {
1447 d := new_decl(name, decl_const, g_universe_scope)
1448 d.typ = builtin
1449 g_universe_scope.add_named_decl(d)
1450 }
1451 add_const("true")
1452 add_const("false")
1453 add_const("iota")
1454 add_const("nil")
1455
1456 add_func := func(name, typ string) {
1457 d := new_decl(name, decl_func, g_universe_scope)
1458 d.typ = ast.NewIdent(typ)
1459 g_universe_scope.add_named_decl(d)
1460 }
1461 add_func("append", "func([]type, ...type) []type")
1462 add_func("cap", "func(container) int")
1463 add_func("close", "func(channel)")
1464 add_func("complex", "func(real, imag) complex")
1465 add_func("copy", "func(dst, src)")
1466 add_func("delete", "func(map[typeA]typeB, typeA)")
1467 add_func("imag", "func(complex)")
1468 add_func("len", "func(container) int")
1469 add_func("make", "func(type, len[, cap]) type")
1470 add_func("new", "func(type) *type")
1471 add_func("panic", "func(interface{})")
1472 add_func("print", "func(...interface{})")
1473 add_func("println", "func(...interface{})")
1474 add_func("real", "func(complex)")
1475 add_func("recover", "func() interface{}")

Callers

nothing calls this directly

Calls 2

new_declFunction · 0.85
add_named_declMethod · 0.80

Tested by

no test coverage detected