Пример #1
0
// QuestionNode adds question to symbol table, and dispatch to frontend
// rendering.
func (exec Execute) QuestionNode(q *ast.QuestionNode) {
	exec.symboltable.Create(q)

	r := exec.symboltable.Read(q.Identifier())

	if q.Type() == ast.ComputedQuestionType {
		expr := q.Content().(*ast.ComputedQuestion).Expression()
		r.(symboltable.StringParser).From(
			exec.resolveExpressionIntoString(expr),
		)
	}

	exec.toFrontend <- &plumbing.Frontend{
		Type:       plumbing.UpdateQuestion,
		Identifier: q.Identifier(),
		Label:      q.Label(),
		Value:      r.(fmt.Stringer).String(),
	}
}