1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

[FunC] Auto-inline functions-wrappers T f(...args) { return anotherF(...args); }

This will allow to easily implement camelCase wrappers aside stdlib,
even without changing hashes of existing contracts.
Also, stdlib renamings could be easily performed in the same manner,
even with arguments reordered.
This commit is contained in:
Aleksandr Kirsanov 2024-04-26 14:27:16 +03:00
parent bac4e3df97
commit 18050a7591
No known key found for this signature in database
GPG key ID: B758BBAA01FFB3D3
12 changed files with 929 additions and 60 deletions

View file

@ -115,6 +115,39 @@ int TypeExpr::extract_components(std::vector<TypeExpr*>& comp_list) {
return res;
}
bool TypeExpr::equals_to(const TypeExpr *rhs) const {
const TypeExpr *l = this;
const TypeExpr *r = rhs;
while (l->constr == te_Indirect)
l = l->args[0];
while (r->constr == te_Indirect)
r = r->args[0];
bool eq = l->constr == r->constr && l->value == r->value &&
l->minw == r->minw && l->maxw == r->maxw &&
l->was_forall_var == r->was_forall_var &&
l->args.size() == r->args.size();
if (!eq)
return false;
for (int i = 0; i < l->args.size(); ++i) {
if (!l->args[i]->equals_to(r->args[i]))
return false;
}
return true;
}
bool TypeExpr::has_unknown_inside() const {
if (constr == te_Unknown)
return true;
for (const TypeExpr* inner : args) {
if (inner->has_unknown_inside())
return true;
}
return false;
}
TypeExpr* TypeExpr::new_map(TypeExpr* from, TypeExpr* to) {
return new TypeExpr{te_Map, std::vector<TypeExpr*>{from, to}};
}