Moved AST generation to its own package
This commit is contained in:
parent
8453273d73
commit
2d045759f2
8 changed files with 172 additions and 171 deletions
|
@ -77,6 +77,24 @@ func (f *Function) useVariable(variable *Variable) {
|
|||
}
|
||||
}
|
||||
|
||||
// identifierExists returns true if the identifier has been defined.
|
||||
func (f *Function) identifierExists(name string) bool {
|
||||
_, exists := f.variables[name]
|
||||
|
||||
if exists {
|
||||
return true
|
||||
}
|
||||
|
||||
_, exists = f.definitions[name]
|
||||
|
||||
if exists {
|
||||
return true
|
||||
}
|
||||
|
||||
_, exists = f.functions[name]
|
||||
return exists
|
||||
}
|
||||
|
||||
func (f *Function) storeVariableInRegister(name string, value *expression.Expression, uses int) error {
|
||||
reg, exists := f.cpu.FindFree(f.cpu.General)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue