func newSymbolTable(kind symbolTableKind, name string, version int32, imports ...SymbolTable) *SymbolTable {
	table := newSymbolTableRaw(kind, name, version)
	// Copy in the import "references."
	table.imports = append(imports[:0:0], imports...)
	if kind == symbolTableKindLocal {
		// For local symbol table, import system symbol table.
		imports = append([]SymbolTable{systemSymbolTable}, imports...)
	}
	for _, importTable := range imports {
		// TODO Consider if we should not inline the imports or make this delegate to the imports or configurable.
		table.tokens = append(table.tokens, importTable.tokens...)
		for text, newToken := range importTable.textMap {
			if _, exists := table.textMap[text]; !exists {
				table.textMap[text] = newToken
			}
		}
		table.maxSID += importTable.maxSID
	}
	return table
}
// newSymbolTable constructs a new empty symbol table of the given type.
// The name and version are applicable for shared/system symbol tables and should be default
// values for local symbol tables.
// The given imports will be loaded into the newly constructed symbol table.
newSymbolTable constructs a new empty symbol table of the given type.
The name and version are applicable for shared/system symbol tables and should be default
values for local symbol tables.
The given imports will be loaded into the newly constructed symbol table.
// newSymbolTable constructs a new empty symbol table of the given type . // The name and version are applicable for shared / system symbol tables and should be default // values for local symbol tables . // The given imports will be loaded into the newly constructed symbol table .
func newSymbolTable(kind symbolTableKind, name string, version int32, imports ...SymbolTable) *SymbolTable {
	table := newSymbolTableRaw(kind, name, version)
	table.imports = append(imports[:0:0], imports...)
	if kind == symbolTableKindLocal {
		imports = append([]SymbolTable{systemSymbolTable}, imports...)
	}
	for _, importTable := range imports {
		table.tokens = append(table.tokens, importTable.tokens...)
		for text, newToken := range importTable.textMap {
			if _, exists := table.textMap[text]; !exists {
				table.textMap[text] = newToken
			}
		}
		table.maxSID += importTable.maxSID
	}
	return table
}
func newSymbolTable ( kind symbolTableKind , name string , version int32 , imports ... SymbolTable ) * SymbolTable { table := newSymbolTableRaw ( kind , name , version ) table . imports = append ( imports [ : 0 : 0 ] , imports ... ) if kind == symbolTableKindLocal { imports = append ( [ ] SymbolTable { systemSymbolTable } , imports ... ) } for _ , importTable := range imports { table . tokens = append ( table . tokens , importTable . tokens ... ) for text , newToken := range importTable . textMap { if _ , exists := table . textMap [ text ] ; ! exists { table . textMap [ text ] = newToken } } table . maxSID += importTable . maxSID } return table }
newSymbolTable constructs a new empty symbol table of the given type.
newSymbolTable constructs a new empty symbol table of the given type .
// Copy in the import "references." // For local symbol table, import system symbol table. // TODO Consider if we should not inline the imports or make this delegate to the imports or configurable.