// checkForUndefinedReferences seeks to confirm that all identifiers encountered have been marked as known (being declared) func (this Form) checkForUndefinedReferences(typeChecker interfaces.TypeChecker) { for identifier, identifierKnown := range typeChecker.KnownIdentifiers() { if !identifierKnown { typeChecker.AddEncounteredError(errors.NewUndefinedQuestionReferenceError(identifier)) } } }
// checkForCyclicDependencies checks if the this question depends on itself, and if so, adds an error to the typechecker func checkForCyclicDependencies(question interfaces.Question, typeChecker interfaces.TypeChecker) { // if we find our own VarID as a dependency at least once, the dependencyChain is cyclic if typeChecker.DependencyListForVarDeclContainsReferenceToSelf(question.VarDecl()) { typeChecker.AddEncounteredError(errors.NewCyclicDependencyError(question.VarDecl())) } }