Skip to content

Commit

Permalink
ast: clean some code. (pingcap#2465)
Browse files Browse the repository at this point in the history
  • Loading branch information
hanfei1991 authored and zimulala committed Jan 16, 2017
1 parent 244de11 commit 5272566
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 27 deletions.
26 changes: 0 additions & 26 deletions ast/flag.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,37 +13,11 @@

package ast

const preEvaluable = FlagHasParamMarker | FlagHasFunc | FlagHasVariable | FlagHasDefault | FlagPreEvaluated

// ResetEvaluatedFlag resets the evaluated flag.
func ResetEvaluatedFlag(n Node) {
var reseter preEvaluatedReseter
n.Accept(&reseter)
}

func resetEvaluatedExpr(expr ExprNode) {
expr.SetFlag(expr.GetFlag() &^ FlagPreEvaluated)
}

// HasAggFlag checks if the expr contains FlagHasAggregateFunc.
func HasAggFlag(expr ExprNode) bool {
return expr.GetFlag()&FlagHasAggregateFunc > 0
}

type preEvaluatedReseter struct {
}

func (r *preEvaluatedReseter) Enter(in Node) (Node, bool) {
return in, false
}

func (r *preEvaluatedReseter) Leave(in Node) (Node, bool) {
if expr, ok := in.(ExprNode); ok {
resetEvaluatedExpr(expr)
}
return in, true
}

// SetFlag sets flag for expression.
func SetFlag(n Node) {
var setter flagSetter
Expand Down
1 change: 0 additions & 1 deletion executor/prepared.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,6 @@ func (e *ExecuteExec) Build() error {
prepared.Params[i].SetDatum(val)
}

ast.ResetEvaluatedFlag(prepared.Stmt)
if prepared.SchemaVersion != e.IS.SchemaMetaVersion() {
// If the schema version has changed we need to prepare it again,
// if this time it failed, the real reason for the error is schema changed.
Expand Down

0 comments on commit 5272566

Please sign in to comment.