func (compilation *compilation) finalizeUsingStatements(tc *typechecker) error {
	names := make([]string, 0, len(compilation.iteaToUsingCheck))
	for name := range compilation.iteaToUsingCheck {
		names = append(names, name)
	}
	sort.Strings(names)
	for _, name := range names {
		uc := compilation.iteaToUsingCheck[name]
		if !uc.used {
			return tc.errorf(uc.pos, "predeclared identifier itea not used")
		}
		if !uc.toBeEmitted {
			if len(uc.itea.Lhs) != 1 || len(uc.itea.Rhs) != 1 {
				panic(internalError("unexpected"))
			}
			uc.itea.Lhs = []*ast.Identifier{ast.NewIdentifier(nil, "_")}
			uc.itea.Rhs = []ast.Expression{ast.NewBasicLiteral(nil, ast.IntLiteral, "0")}
			tc.checkNodes([]ast.Node{uc.itea})
		}
	}
	return nil
}
finalizeUsingStatements finalizes the 'using' statements neutralizing 'itea'
declarations that should not be emitted. It also returns a type checking
error if the 'itea' identifier of a 'using' statement is not used.
package compiler
import (
	"sort"
	"strconv"
	"github.com/open2b/scriggo/ast"
)
type compilation struct {
	pkgPathToIndex map[string]int
	pkgInfos map[string]*packageInfo
	typeInfos map[ast.Node]*typeInfo
	alreadySortedPkgs map[*ast.Package]bool
	indirectVars map[*ast.Identifier]bool
	renderImportMacro map[*ast.Tree]renderIR
	iteaToUsingCheck map[string]usingCheck
	currentIteaIndex int
	iteaName string
	globalScope map[string]scopeName
	extendingTrees map[string]bool
	extendedTrees map[string]bool
}
type renderIR struct {
	Import *ast.Import
	Macro  *ast.Func
}
func newCompilation(globalScope map[string]scopeName) *compilation {
	return &compilation{
		pkgInfos:          map[string]*packageInfo{},
		pkgPathToIndex:    map[string]int{},
		typeInfos:         map[ast.Node]*typeInfo{},
		alreadySortedPkgs: map[*ast.Package]bool{},
		indirectVars:      map[*ast.Identifier]bool{},
		renderImportMacro: map[*ast.Tree]renderIR{},
		currentIteaIndex:  -1,
		globalScope:       globalScope,
		extendingTrees:    map[string]bool{},
		extendedTrees:     map[string]bool{},
	}
}
func (compilation *compilation) UniqueIndex(path string) int {
	i, ok := compilation.pkgPathToIndex[path]
	if ok {
		return i
	}
	max := -1
	for _, i := range compilation.pkgPathToIndex {
		if i > max {
			max = i
		}
	}
	compilation.pkgPathToIndex[path] = max + 1
	return max + 1
}
func (compilation *compilation) generateIteaName() string {
	compilation.currentIteaIndex++
	return "$itea" + strconv.Itoa(compilation.currentIteaIndex)
}