(Type targetType, Expr e, String format,
TypeCompatibility compatibility, boolean isImplicit)
| 61 | private final TypeCompatibility compatibility_; |
| 62 | |
| 63 | protected CastExpr(Type targetType, Expr e, String format, |
| 64 | TypeCompatibility compatibility, boolean isImplicit) { |
| 65 | super(); |
| 66 | Preconditions.checkState(targetType.isValid()); |
| 67 | Preconditions.checkNotNull(e); |
| 68 | type_ = targetType; |
| 69 | targetTypeDef_ = null; |
| 70 | isImplicit_ = isImplicit; |
| 71 | castFormat_ = format; |
| 72 | compatibility_ = compatibility; |
| 73 | // replace existing implicit casts |
| 74 | if (e instanceof CastExpr) { |
| 75 | CastExpr castExpr = (CastExpr) e; |
| 76 | if (castExpr.isImplicit()) e = castExpr.getChild(0); |
| 77 | } |
| 78 | children_.add(e); |
| 79 | |
| 80 | // Implicit casts don't call analyze() |
| 81 | // TODO: this doesn't seem like the cleanest approach but there are places |
| 82 | // we generate these (e.g. table loading) where there is no analyzer object. |
| 83 | try { |
| 84 | analyze(); |
| 85 | computeNumDistinctValues(); |
| 86 | evalCost_ = computeEvalCost(); |
| 87 | } catch (AnalysisException ex) { |
| 88 | Preconditions.checkState(false, |
| 89 | "Implicit casts should never throw analysis exception."); |
| 90 | } |
| 91 | analysisDone(); |
| 92 | } |
| 93 | |
| 94 | protected CastExpr(TypeDef targetTypeDef, Expr e, String format) { |
| 95 | Preconditions.checkNotNull(targetTypeDef); |
nothing calls this directly
no test coverage detected