Returns an analyzed clone of 'this' with exprs substituted according to smap. Removes implicit casts and analysis state while cloning/substituting exprs within this tree, such that the returned result has minimal implicit casts and types. Throws if analyzing the post-substitution expr tree failed. I
(ExprSubstitutionMap smap, Analyzer analyzer,
boolean preserveRootType)
| 1149 | * the type of 'this'. |
| 1150 | */ |
| 1151 | public Expr trySubstitute(ExprSubstitutionMap smap, Analyzer analyzer, |
| 1152 | boolean preserveRootType) |
| 1153 | throws AnalysisException { |
| 1154 | Expr result = clone(); |
| 1155 | // Return clone to avoid removing casts. |
| 1156 | if (smap == null) return result; |
| 1157 | result = result.substituteImpl(smap, analyzer); |
| 1158 | result.analyze(analyzer); |
| 1159 | if (preserveRootType && !type_.equals(result.getType())) { |
| 1160 | if (this instanceof CastExpr) { |
| 1161 | CastExpr thisCastExpr = (CastExpr) this; |
| 1162 | TypeCompatibility compatibility = thisCastExpr.getCompatibility(); |
| 1163 | return result.castTo(type_, compatibility); |
| 1164 | } |
| 1165 | return result.castTo(type_); |
| 1166 | } |
| 1167 | return result; |
| 1168 | } |
| 1169 | |
| 1170 | /** |
| 1171 | * Returns an analyzed clone of 'this' with exprs substituted according to smap. |
no test coverage detected