예제 #1
0
파일: parse.go 프로젝트: db47h/ivy
func (b *binary) Eval(context value.Context) value.Value {
	rhs := b.right.Eval(context)
	if b.op == "=" {
		// Special handling as we cannot evaluate the left.
		// We know the left is a variableExpr.
		lhs := b.left.(variableExpr)
		context.Assign(lhs.name, rhs)
		return Assignment{Value: rhs}
	}
	lhs := b.left.Eval(context)
	return context.EvalBinary(lhs, b.op, rhs)
}
예제 #2
0
파일: parse.go 프로젝트: zzn01/ivy
func (b *binary) Eval(context value.Context) value.Value {
	return context.EvalBinary(b.left.Eval(context), b.op, b.right.Eval(context))
}