func (this *TypeChecker) VarDeclIsKnown(varDecl interfaces.VarDecl) bool {
	if isKnown, exists := this.knownIdentifiers[varDecl.VariableIdentifier()]; exists {
		return isKnown
	}

	return false
}
func (this *TypeChecker) DependencyListForVarDeclContainsReferenceToSelf(varDecl interfaces.VarDecl) bool {
	depencyListForQuestionID := this.dependencyListForVarDecl(varDecl)

	for _, dependentVarID := range depencyListForQuestionID {
		if dependentVarID == varDecl.VariableIdentifier() {
			return true
		}
	}

	return false
}
func (this *TypeChecker) dependencyListForVarDecl(varDecl interfaces.VarDecl) []interfaces.VarID {
	varID := varDecl.VariableIdentifier()

	if varID == nil {
		panic("Attempting to get dependencies of nil varID")
	}

	var dependencies []interfaces.VarID

	for _, directDependentVarID := range this.dependenciesForVarID[varID] {
		// first add the direct dependencies as dependencies
		dependencies = append(dependencies, directDependentVarID)

		// then add as dependencies: the dependencies of the directDependency (i.e. the indirect dependencies of the VarID passed)
		dependencies = append(dependencies, this.recursivelyObtainDependenciesForVarID(directDependentVarID, varID)...)
	}

	return dependencies
}
func (this *TypeChecker) AddDependencyForVarDecl(varIDDependentOn interfaces.VarID, varDecl interfaces.VarDecl) {
	// if we are not in a ComputedQuestion context, don't add any dependencies
	if varDecl == nil {
		return
	}

	if varIDDependentOn == nil {
		panic("Attempting to add VarID dependency but passed dependency is nil")
	}

	for _, dependingVarIDAlreadyKnown := range this.dependenciesForVarID[varDecl.VariableIdentifier()] {
		// don't add it again if its already known to be a dependency
		if dependingVarIDAlreadyKnown == varIDDependentOn {
			return
		}
	}

	varID := varDecl.VariableIdentifier()
	this.dependenciesForVarID[varID] = append(this.dependenciesForVarID[varID], varIDDependentOn)

	log.WithFields(log.Fields{"visitedVarID": varID, "varIDDependentOn": varIDDependentOn, "resultingMap": this.dependenciesForVarID}).Debug("Added dependency for currently visited VarID for type checking")
}
func (this *TypeChecker) MarkLabelAsUsed(label interfaces.StringLiteral, varDecl interfaces.VarDecl) {
	log.WithFields(log.Fields{"label": label}).Debug("Marking label as used")
	this.usedLabels[label] = varDecl.VariableIdentifier()
}
func (this *DefaultVarIDValueVisitor) VisitVarDecl(varDecl interfaces.VarDecl, context interface{}) interface{} {
	symbols := context.(interfaces.VarIDValueSymbols)
	symbols.SetExprForVarID(varDecl.ValueType().DefaultValue(), varDecl.VariableIdentifier())

	return nil
}