Example #1
0
func (v *powerVisitor) leaveBinaryExpr(binaryExpr *ast.BinaryExpr) {
	if modified, ok := captExpr(binaryExpr.X); ok {
		binaryExpr.X = modified
	}
	if modified, ok := captExpr(binaryExpr.Y); ok {
		binaryExpr.Y = modified
	}
}
func (rp *rewritePackage) binaryExprTFunc(binaryExpr *ast.BinaryExpr) {
	if x, ok := binaryExpr.X.(*ast.BasicLit); ok {
		binaryExpr.X = rp.wrapBasicLitWithT(x)
	}

	if y, ok := binaryExpr.Y.(*ast.BasicLit); ok {
		binaryExpr.Y = rp.wrapBasicLitWithT(y)
	}
}