aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYizhe <yizhe@pku.edu.cn>2021-02-16 07:42:32 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-02-19 10:34:59 +0000
commit68a2f3d7eaa60516a40037dadb6761e69b7863f7 (patch)
tree2bcc568d87448ada6d31da37366044f0eb6ec439
parent642cc5ed4ffcf0a334cec450e536e5b948819271 (diff)
downloadgcc-68a2f3d7eaa60516a40037dadb6761e69b7863f7.zip
gcc-68a2f3d7eaa60516a40037dadb6761e69b7863f7.tar.gz
gcc-68a2f3d7eaa60516a40037dadb6761e69b7863f7.tar.bz2
Renamed `TyBase` to `BaseType`
-rw-r--r--gcc/rust/backend/rust-compile-context.h6
-rw-r--r--gcc/rust/backend/rust-compile-expr.h20
-rw-r--r--gcc/rust/backend/rust-compile-implitem.h18
-rw-r--r--gcc/rust/backend/rust-compile-item.h14
-rw-r--r--gcc/rust/backend/rust-compile-stmt.h2
-rw-r--r--gcc/rust/backend/rust-compile-tyty.h2
-rw-r--r--gcc/rust/backend/rust-compile-var-decl.h2
-rw-r--r--gcc/rust/backend/rust-compile.cc2
-rw-r--r--gcc/rust/typecheck/rust-hir-method-resolve.h8
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-expr.h34
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-implitem.h34
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-item.h4
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-stmt.h8
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-struct-field.h6
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-toplevel.h22
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.h16
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check.cc18
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check.h34
-rw-r--r--gcc/rust/typecheck/rust-tycheck-dump.h2
-rw-r--r--gcc/rust/typecheck/rust-tyctx.cc16
-rw-r--r--gcc/rust/typecheck/rust-tyty-call.h8
-rw-r--r--gcc/rust/typecheck/rust-tyty-rules.h24
-rw-r--r--gcc/rust/typecheck/rust-tyty.cc122
-rw-r--r--gcc/rust/typecheck/rust-tyty.h212
24 files changed, 317 insertions, 317 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index b50e103..c5ae3bb 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -53,7 +53,7 @@ public:
rust_assert (
tyctx->lookup_type_by_node_id ((*it)->get_node_id (), &ref));
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
rust_assert (tyctx->lookup_type (ref, &lookup));
auto compiled = TyTyCompile::compile (backend, lookup);
@@ -261,7 +261,7 @@ private:
class TyTyResolveCompile : public TyTy::TyVisitor
{
public:
- static ::Btype *compile (Context *ctx, TyTy::TyBase *ty)
+ static ::Btype *compile (Context *ctx, TyTy::BaseType *ty)
{
TyTyResolveCompile compiler (ctx);
ty->accept_vis (compiler);
@@ -355,7 +355,7 @@ public:
std::vector<Backend::Btyped_identifier> fields;
for (size_t i = 0; i < type.num_fields (); i++)
{
- TyTy::TyBase *field = type.get_field (i);
+ TyTy::BaseType *field = type.get_field (i);
Btype *compiled_field_ty
= TyTyCompile::compile (ctx->get_backend (), field);
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 842804d..00625df 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -57,7 +57,7 @@ public:
return;
}
- TyTy::TyBase *tyty = nullptr;
+ TyTy::BaseType *tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&tyty))
{
@@ -177,7 +177,7 @@ public:
return;
}
- TyTy::TyBase *tyty = nullptr;
+ TyTy::BaseType *tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
expr.get_mappings ().get_hirid (), &tyty))
{
@@ -203,7 +203,7 @@ public:
return;
}
- TyTy::TyBase *tyty = nullptr;
+ TyTy::BaseType *tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
expr.get_mappings ().get_hirid (), &tyty))
{
@@ -256,7 +256,7 @@ public:
void visit (HIR::ArrayExpr &expr)
{
- TyTy::TyBase *tyty = nullptr;
+ TyTy::BaseType *tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&tyty))
{
@@ -428,7 +428,7 @@ public:
void visit (HIR::IfExprConseqElse &expr)
{
- TyTy::TyBase *if_type = nullptr;
+ TyTy::BaseType *if_type = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&if_type))
{
@@ -465,7 +465,7 @@ public:
void visit (HIR::IfExprConseqIf &expr)
{
- TyTy::TyBase *if_type = nullptr;
+ TyTy::BaseType *if_type = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&if_type))
{
@@ -502,7 +502,7 @@ public:
void visit (HIR::BlockExpr &expr)
{
- TyTy::TyBase *block_tyty = nullptr;
+ TyTy::BaseType *block_tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&block_tyty))
{
@@ -564,7 +564,7 @@ public:
void visit (HIR::FieldAccessExpr &expr)
{
// resolve the receiver back to ADT type
- TyTy::TyBase *receiver = nullptr;
+ TyTy::BaseType *receiver = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
expr.get_receiver_expr ()->get_mappings ().get_hirid (), &receiver))
{
@@ -593,7 +593,7 @@ public:
void visit (HIR::LoopExpr &expr)
{
- TyTy::TyBase *block_tyty = nullptr;
+ TyTy::BaseType *block_tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&block_tyty))
{
@@ -830,7 +830,7 @@ public:
Bexpression *main_expr
= CompileExpr::Compile (expr.get_expr ().get (), ctx);
- TyTy::TyBase *tyty = nullptr;
+ TyTy::BaseType *tyty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (expr.get_mappings ().get_hirid (),
&tyty))
{
diff --git a/gcc/rust/backend/rust-compile-implitem.h b/gcc/rust/backend/rust-compile-implitem.h
index 6d180c8..3da269a 100644
--- a/gcc/rust/backend/rust-compile-implitem.h
+++ b/gcc/rust/backend/rust-compile-implitem.h
@@ -32,7 +32,7 @@ namespace Compile {
class CompileInherentImplItem : public HIRCompileBase
{
public:
- static void Compile (TyTy::TyBase *self, HIR::InherentImplItem *item,
+ static void Compile (TyTy::BaseType *self, HIR::InherentImplItem *item,
Context *ctx, bool compile_fns)
{
CompileInherentImplItem compiler (self, ctx, compile_fns);
@@ -41,7 +41,7 @@ public:
void visit (HIR::ConstantItem &constant)
{
- TyTy::TyBase *resolved_type = nullptr;
+ TyTy::BaseType *resolved_type = nullptr;
bool ok
= ctx->get_tyctx ()->lookup_type (constant.get_mappings ().get_hirid (),
&resolved_type);
@@ -74,7 +74,7 @@ public:
return;
}
- TyTy::TyBase *fntype_tyty;
+ TyTy::BaseType *fntype_tyty;
if (!ctx->get_tyctx ()->lookup_type (function.get_mappings ().get_hirid (),
&fntype_tyty))
{
@@ -110,7 +110,7 @@ public:
// setup the params
- TyTy::TyBase *tyret = fntype->return_type ();
+ TyTy::BaseType *tyret = fntype->return_type ();
std::vector<Bvariable *> param_vars;
size_t i = 0;
@@ -238,7 +238,7 @@ public:
return;
}
- TyTy::TyBase *fntype_tyty;
+ TyTy::BaseType *fntype_tyty;
if (!ctx->get_tyctx ()->lookup_type (method.get_mappings ().get_hirid (),
&fntype_tyty))
{
@@ -273,11 +273,11 @@ public:
ctx->insert_function_decl (method.get_mappings ().get_hirid (), fndecl);
// setup the params
- TyTy::TyBase *tyret = fntype->return_type ();
+ TyTy::BaseType *tyret = fntype->return_type ();
std::vector<Bvariable *> param_vars;
// insert self
- TyTy::TyBase *self_tyty_lookup = nullptr;
+ TyTy::BaseType *self_tyty_lookup = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
method.get_self_param ().get_mappings ().get_hirid (),
&self_tyty_lookup))
@@ -428,11 +428,11 @@ public:
}
private:
- CompileInherentImplItem (TyTy::TyBase *self, Context *ctx, bool compile_fns)
+ CompileInherentImplItem (TyTy::BaseType *self, Context *ctx, bool compile_fns)
: HIRCompileBase (ctx), self (self), compile_fns (compile_fns)
{}
- TyTy::TyBase *self;
+ TyTy::BaseType *self;
bool compile_fns;
};
diff --git a/gcc/rust/backend/rust-compile-item.h b/gcc/rust/backend/rust-compile-item.h
index 7f93af9f..cfbe969 100644
--- a/gcc/rust/backend/rust-compile-item.h
+++ b/gcc/rust/backend/rust-compile-item.h
@@ -41,7 +41,7 @@ public:
void visit (HIR::TupleStruct &struct_decl)
{
- TyTy::TyBase *resolved = nullptr;
+ TyTy::BaseType *resolved = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
struct_decl.get_mappings ().get_hirid (), &resolved))
{
@@ -55,7 +55,7 @@ public:
void visit (HIR::StructStruct &struct_decl)
{
- TyTy::TyBase *resolved = nullptr;
+ TyTy::BaseType *resolved = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
struct_decl.get_mappings ().get_hirid (), &resolved))
{
@@ -69,7 +69,7 @@ public:
void visit (HIR::StaticItem &var)
{
- TyTy::TyBase *resolved_type = nullptr;
+ TyTy::BaseType *resolved_type = nullptr;
bool ok = ctx->get_tyctx ()->lookup_type (var.get_mappings ().get_hirid (),
&resolved_type);
rust_assert (ok);
@@ -97,7 +97,7 @@ public:
void visit (HIR::ConstantItem &constant)
{
- TyTy::TyBase *resolved_type = nullptr;
+ TyTy::BaseType *resolved_type = nullptr;
bool ok
= ctx->get_tyctx ()->lookup_type (constant.get_mappings ().get_hirid (),
&resolved_type);
@@ -129,7 +129,7 @@ public:
return;
}
- TyTy::TyBase *fntype_tyty;
+ TyTy::BaseType *fntype_tyty;
if (!ctx->get_tyctx ()->lookup_type (function.get_mappings ().get_hirid (),
&fntype_tyty))
{
@@ -169,7 +169,7 @@ public:
// setup the params
- TyTy::TyBase *tyret = fntype->return_type ();
+ TyTy::BaseType *tyret = fntype->return_type ();
std::vector<Bvariable *> param_vars;
size_t i = 0;
@@ -282,7 +282,7 @@ public:
void visit (HIR::InherentImpl &impl_block)
{
- TyTy::TyBase *self_lookup = nullptr;
+ TyTy::BaseType *self_lookup = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
impl_block.get_type ()->get_mappings ().get_hirid (), &self_lookup))
{
diff --git a/gcc/rust/backend/rust-compile-stmt.h b/gcc/rust/backend/rust-compile-stmt.h
index add969a..b99b975 100644
--- a/gcc/rust/backend/rust-compile-stmt.h
+++ b/gcc/rust/backend/rust-compile-stmt.h
@@ -58,7 +58,7 @@ public:
if (!stmt.has_init_expr ())
return;
- TyTy::TyBase *ty = nullptr;
+ TyTy::BaseType *ty = nullptr;
if (!ctx->get_tyctx ()->lookup_type (stmt.get_mappings ().get_hirid (),
&ty))
{
diff --git a/gcc/rust/backend/rust-compile-tyty.h b/gcc/rust/backend/rust-compile-tyty.h
index eb8a961..aed96e3 100644
--- a/gcc/rust/backend/rust-compile-tyty.h
+++ b/gcc/rust/backend/rust-compile-tyty.h
@@ -34,7 +34,7 @@ namespace Compile {
class TyTyCompile : public TyTy::TyVisitor
{
public:
- static ::Btype *compile (::Backend *backend, TyTy::TyBase *ty)
+ static ::Btype *compile (::Backend *backend, TyTy::BaseType *ty)
{
TyTyCompile compiler (backend);
ty->accept_vis (compiler);
diff --git a/gcc/rust/backend/rust-compile-var-decl.h b/gcc/rust/backend/rust-compile-var-decl.h
index e701b15..7069d95 100644
--- a/gcc/rust/backend/rust-compile-var-decl.h
+++ b/gcc/rust/backend/rust-compile-var-decl.h
@@ -41,7 +41,7 @@ public:
void visit (HIR::LetStmt &stmt)
{
locus = stmt.get_locus ();
- TyTy::TyBase *resolved_type = nullptr;
+ TyTy::BaseType *resolved_type = nullptr;
bool ok = ctx->get_tyctx ()->lookup_type (stmt.get_mappings ().get_hirid (),
&resolved_type);
rust_assert (ok);
diff --git a/gcc/rust/backend/rust-compile.cc b/gcc/rust/backend/rust-compile.cc
index dd87d45..61bacf3 100644
--- a/gcc/rust/backend/rust-compile.cc
+++ b/gcc/rust/backend/rust-compile.cc
@@ -125,7 +125,7 @@ CompileExpr::visit (HIR::MethodCallExpr &expr)
return;
}
- TyTy::TyBase *self_type = nullptr;
+ TyTy::BaseType *self_type = nullptr;
if (!ctx->get_tyctx ()->lookup_type (
expr.get_receiver ()->get_mappings ().get_hirid (), &self_type))
{
diff --git a/gcc/rust/typecheck/rust-hir-method-resolve.h b/gcc/rust/typecheck/rust-hir-method-resolve.h
index 9a6c76f..95009d63 100644
--- a/gcc/rust/typecheck/rust-hir-method-resolve.h
+++ b/gcc/rust/typecheck/rust-hir-method-resolve.h
@@ -29,7 +29,7 @@ namespace Resolver {
class MethodResolution : public TypeCheckBase
{
public:
- static std::vector<HIR::Method *> Probe (TyTy::TyBase *receiver,
+ static std::vector<HIR::Method *> Probe (TyTy::BaseType *receiver,
HIR::PathExprSegment method_name)
{
MethodResolution probe (receiver, method_name);
@@ -47,7 +47,7 @@ public:
void visit (HIR::Method &method)
{
- TyTy::TyBase *self_lookup = nullptr;
+ TyTy::BaseType *self_lookup = nullptr;
if (!context->lookup_type (
method.get_self_param ().get_mappings ().get_hirid (), &self_lookup))
{
@@ -79,11 +79,11 @@ public:
}
private:
- MethodResolution (TyTy::TyBase *receiver, HIR::PathExprSegment method_name)
+ MethodResolution (TyTy::BaseType *receiver, HIR::PathExprSegment method_name)
: TypeCheckBase (), receiver (receiver), method_name (method_name)
{}
- TyTy::TyBase *receiver;
+ TyTy::BaseType *receiver;
HIR::PathExprSegment method_name;
std::vector<HIR::Method *> probed;
diff --git a/gcc/rust/typecheck/rust-hir-type-check-expr.h b/gcc/rust/typecheck/rust-hir-type-check-expr.h
index 5ff17cb..2cd60f3 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-expr.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-expr.h
@@ -32,7 +32,7 @@ namespace Resolver {
class TypeCheckExpr : public TypeCheckBase
{
public:
- static TyTy::TyBase *Resolve (HIR::Expr *expr, bool inside_loop)
+ static TyTy::BaseType *Resolve (HIR::Expr *expr, bool inside_loop)
{
TypeCheckExpr resolver (inside_loop);
expr->accept_vis (resolver);
@@ -163,7 +163,7 @@ public:
void visit (HIR::CallExpr &expr)
{
- TyTy::TyBase *function_tyty
+ TyTy::BaseType *function_tyty
= TypeCheckExpr::Resolve (expr.get_fnexpr (), false);
if (function_tyty == nullptr)
return;
@@ -212,7 +212,7 @@ public:
}
auto resolved_method = probes.at (0);
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (resolved_method->get_mappings ().get_hirid (),
&lookup))
{
@@ -335,7 +335,7 @@ public:
}
// the base reference for this name _must_ have a type set
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (ref, &lookup))
{
rust_error_at (mappings->lookup_location (ref),
@@ -592,7 +592,7 @@ public:
void visit (HIR::ArrayIndexExpr &expr)
{
- TyTy::TyBase *size_ty;
+ TyTy::BaseType *size_ty;
if (!context->lookup_builtin ("usize", &size_ty))
{
rust_error_at (
@@ -647,7 +647,7 @@ public:
void visit (HIR::ArrayElemsValues &elems)
{
- std::vector<TyTy::TyBase *> types;
+ std::vector<TyTy::BaseType *> types;
elems.iterate ([&] (HIR::Expr *e) mutable -> bool {
types.push_back (TypeCheckExpr::Resolve (e, false));
return true;
@@ -760,7 +760,7 @@ public:
void visit (HIR::LoopExpr &expr)
{
context->push_new_loop_context (expr.get_mappings ().get_hirid ());
- TyTy::TyBase *block_expr
+ TyTy::BaseType *block_expr
= TypeCheckExpr::Resolve (expr.get_loop_block ().get (), true);
if (block_expr->get_kind () != TyTy::TypeKind::UNIT)
{
@@ -769,7 +769,7 @@ public:
return;
}
- TyTy::TyBase *loop_context_type = context->pop_loop_context ();
+ TyTy::BaseType *loop_context_type = context->pop_loop_context ();
bool loop_context_type_infered
= (loop_context_type->get_kind () != TyTy::TypeKind::INFER)
@@ -787,7 +787,7 @@ public:
context->push_new_while_loop_context (expr.get_mappings ().get_hirid ());
TypeCheckExpr::Resolve (expr.get_predicate_expr ().get (), false);
- TyTy::TyBase *block_expr
+ TyTy::BaseType *block_expr
= TypeCheckExpr::Resolve (expr.get_loop_block ().get (), true);
if (block_expr->get_kind () != TyTy::TypeKind::UNIT)
@@ -811,10 +811,10 @@ public:
if (expr.has_break_expr ())
{
- TyTy::TyBase *break_expr_tyty
+ TyTy::BaseType *break_expr_tyty
= TypeCheckExpr::Resolve (expr.get_expr ().get (), false);
- TyTy::TyBase *loop_context = context->peek_loop_context ();
+ TyTy::BaseType *loop_context = context->peek_loop_context ();
if (loop_context->get_kind () == TyTy::TypeKind::ERROR)
{
rust_error_at (expr.get_locus (),
@@ -822,7 +822,7 @@ public:
return;
}
- TyTy::TyBase *combined = loop_context->combine (break_expr_tyty);
+ TyTy::BaseType *combined = loop_context->combine (break_expr_tyty);
context->swap_head_loop_context (combined);
}
@@ -843,7 +843,7 @@ public:
void visit (HIR::BorrowExpr &expr)
{
- TyTy::TyBase *resolved_base
+ TyTy::BaseType *resolved_base
= TypeCheckExpr::Resolve (expr.get_expr ().get (), false);
// FIXME double_reference
@@ -854,7 +854,7 @@ public:
void visit (HIR::DereferenceExpr &expr)
{
- TyTy::TyBase *resolved_base
+ TyTy::BaseType *resolved_base
= TypeCheckExpr::Resolve (expr.get_expr ().get (), false);
if (resolved_base->get_kind () != TyTy::TypeKind::REF)
{
@@ -874,7 +874,7 @@ private:
{}
bool
- validate_arithmetic_type (TyTy::TyBase *type,
+ validate_arithmetic_type (TyTy::BaseType *type,
HIR::ArithmeticOrLogicalExpr::ExprType expr_type)
{
// https://doc.rust-lang.org/reference/expressions/operator-expr.html#arithmetic-and-logical-binary-operators
@@ -919,8 +919,8 @@ private:
gcc_unreachable ();
}
- TyTy::TyBase *infered;
- TyTy::TyBase *infered_array_elems;
+ TyTy::BaseType *infered;
+ TyTy::BaseType *infered_array_elems;
bool inside_loop;
};
diff --git a/gcc/rust/typecheck/rust-hir-type-check-implitem.h b/gcc/rust/typecheck/rust-hir-type-check-implitem.h
index 3e835b7..6a744c8 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-implitem.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-implitem.h
@@ -31,7 +31,7 @@ namespace Resolver {
class TypeCheckTopLevelImplItem : public TypeCheckBase
{
public:
- static void Resolve (HIR::InherentImplItem *item, TyTy::TyBase *self)
+ static void Resolve (HIR::InherentImplItem *item, TyTy::BaseType *self)
{
TypeCheckTopLevelImplItem resolver (self);
item->accept_vis (resolver);
@@ -39,8 +39,8 @@ public:
void visit (HIR::ConstantItem &constant)
{
- TyTy::TyBase *type = TypeCheckType::Resolve (constant.get_type ());
- TyTy::TyBase *expr_type
+ TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
+ TyTy::BaseType *expr_type
= TypeCheckExpr::Resolve (constant.get_expr (), false);
context->insert_type (constant.get_mappings (), type->combine (expr_type));
@@ -48,7 +48,7 @@ public:
void visit (HIR::Function &function)
{
- TyTy::TyBase *ret_type = nullptr;
+ TyTy::BaseType *ret_type = nullptr;
if (!function.has_function_return_type ())
ret_type = new TyTy::UnitType (function.get_mappings ().get_hirid ());
else
@@ -65,13 +65,13 @@ public:
ret_type->set_ref (function.return_type->get_mappings ().get_hirid ());
}
- std::vector<std::pair<HIR::Pattern *, TyTy::TyBase *> > params;
+ std::vector<std::pair<HIR::Pattern *, TyTy::BaseType *> > params;
for (auto &param : function.function_params)
{
// get the name as well required for later on
auto param_tyty = TypeCheckType::Resolve (param.get_type ());
params.push_back (
- std::pair<HIR::Pattern *, TyTy::TyBase *> (param.get_param_name (),
+ std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
@@ -84,7 +84,7 @@ public:
void visit (HIR::Method &method)
{
- TyTy::TyBase *ret_type = nullptr;
+ TyTy::BaseType *ret_type = nullptr;
if (!method.has_function_return_type ())
ret_type = new TyTy::UnitType (method.get_mappings ().get_hirid ());
else
@@ -104,7 +104,7 @@ public:
}
// hold all the params to the fndef
- std::vector<std::pair<HIR::Pattern *, TyTy::TyBase *> > params;
+ std::vector<std::pair<HIR::Pattern *, TyTy::BaseType *> > params;
// add the self param at the front
HIR::SelfParam &self_param = method.get_self_param ();
@@ -115,14 +115,14 @@ public:
std::unique_ptr<HIR::Pattern> (nullptr));
context->insert_type (self_param.get_mappings (), self->clone ());
params.push_back (
- std::pair<HIR::Pattern *, TyTy::TyBase *> (self_pattern, self->clone ()));
+ std::pair<HIR::Pattern *, TyTy::BaseType *> (self_pattern, self->clone ()));
for (auto &param : method.get_function_params ())
{
// get the name as well required for later on
auto param_tyty = TypeCheckType::Resolve (param.get_type ());
params.push_back (
- std::pair<HIR::Pattern *, TyTy::TyBase *> (param.get_param_name (),
+ std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
@@ -134,16 +134,16 @@ public:
}
private:
- TypeCheckTopLevelImplItem (TyTy::TyBase *self) : TypeCheckBase (), self (self)
+ TypeCheckTopLevelImplItem (TyTy::BaseType *self) : TypeCheckBase (), self (self)
{}
- TyTy::TyBase *self;
+ TyTy::BaseType *self;
};
class TypeCheckImplItem : public TypeCheckBase
{
public:
- static void Resolve (HIR::InherentImplItem *item, TyTy::TyBase *self)
+ static void Resolve (HIR::InherentImplItem *item, TyTy::BaseType *self)
{
TypeCheckImplItem resolver (self);
item->accept_vis (resolver);
@@ -151,7 +151,7 @@ public:
void visit (HIR::Function &function)
{
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (function.get_mappings ().get_hirid (), &lookup))
{
rust_error_at (function.get_locus (), "failed to lookup function type");
@@ -183,7 +183,7 @@ public:
void visit (HIR::Method &method)
{
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (method.get_mappings ().get_hirid (), &lookup))
{
rust_error_at (method.get_locus (), "failed to lookup function type");
@@ -215,9 +215,9 @@ public:
}
private:
- TypeCheckImplItem (TyTy::TyBase *self) : TypeCheckBase (), self (self) {}
+ TypeCheckImplItem (TyTy::BaseType *self) : TypeCheckBase (), self (self) {}
- TyTy::TyBase *self;
+ TyTy::BaseType *self;
};
} // namespace Resolver
diff --git a/gcc/rust/typecheck/rust-hir-type-check-item.h b/gcc/rust/typecheck/rust-hir-type-check-item.h
index f54956c..35a1028 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-item.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-item.h
@@ -40,7 +40,7 @@ public:
void visit (HIR::InherentImpl &impl_block) override
{
- TyTy::TyBase *self = nullptr;
+ TyTy::BaseType *self = nullptr;
if (!context->lookup_type (
impl_block.get_type ()->get_mappings ().get_hirid (), &self))
{
@@ -55,7 +55,7 @@ public:
void visit (HIR::Function &function) override
{
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (function.get_mappings ().get_hirid (), &lookup))
{
rust_error_at (function.locus, "failed to lookup function type");
diff --git a/gcc/rust/typecheck/rust-hir-type-check-stmt.h b/gcc/rust/typecheck/rust-hir-type-check-stmt.h
index cf0e979..9b7d688 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-stmt.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-stmt.h
@@ -30,7 +30,7 @@ namespace Resolver {
class TypeCheckStmt : public TypeCheckBase
{
public:
- static TyTy::TyBase *Resolve (HIR::Stmt *stmt, bool inside_loop)
+ static TyTy::BaseType *Resolve (HIR::Stmt *stmt, bool inside_loop)
{
TypeCheckStmt resolver (inside_loop);
stmt->accept_vis (resolver);
@@ -51,7 +51,7 @@ public:
{
infered = new TyTy::UnitType (stmt.get_mappings ().get_hirid ());
- TyTy::TyBase *init_expr_ty = nullptr;
+ TyTy::BaseType *init_expr_ty = nullptr;
if (stmt.has_init_expr ())
{
init_expr_ty
@@ -65,7 +65,7 @@ public:
init_expr_ty->append_reference (ref);
}
- TyTy::TyBase *specified_ty = nullptr;
+ TyTy::BaseType *specified_ty = nullptr;
if (stmt.has_type ())
specified_ty = TypeCheckType::Resolve (stmt.get_type ());
@@ -110,7 +110,7 @@ private:
: TypeCheckBase (), infered (nullptr), inside_loop (inside_loop)
{}
- TyTy::TyBase *infered;
+ TyTy::BaseType *infered;
bool inside_loop;
};
diff --git a/gcc/rust/typecheck/rust-hir-type-check-struct-field.h b/gcc/rust/typecheck/rust-hir-type-check-struct-field.h
index 98db278..8747391 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-struct-field.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-struct-field.h
@@ -30,7 +30,7 @@ namespace Resolver {
class TypeCheckStructExpr : public TypeCheckBase
{
public:
- static TyTy::TyBase *Resolve (HIR::StructExprStructFields *expr)
+ static TyTy::BaseType *Resolve (HIR::StructExprStructFields *expr)
{
TypeCheckStructExpr resolver;
expr->accept_vis (resolver);
@@ -53,9 +53,9 @@ private:
: TypeCheckBase (), resolved (nullptr), struct_path_resolved (nullptr)
{}
- TyTy::TyBase *resolved;
+ TyTy::BaseType *resolved;
TyTy::ADTType *struct_path_resolved;
- TyTy::TyBase *resolved_field;
+ TyTy::BaseType *resolved_field;
std::set<std::string> fields_assigned;
std::map<size_t, HIR::StructExprField *> adtFieldIndexToField;
};
diff --git a/gcc/rust/typecheck/rust-hir-type-check-toplevel.h b/gcc/rust/typecheck/rust-hir-type-check-toplevel.h
index 6d4c876..d223295 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-toplevel.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-toplevel.h
@@ -44,7 +44,7 @@ public:
size_t idx = 0;
struct_decl.iterate ([&] (HIR::TupleField &field) mutable -> bool {
- TyTy::TyBase *field_type
+ TyTy::BaseType *field_type
= TypeCheckType::Resolve (field.get_field_type ().get ());
TyTy::StructFieldType *ty_field
= new TyTy::StructFieldType (field.get_mappings ().get_hirid (),
@@ -55,7 +55,7 @@ public:
return true;
});
- TyTy::TyBase *type
+ TyTy::BaseType *type
= new TyTy::ADTType (struct_decl.get_mappings ().get_hirid (),
struct_decl.get_identifier (), std::move (fields));
@@ -66,7 +66,7 @@ public:
{
std::vector<TyTy::StructFieldType *> fields;
struct_decl.iterate ([&] (HIR::StructField &field) mutable -> bool {
- TyTy::TyBase *field_type
+ TyTy::BaseType *field_type
= TypeCheckType::Resolve (field.get_field_type ().get ());
TyTy::StructFieldType *ty_field
= new TyTy::StructFieldType (field.get_mappings ().get_hirid (),
@@ -76,7 +76,7 @@ public:
return true;
});
- TyTy::TyBase *type
+ TyTy::BaseType *type
= new TyTy::ADTType (struct_decl.get_mappings ().get_hirid (),
struct_decl.get_identifier (), std::move (fields));
@@ -85,16 +85,16 @@ public:
void visit (HIR::StaticItem &var)
{
- TyTy::TyBase *type = TypeCheckType::Resolve (var.get_type ());
- TyTy::TyBase *expr_type = TypeCheckExpr::Resolve (var.get_expr (), false);
+ TyTy::BaseType *type = TypeCheckType::Resolve (var.get_type ());
+ TyTy::BaseType *expr_type = TypeCheckExpr::Resolve (var.get_expr (), false);
context->insert_type (var.get_mappings (), type->combine (expr_type));
}
void visit (HIR::ConstantItem &constant)
{
- TyTy::TyBase *type = TypeCheckType::Resolve (constant.get_type ());
- TyTy::TyBase *expr_type
+ TyTy::BaseType *type = TypeCheckType::Resolve (constant.get_type ());
+ TyTy::BaseType *expr_type
= TypeCheckExpr::Resolve (constant.get_expr (), false);
context->insert_type (constant.get_mappings (), type->combine (expr_type));
@@ -102,7 +102,7 @@ public:
void visit (HIR::Function &function)
{
- TyTy::TyBase *ret_type = nullptr;
+ TyTy::BaseType *ret_type = nullptr;
if (!function.has_function_return_type ())
ret_type = new TyTy::UnitType (function.get_mappings ().get_hirid ());
else
@@ -119,13 +119,13 @@ public:
ret_type->set_ref (function.return_type->get_mappings ().get_hirid ());
}
- std::vector<std::pair<HIR::Pattern *, TyTy::TyBase *> > params;
+ std::vector<std::pair<HIR::Pattern *, TyTy::BaseType *> > params;
for (auto &param : function.function_params)
{
// get the name as well required for later on
auto param_tyty = TypeCheckType::Resolve (param.get_type ());
params.push_back (
- std::pair<HIR::Pattern *, TyTy::TyBase *> (param.get_param_name (),
+ std::pair<HIR::Pattern *, TyTy::BaseType *> (param.get_param_name (),
param_tyty));
context->insert_type (param.get_mappings (), param_tyty);
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h
index 0c8e861..74896e2 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.h
@@ -65,7 +65,7 @@ private:
class TypeCheckType : public TypeCheckBase
{
public:
- static TyTy::TyBase *Resolve (HIR::Type *type)
+ static TyTy::BaseType *Resolve (HIR::Type *type)
{
TypeCheckType resolver;
type->accept_vis (resolver);
@@ -83,12 +83,12 @@ public:
void visit (HIR::BareFunctionType &fntype)
{
- TyTy::TyBase *return_type
+ TyTy::BaseType *return_type
= fntype.has_return_type ()
? TypeCheckType::Resolve (fntype.get_return_type ().get ())
: new TyTy::UnitType (fntype.get_mappings ().get_hirid ());
- std::vector<std::pair<HIR::Pattern *, TyTy::TyBase *> > params;
+ std::vector<std::pair<HIR::Pattern *, TyTy::BaseType *> > params;
for (auto &param : fntype.get_function_params ())
{
std::unique_ptr<HIR::Pattern> to_bind;
@@ -100,9 +100,9 @@ public:
= new HIR::IdentifierPattern (param.get_name (), param.get_locus (),
is_ref, is_mut, std::move (to_bind));
- TyTy::TyBase *ptype = TypeCheckType::Resolve (param.get_type ().get ());
+ TyTy::BaseType *ptype = TypeCheckType::Resolve (param.get_type ().get ());
params.push_back (
- std::pair<HIR::Pattern *, TyTy::TyBase *> (pattern, ptype));
+ std::pair<HIR::Pattern *, TyTy::BaseType *> (pattern, ptype));
}
translated = new TyTy::FnType (fntype.get_mappings ().get_hirid (),
@@ -171,14 +171,14 @@ public:
return;
}
- TyTy::TyBase *base = TypeCheckType::Resolve (type.get_element_type ());
+ TyTy::BaseType *base = TypeCheckType::Resolve (type.get_element_type ());
translated
= new TyTy::ArrayType (type.get_mappings ().get_hirid (), capacity, base);
}
void visit (HIR::ReferenceType &type)
{
- TyTy::TyBase *base = TypeCheckType::Resolve (type.get_base_type ().get ());
+ TyTy::BaseType *base = TypeCheckType::Resolve (type.get_base_type ().get ());
translated = new TyTy::ReferenceType (type.get_mappings ().get_hirid (),
base->get_ref ());
}
@@ -192,7 +192,7 @@ public:
private:
TypeCheckType () : TypeCheckBase (), translated (nullptr) {}
- TyTy::TyBase *translated;
+ TyTy::BaseType *translated;
};
} // namespace Resolver
diff --git a/gcc/rust/typecheck/rust-hir-type-check.cc b/gcc/rust/typecheck/rust-hir-type-check.cc
index 2083344..87abb8c 100644
--- a/gcc/rust/typecheck/rust-hir-type-check.cc
+++ b/gcc/rust/typecheck/rust-hir-type-check.cc
@@ -47,7 +47,7 @@ TypeResolution::Resolve (HIR::Crate &crate)
auto mappings = Analysis::Mappings::get ();
auto context = TypeCheckContext::get ();
- context->iterate ([&] (HirId id, TyTy::TyBase *ty) mutable -> bool {
+ context->iterate ([&] (HirId id, TyTy::BaseType *ty) mutable -> bool {
if (ty->get_kind () == TyTy::TypeKind::ERROR)
{
rust_error_at (mappings->lookup_location (id),
@@ -69,7 +69,7 @@ TypeResolution::Resolve (HIR::Crate &crate)
break;
case TyTy::InferType::INTEGRAL: {
- TyTy::TyBase *default_integer;
+ TyTy::BaseType *default_integer;
bool ok = context->lookup_builtin ("i32", &default_integer);
rust_assert (ok);
@@ -83,7 +83,7 @@ TypeResolution::Resolve (HIR::Crate &crate)
break;
case TyTy::InferType::FLOAT: {
- TyTy::TyBase *default_float;
+ TyTy::BaseType *default_float;
bool ok = context->lookup_builtin ("f32", &default_float);
rust_assert (ok);
@@ -105,7 +105,7 @@ TypeResolution::Resolve (HIR::Crate &crate)
void
TypeCheckExpr::visit (HIR::BlockExpr &expr)
{
- TyTy::TyBase *block_tyty
+ TyTy::BaseType *block_tyty
= new TyTy::UnitType (expr.get_mappings ().get_hirid ());
expr.iterate_stmts ([&] (HIR::Stmt *s) mutable -> bool {
@@ -161,7 +161,7 @@ TypeCheckStructExpr::visit (HIR::StructExprStructFields &struct_expr)
resolved = struct_path_resolved;
if (struct_expr.has_struct_base ())
{
- TyTy::TyBase *base_resolved
+ TyTy::BaseType *base_resolved
= TypeCheckExpr::Resolve (struct_expr.struct_base->base_struct.get (),
false);
resolved = struct_path_resolved->combine (base_resolved);
@@ -300,7 +300,7 @@ TypeCheckStructExpr::visit (HIR::PathInExpression &expr)
}
// the base reference for this name _must_ have a type set
- TyTy::TyBase *lookup;
+ TyTy::BaseType *lookup;
if (!context->lookup_type (ref, &lookup))
{
rust_error_at (mappings->lookup_location (ref),
@@ -329,7 +329,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifierValue &field)
}
size_t field_index;
- TyTy::TyBase *value = TypeCheckExpr::Resolve (field.get_value (), false);
+ TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value (), false);
TyTy::StructFieldType *field_type
= struct_path_resolved->get_field (field.field_name, &field_index);
if (field_type == nullptr)
@@ -358,7 +358,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIndexValue &field)
}
size_t field_index;
- TyTy::TyBase *value = TypeCheckExpr::Resolve (field.get_value (), false);
+ TyTy::BaseType *value = TypeCheckExpr::Resolve (field.get_value (), false);
TyTy::StructFieldType *field_type
= struct_path_resolved->get_field (field_name, &field_index);
if (field_type == nullptr)
@@ -398,7 +398,7 @@ TypeCheckStructExpr::visit (HIR::StructExprFieldIdentifier &field)
// existing code to figure out the type
HIR::IdentifierExpr expr (field.get_mappings (), field.get_field_name (),
field.get_locus ());
- TyTy::TyBase *value = TypeCheckExpr::Resolve (&expr, false);
+ TyTy::BaseType *value = TypeCheckExpr::Resolve (&expr, false);
resolved_field = field_type->get_field_type ()->combine (value);
if (resolved_field != nullptr)
diff --git a/gcc/rust/typecheck/rust-hir-type-check.h b/gcc/rust/typecheck/rust-hir-type-check.h
index aa11b7e..753004a 100644
--- a/gcc/rust/typecheck/rust-hir-type-check.h
+++ b/gcc/rust/typecheck/rust-hir-type-check.h
@@ -33,21 +33,21 @@ public:
~TypeCheckContext ();
- bool lookup_builtin (NodeId id, TyTy::TyBase **type);
- bool lookup_builtin (std::string name, TyTy::TyBase **type);
- void insert_builtin (HirId id, NodeId ref, TyTy::TyBase *type);
+ bool lookup_builtin (NodeId id, TyTy::BaseType **type);
+ bool lookup_builtin (std::string name, TyTy::BaseType **type);
+ void insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type);
- void insert_type (const Analysis::NodeMapping &mappings, TyTy::TyBase *type);
- bool lookup_type (HirId id, TyTy::TyBase **type);
+ void insert_type (const Analysis::NodeMapping &mappings, TyTy::BaseType *type);
+ bool lookup_type (HirId id, TyTy::BaseType **type);
void insert_type_by_node_id (NodeId ref, HirId id);
bool lookup_type_by_node_id (NodeId ref, HirId *id);
- TyTy::TyBase *peek_return_type ();
- void push_return_type (TyTy::TyBase *return_type);
+ TyTy::BaseType *peek_return_type ();
+ void push_return_type (TyTy::BaseType *return_type);
void pop_return_type ();
- void iterate (std::function<bool (HirId, TyTy::TyBase *)> cb)
+ void iterate (std::function<bool (HirId, TyTy::BaseType *)> cb)
{
for (auto it = resolved.begin (); it != resolved.end (); it++)
{
@@ -58,27 +58,27 @@ public:
void push_new_loop_context (HirId id)
{
- TyTy::TyBase *infer_var
+ TyTy::BaseType *infer_var
= new TyTy::InferType (id, TyTy::InferType::InferTypeKind::GENERAL);
loop_type_stack.push_back (infer_var);
}
void push_new_while_loop_context (HirId id)
{
- TyTy::TyBase *infer_var = new TyTy::ErrorType (id);
+ TyTy::BaseType *infer_var = new TyTy::ErrorType (id);
loop_type_stack.push_back (infer_var);
}
- TyTy::TyBase *peek_loop_context () { return loop_type_stack.back (); }
+ TyTy::BaseType *peek_loop_context () { return loop_type_stack.back (); }
- TyTy::TyBase *pop_loop_context ()
+ TyTy::BaseType *pop_loop_context ()
{
auto back = peek_loop_context ();
loop_type_stack.pop_back ();
return back;
}
- void swap_head_loop_context (TyTy::TyBase *val)
+ void swap_head_loop_context (TyTy::BaseType *val)
{
loop_type_stack.pop_back ();
loop_type_stack.push_back (val);
@@ -88,10 +88,10 @@ private:
TypeCheckContext ();
std::map<NodeId, HirId> node_id_refs;
- std::map<HirId, TyTy::TyBase *> resolved;
- std::vector<std::unique_ptr<TyTy::TyBase> > builtins;
- std::vector<TyTy::TyBase *> return_type_stack;
- std::vector<TyTy::TyBase *> loop_type_stack;
+ std::map<HirId, TyTy::BaseType *> resolved;
+ std::vector<std::unique_ptr<TyTy::BaseType> > builtins;
+ std::vector<TyTy::BaseType *> return_type_stack;
+ std::vector<TyTy::BaseType *> loop_type_stack;
};
class TypeResolution
diff --git a/gcc/rust/typecheck/rust-tycheck-dump.h b/gcc/rust/typecheck/rust-tycheck-dump.h
index 17774a7..7e52f65 100644
--- a/gcc/rust/typecheck/rust-tycheck-dump.h
+++ b/gcc/rust/typecheck/rust-tycheck-dump.h
@@ -180,7 +180,7 @@ public:
protected:
std::string type_string (const Analysis::NodeMapping &mappings)
{
- TyTy::TyBase *lookup = nullptr;
+ TyTy::BaseType *lookup = nullptr;
if (!context->lookup_type (mappings.get_hirid (), &lookup))
return "<error>";
diff --git a/gcc/rust/typecheck/rust-tyctx.cc b/gcc/rust/typecheck/rust-tyctx.cc
index 484fd48..ff1c627 100644
--- a/gcc/rust/typecheck/rust-tyctx.cc
+++ b/gcc/rust/typecheck/rust-tyctx.cc
@@ -36,7 +36,7 @@ TypeCheckContext::TypeCheckContext () {}
TypeCheckContext::~TypeCheckContext () {}
bool
-TypeCheckContext::lookup_builtin (NodeId id, TyTy::TyBase **type)
+TypeCheckContext::lookup_builtin (NodeId id, TyTy::BaseType **type)
{
auto ref_it = node_id_refs.find (id);
if (ref_it == node_id_refs.end ())
@@ -51,7 +51,7 @@ TypeCheckContext::lookup_builtin (NodeId id, TyTy::TyBase **type)
}
bool
-TypeCheckContext::lookup_builtin (std::string name, TyTy::TyBase **type)
+TypeCheckContext::lookup_builtin (std::string name, TyTy::BaseType **type)
{
for (auto &builtin : builtins)
{
@@ -65,16 +65,16 @@ TypeCheckContext::lookup_builtin (std::string name, TyTy::TyBase **type)
}
void
-TypeCheckContext::insert_builtin (HirId id, NodeId ref, TyTy::TyBase *type)
+TypeCheckContext::insert_builtin (HirId id, NodeId ref, TyTy::BaseType *type)
{
node_id_refs[ref] = id;
resolved[id] = type;
- builtins.push_back (std::unique_ptr<TyTy::TyBase> (type));
+ builtins.push_back (std::unique_ptr<TyTy::BaseType> (type));
}
void
TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
- TyTy::TyBase *type)
+ TyTy::BaseType *type)
{
rust_assert (type != nullptr);
NodeId ref = mappings.get_nodeid ();
@@ -84,7 +84,7 @@ TypeCheckContext::insert_type (const Analysis::NodeMapping &mappings,
}
bool
-TypeCheckContext::lookup_type (HirId id, TyTy::TyBase **type)
+TypeCheckContext::lookup_type (HirId id, TyTy::BaseType **type)
{
auto it = resolved.find (id);
if (it == resolved.end ())
@@ -112,14 +112,14 @@ TypeCheckContext::lookup_type_by_node_id (NodeId ref, HirId *id)
return true;
}
-TyTy::TyBase *
+TyTy::BaseType *
TypeCheckContext::peek_return_type ()
{
return return_type_stack.back ();
}
void
-TypeCheckContext::push_return_type (TyTy::TyBase *return_type)
+TypeCheckContext::push_return_type (TyTy::BaseType *return_type)
{
return_type_stack.push_back (return_type);
}
diff --git a/gcc/rust/typecheck/rust-tyty-call.h b/gcc/rust/typecheck/rust-tyty-call.h
index fb2a259..d6e5879 100644
--- a/gcc/rust/typecheck/rust-tyty-call.h
+++ b/gcc/rust/typecheck/rust-tyty-call.h
@@ -31,7 +31,7 @@ namespace TyTy {
class TypeCheckCallExpr : private TyVisitor
{
public:
- static TyBase *go (TyBase *ref, HIR::CallExpr &call,
+ static BaseType *go (BaseType *ref, HIR::CallExpr &call,
Resolver::TypeCheckContext *context)
{
TypeCheckCallExpr checker (call, context);
@@ -66,7 +66,7 @@ private:
mappings (Analysis::Mappings::get ())
{}
- TyBase *resolved;
+ BaseType *resolved;
HIR::CallExpr &call;
Resolver::TypeCheckContext *context;
Analysis::Mappings *mappings;
@@ -75,7 +75,7 @@ private:
class TypeCheckMethodCallExpr : private TyVisitor
{
public:
- static TyBase *go (TyBase *ref, HIR::MethodCallExpr &call,
+ static BaseType *go (BaseType *ref, HIR::MethodCallExpr &call,
Resolver::TypeCheckContext *context)
{
TypeCheckMethodCallExpr checker (call, context);
@@ -109,7 +109,7 @@ private:
mappings (Analysis::Mappings::get ())
{}
- TyBase *resolved;
+ BaseType *resolved;
HIR::MethodCallExpr &call;
Resolver::TypeCheckContext *context;
Analysis::Mappings *mappings;
diff --git a/gcc/rust/typecheck/rust-tyty-rules.h b/gcc/rust/typecheck/rust-tyty-rules.h
index 5a3edd4..f5c74a5 100644
--- a/gcc/rust/typecheck/rust-tyty-rules.h
+++ b/gcc/rust/typecheck/rust-tyty-rules.h
@@ -33,7 +33,7 @@ class BaseRules : public TyVisitor
public:
virtual ~BaseRules () {}
- TyBase *combine (TyBase *other)
+ BaseType *combine (BaseType *other)
{
other->accept_vis (*this);
if (resolved != nullptr)
@@ -50,7 +50,7 @@ public:
{
for (auto &ref : resolved->get_combined_refs ())
{
- TyTy::TyBase *ref_tyty = nullptr;
+ TyTy::BaseType *ref_tyty = nullptr;
bool ok = context->lookup_type (ref, &ref_tyty);
if (!ok)
continue;
@@ -185,7 +185,7 @@ public:
}
protected:
- BaseRules (TyBase *base)
+ BaseRules (BaseType *base)
: mappings (Analysis::Mappings::get ()),
context (Resolver::TypeCheckContext::get ()), base (base),
resolved (new ErrorType (base->get_ref (), base->get_ref ()))
@@ -194,8 +194,8 @@ protected:
Analysis::Mappings *mappings;
Resolver::TypeCheckContext *context;
- TyBase *base;
- TyBase *resolved;
+ BaseType *base;
+ BaseType *resolved;
};
class InferRules : public BaseRules
@@ -423,7 +423,7 @@ public:
void visit (StructFieldType &type)
{
- TyBase *ty = base->get_field_type ()->combine (type.get_field_type ());
+ BaseType *ty = base->get_field_type ()->combine (type.get_field_type ());
if (ty == nullptr)
return;
@@ -474,7 +474,7 @@ public:
return;
}
- // FIXME add an abstract method for is_equal on TyBase
+ // FIXME add an abstract method for is_equal on BaseType
for (size_t i = 0; i < base->num_params (); i++)
{
auto a = base->param_at (i).second;
@@ -670,7 +670,7 @@ public:
TyTy::StructFieldType *base_field = base->get_field (i);
TyTy::StructFieldType *other_field = type.get_field (i);
- TyBase *combined = base_field->combine (other_field);
+ BaseType *combined = base_field->combine (other_field);
if (combined == nullptr)
{
BaseRules::visit (type);
@@ -704,10 +704,10 @@ public:
std::vector<HirId> fields;
for (size_t i = 0; i < base->num_fields (); i++)
{
- TyBase *bo = base->get_field (i);
- TyBase *fo = type.get_field (i);
+ BaseType *bo = base->get_field (i);
+ BaseType *fo = type.get_field (i);
- TyBase *combined = bo->combine (fo);
+ BaseType *combined = bo->combine (fo);
if (combined == nullptr)
{
BaseRules::visit (type);
@@ -806,7 +806,7 @@ public:
auto base_type = base->get_base ();
auto other_base_type = type.get_base ();
- TyTy::TyBase *base_resolved = base_type->combine (other_base_type);
+ TyTy::BaseType *base_resolved = base_type->combine (other_base_type);
resolved = new ReferenceType (base->get_ref (), base->get_ty_ref (),
base_resolved->get_ref ());
}
diff --git a/gcc/rust/typecheck/rust-tyty.cc b/gcc/rust/typecheck/rust-tyty.cc
index 24be4b0..e6e8c63 100644
--- a/gcc/rust/typecheck/rust-tyty.cc
+++ b/gcc/rust/typecheck/rust-tyty.cc
@@ -37,14 +37,14 @@ UnitType::as_string () const
return "()";
}
-TyBase *
-UnitType::combine (TyBase *other)
+BaseType *
+UnitType::combine (BaseType *other)
{
UnitRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
UnitType::clone ()
{
return new UnitType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -71,14 +71,14 @@ InferType::as_string () const
return "<infer::error>";
}
-TyBase *
-InferType::combine (TyBase *other)
+BaseType *
+InferType::combine (BaseType *other)
{
InferRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
InferType::clone ()
{
return new InferType (get_ref (), get_ty_ref (), get_infer_kind (),
@@ -97,15 +97,15 @@ ErrorType::as_string () const
return "<tyty::error>";
}
-TyBase *
-ErrorType::combine (TyBase *other)
+BaseType *
+ErrorType::combine (BaseType *other)
{
// FIXME
// rust_error_at ();
return this;
}
-TyBase *
+BaseType *
ErrorType::clone ()
{
return new ErrorType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -123,14 +123,14 @@ StructFieldType::as_string () const
return name + ":" + ty->as_string ();
}
-TyBase *
-StructFieldType::combine (TyBase *other)
+BaseType *
+StructFieldType::combine (BaseType *other)
{
StructFieldTypeRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
StructFieldType::clone ()
{
return new StructFieldType (get_ref (), get_ty_ref (), get_name (),
@@ -158,14 +158,14 @@ ADTType::as_string () const
return identifier;
}
-TyBase *
-ADTType::combine (TyBase *other)
+BaseType *
+ADTType::combine (BaseType *other)
{
ADTRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
ADTType::clone ()
{
std::vector<StructFieldType *> cloned_fields;
@@ -186,7 +186,7 @@ std::string
TupleType::as_string () const
{
std::string fields_buffer;
- iterate_fields ([&] (TyBase *field) mutable -> bool {
+ iterate_fields ([&] (BaseType *field) mutable -> bool {
fields_buffer += field->as_string ();
fields_buffer += ", ";
return true;
@@ -194,24 +194,24 @@ TupleType::as_string () const
return "(" + fields_buffer + ")";
}
-TyBase *
+BaseType *
TupleType::get_field (size_t index) const
{
auto context = Resolver::TypeCheckContext::get ();
- TyBase *lookup = nullptr;
+ BaseType *lookup = nullptr;
bool ok = context->lookup_type (fields.at (index), &lookup);
rust_assert (ok);
return lookup;
}
-TyBase *
-TupleType::combine (TyBase *other)
+BaseType *
+TupleType::combine (BaseType *other)
{
TupleRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
TupleType::clone ()
{
return new TupleType (get_ref (), get_ty_ref (), fields,
@@ -240,20 +240,20 @@ FnType::as_string () const
return "fn (" + params_str + ") -> " + ret_str;
}
-TyBase *
-FnType::combine (TyBase *other)
+BaseType *
+FnType::combine (BaseType *other)
{
FnRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
FnType::clone ()
{
- std::vector<std::pair<HIR::Pattern *, TyBase *> > cloned_params;
+ std::vector<std::pair<HIR::Pattern *, BaseType *> > cloned_params;
for (auto &p : params)
cloned_params.push_back (
- std::pair<HIR::Pattern *, TyBase *> (p.first, p.second->clone ()));
+ std::pair<HIR::Pattern *, BaseType *> (p.first, p.second->clone ()));
return new FnType (get_ref (), get_ty_ref (), cloned_params,
get_return_type ()->clone (), get_combined_refs ());
@@ -272,24 +272,24 @@ ArrayType::as_string () const
+ "]";
}
-TyBase *
-ArrayType::combine (TyBase *other)
+BaseType *
+ArrayType::combine (BaseType *other)
{
ArrayRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
ArrayType::get_type () const
{
auto context = Resolver::TypeCheckContext::get ();
- TyBase *lookup = nullptr;
+ BaseType *lookup = nullptr;
bool ok = context->lookup_type (element_type_id, &lookup);
rust_assert (ok);
return lookup;
}
-TyBase *
+BaseType *
ArrayType::clone ()
{
return new ArrayType (get_ref (), get_ty_ref (), get_capacity (),
@@ -308,14 +308,14 @@ BoolType::as_string () const
return "bool";
}
-TyBase *
-BoolType::combine (TyBase *other)
+BaseType *
+BoolType::combine (BaseType *other)
{
BoolRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
BoolType::clone ()
{
return new BoolType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -347,14 +347,14 @@ IntType::as_string () const
return "__unknown_int_type";
}
-TyBase *
-IntType::combine (TyBase *other)
+BaseType *
+IntType::combine (BaseType *other)
{
IntRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
IntType::clone ()
{
return new IntType (get_ref (), get_ty_ref (), get_kind (),
@@ -387,14 +387,14 @@ UintType::as_string () const
return "__unknown_uint_type";
}
-TyBase *
-UintType::combine (TyBase *other)
+BaseType *
+UintType::combine (BaseType *other)
{
UintRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
UintType::clone ()
{
return new UintType (get_ref (), get_ty_ref (), get_kind (),
@@ -421,14 +421,14 @@ FloatType::as_string () const
return "__unknown_float_type";
}
-TyBase *
-FloatType::combine (TyBase *other)
+BaseType *
+FloatType::combine (BaseType *other)
{
FloatRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
FloatType::clone ()
{
return new FloatType (get_ref (), get_ty_ref (), get_kind (),
@@ -447,14 +447,14 @@ USizeType::as_string () const
return "usize";
}
-TyBase *
-USizeType::combine (TyBase *other)
+BaseType *
+USizeType::combine (BaseType *other)
{
USizeRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
USizeType::clone ()
{
return new USizeType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -472,14 +472,14 @@ ISizeType::as_string () const
return "isize";
}
-TyBase *
-ISizeType::combine (TyBase *other)
+BaseType *
+ISizeType::combine (BaseType *other)
{
ISizeRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
ISizeType::clone ()
{
return new ISizeType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -497,14 +497,14 @@ CharType::as_string () const
return "char";
}
-TyBase *
-CharType::combine (TyBase *other)
+BaseType *
+CharType::combine (BaseType *other)
{
CharRules r (this);
return r.combine (other);
}
-TyBase *
+BaseType *
CharType::clone ()
{
return new CharType (get_ref (), get_ty_ref (), get_combined_refs ());
@@ -522,34 +522,34 @@ ReferenceType::as_string () const
return "&" + get_base ()->as_string ();
}
-TyBase *
-ReferenceType::combine (TyBase *other)
+BaseType *
+ReferenceType::combine (BaseType *other)
{
ReferenceRules r (this);
return r.combine (other);
}
-const TyBase *
+const BaseType *
ReferenceType::get_base () const
{
auto context = Resolver::TypeCheckContext::get ();
- TyBase *lookup = nullptr;
+ BaseType *lookup = nullptr;
bool ok = context->lookup_type (base, &lookup);
rust_assert (ok);
return lookup;
}
-TyBase *
+BaseType *
ReferenceType::get_base ()
{
auto context = Resolver::TypeCheckContext::get ();
- TyBase *lookup = nullptr;
+ BaseType *lookup = nullptr;
bool ok = context->lookup_type (base, &lookup);
rust_assert (ok);
return lookup;
}
-TyBase *
+BaseType *
ReferenceType::clone ()
{
return new ReferenceType (get_ref (), get_ty_ref (), base,
@@ -572,9 +572,9 @@ TypeCheckCallExpr::visit (ADTType &type)
size_t i = 0;
call.iterate_params ([&] (HIR::Expr *p) mutable -> bool {
StructFieldType *field = type.get_field (i);
- TyBase *field_tyty = field->get_field_type ();
+ BaseType *field_tyty = field->get_field_type ();
- TyBase *arg = Resolver::TypeCheckExpr::Resolve (p, false);
+ BaseType *arg = Resolver::TypeCheckExpr::Resolve (p, false);
if (arg == nullptr)
{
rust_error_at (p->get_locus_slow (), "failed to resolve argument type");
diff --git a/gcc/rust/typecheck/rust-tyty.h b/gcc/rust/typecheck/rust-tyty.h
index c333dd3..2b63b93 100644
--- a/gcc/rust/typecheck/rust-tyty.h
+++ b/gcc/rust/typecheck/rust-tyty.h
@@ -50,10 +50,10 @@ enum TypeKind
};
class TyVisitor;
-class TyBase
+class BaseType
{
public:
- virtual ~TyBase () {}
+ virtual ~BaseType () {}
HirId get_ref () const { return ref; }
@@ -67,20 +67,20 @@ public:
virtual std::string as_string () const = 0;
- virtual TyBase *combine (TyBase *other) = 0;
+ virtual BaseType *combine (BaseType *other) = 0;
virtual bool is_unit () const { return kind == TypeKind::UNIT; }
TypeKind get_kind () const { return kind; }
- virtual TyBase *clone () = 0;
+ virtual BaseType *clone () = 0;
std::set<HirId> get_combined_refs () { return combined; }
void append_reference (HirId id) { combined.insert (id); }
protected:
- TyBase (HirId ref, HirId ty_ref, TypeKind kind,
+ BaseType (HirId ref, HirId ty_ref, TypeKind kind,
std::set<HirId> refs = std::set<HirId> ())
: kind (kind), ref (ref), ty_ref (ty_ref), combined (refs)
{}
@@ -92,7 +92,7 @@ protected:
std::set<HirId> combined;
};
-class InferType : public TyBase
+class InferType : public BaseType
{
public:
enum InferTypeKind
@@ -104,12 +104,12 @@ public:
InferType (HirId ref, InferTypeKind infer_kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::INFER, refs), infer_kind (infer_kind)
+ : BaseType (ref, ref, TypeKind::INFER, refs), infer_kind (infer_kind)
{}
InferType (HirId ref, HirId ty_ref, InferTypeKind infer_kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::INFER, refs), infer_kind (infer_kind)
+ : BaseType (ref, ty_ref, TypeKind::INFER, refs), infer_kind (infer_kind)
{}
void accept_vis (TyVisitor &vis) override;
@@ -118,9 +118,9 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
InferTypeKind get_infer_kind () const { return infer_kind; }
@@ -128,15 +128,15 @@ private:
InferTypeKind infer_kind;
};
-class ErrorType : public TyBase
+class ErrorType : public BaseType
{
public:
ErrorType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::ERROR, refs)
+ : BaseType (ref, ref, TypeKind::ERROR, refs)
{}
ErrorType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::ERROR, refs)
+ : BaseType (ref, ty_ref, TypeKind::ERROR, refs)
{}
void accept_vis (TyVisitor &vis) override;
@@ -145,20 +145,20 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class UnitType : public TyBase
+class UnitType : public BaseType
{
public:
UnitType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::UNIT, refs)
+ : BaseType (ref, ref, TypeKind::UNIT, refs)
{}
UnitType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::UNIT, refs)
+ : BaseType (ref, ty_ref, TypeKind::UNIT, refs)
{}
void accept_vis (TyVisitor &vis) override;
@@ -167,22 +167,22 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class StructFieldType : public TyBase
+class StructFieldType : public BaseType
{
public:
- StructFieldType (HirId ref, std::string name, TyBase *ty,
+ StructFieldType (HirId ref, std::string name, BaseType *ty,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::FIELD, refs), name (name), ty (ty)
+ : BaseType (ref, ref, TypeKind::FIELD, refs), name (name), ty (ty)
{}
- StructFieldType (HirId ref, HirId ty_ref, std::string name, TyBase *ty,
+ StructFieldType (HirId ref, HirId ty_ref, std::string name, BaseType *ty,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::FIELD, refs), name (name), ty (ty)
+ : BaseType (ref, ty_ref, TypeKind::FIELD, refs), name (name), ty (ty)
{}
void accept_vis (TyVisitor &vis) override;
@@ -191,30 +191,30 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
std::string get_name () const { return name; }
- TyBase *get_field_type () { return ty; }
+ BaseType *get_field_type () { return ty; }
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
std::string name;
- TyBase *ty;
+ BaseType *ty;
};
-class TupleType : public TyBase
+class TupleType : public BaseType
{
public:
TupleType (HirId ref, std::vector<HirId> fields,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::TUPLE, refs), fields (fields)
+ : BaseType (ref, ref, TypeKind::TUPLE, refs), fields (fields)
{}
TupleType (HirId ref, HirId ty_ref, std::vector<HirId> fields,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::TUPLE, refs), fields (fields)
+ : BaseType (ref, ty_ref, TypeKind::TUPLE, refs), fields (fields)
{}
void accept_vis (TyVisitor &vis) override;
@@ -223,15 +223,15 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
size_t num_fields () const { return fields.size (); }
- TyBase *get_field (size_t index) const;
+ BaseType *get_field (size_t index) const;
- TyBase *clone () final override;
+ BaseType *clone () final override;
- void iterate_fields (std::function<bool (TyBase *)> cb) const
+ void iterate_fields (std::function<bool (BaseType *)> cb) const
{
for (size_t i = 0; i < num_fields (); i++)
{
@@ -244,20 +244,20 @@ private:
std::vector<HirId> fields;
};
-class ADTType : public TyBase
+class ADTType : public BaseType
{
public:
ADTType (HirId ref, std::string identifier,
std::vector<StructFieldType *> fields,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::ADT, refs), identifier (identifier),
+ : BaseType (ref, ref, TypeKind::ADT, refs), identifier (identifier),
fields (fields)
{}
ADTType (HirId ref, HirId ty_ref, std::string identifier,
std::vector<StructFieldType *> fields,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::ADT, refs), identifier (identifier),
+ : BaseType (ref, ty_ref, TypeKind::ADT, refs), identifier (identifier),
fields (fields)
{}
@@ -267,7 +267,7 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
size_t num_fields () const { return fields.size (); }
@@ -292,7 +292,7 @@ public:
return nullptr;
}
- TyBase *clone () final override;
+ BaseType *clone () final override;
std::vector<StructFieldType *> &get_fields () { return fields; }
const std::vector<StructFieldType *> &get_fields () const { return fields; }
@@ -311,62 +311,62 @@ private:
std::vector<StructFieldType *> fields;
};
-class FnType : public TyBase
+class FnType : public BaseType
{
public:
- FnType (HirId ref, std::vector<std::pair<HIR::Pattern *, TyBase *> > params,
- TyBase *type, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::FNDEF, refs), params (std::move (params)),
+ FnType (HirId ref, std::vector<std::pair<HIR::Pattern *, BaseType *> > params,
+ BaseType *type, std::set<HirId> refs = std::set<HirId> ())
+ : BaseType (ref, ref, TypeKind::FNDEF, refs), params (std::move (params)),
type (type)
{}
FnType (HirId ref, HirId ty_ref,
- std::vector<std::pair<HIR::Pattern *, TyBase *> > params,
- TyBase *type, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::FNDEF, refs), params (params), type (type)
+ std::vector<std::pair<HIR::Pattern *, BaseType *> > params,
+ BaseType *type, std::set<HirId> refs = std::set<HirId> ())
+ : BaseType (ref, ty_ref, TypeKind::FNDEF, refs), params (params), type (type)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *return_type () { return type; }
+ BaseType *return_type () { return type; }
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
size_t num_params () const { return params.size (); }
- std::vector<std::pair<HIR::Pattern *, TyBase *> > &get_params ()
+ std::vector<std::pair<HIR::Pattern *, BaseType *> > &get_params ()
{
return params;
}
- std::pair<HIR::Pattern *, TyBase *> &param_at (size_t idx)
+ std::pair<HIR::Pattern *, BaseType *> &param_at (size_t idx)
{
return params[idx];
}
- TyBase *get_return_type () { return type; }
+ BaseType *get_return_type () { return type; }
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
- std::vector<std::pair<HIR::Pattern *, TyBase *> > params;
- TyBase *type;
+ std::vector<std::pair<HIR::Pattern *, BaseType *> > params;
+ BaseType *type;
};
-class ArrayType : public TyBase
+class ArrayType : public BaseType
{
public:
- ArrayType (HirId ref, size_t capacity, TyBase *type,
+ ArrayType (HirId ref, size_t capacity, BaseType *type,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::ARRAY, refs), capacity (capacity),
+ : BaseType (ref, ref, TypeKind::ARRAY, refs), capacity (capacity),
element_type_id (type->get_ref ())
{}
- ArrayType (HirId ref, HirId ty_ref, size_t capacity, TyBase *type,
+ ArrayType (HirId ref, HirId ty_ref, size_t capacity, BaseType *type,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::ARRAY, refs), capacity (capacity),
+ : BaseType (ref, ty_ref, TypeKind::ARRAY, refs), capacity (capacity),
element_type_id (type->get_ref ())
{}
@@ -374,42 +374,42 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
size_t get_capacity () const { return capacity; }
HirId element_type_ref () const { return element_type_id; }
- TyBase *get_type () const;
+ BaseType *get_type () const;
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
size_t capacity;
HirId element_type_id;
};
-class BoolType : public TyBase
+class BoolType : public BaseType
{
public:
BoolType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::BOOL, refs)
+ : BaseType (ref, ref, TypeKind::BOOL, refs)
{}
BoolType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::BOOL, refs)
+ : BaseType (ref, ty_ref, TypeKind::BOOL, refs)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class IntType : public TyBase
+class IntType : public BaseType
{
public:
enum IntKind
@@ -422,29 +422,29 @@ public:
};
IntType (HirId ref, IntKind kind, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::INT, refs), int_kind (kind)
+ : BaseType (ref, ref, TypeKind::INT, refs), int_kind (kind)
{}
IntType (HirId ref, HirId ty_ref, IntKind kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::INT, refs), int_kind (kind)
+ : BaseType (ref, ty_ref, TypeKind::INT, refs), int_kind (kind)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
IntKind get_kind () const { return int_kind; }
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
IntKind int_kind;
};
-class UintType : public TyBase
+class UintType : public BaseType
{
public:
enum UintKind
@@ -457,29 +457,29 @@ public:
};
UintType (HirId ref, UintKind kind, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::UINT, refs), uint_kind (kind)
+ : BaseType (ref, ref, TypeKind::UINT, refs), uint_kind (kind)
{}
UintType (HirId ref, HirId ty_ref, UintKind kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::UINT, refs), uint_kind (kind)
+ : BaseType (ref, ty_ref, TypeKind::UINT, refs), uint_kind (kind)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
UintKind get_kind () const { return uint_kind; }
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
UintKind uint_kind;
};
-class FloatType : public TyBase
+class FloatType : public BaseType
{
public:
enum FloatKind
@@ -490,77 +490,77 @@ public:
FloatType (HirId ref, FloatKind kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::FLOAT, refs), float_kind (kind)
+ : BaseType (ref, ref, TypeKind::FLOAT, refs), float_kind (kind)
{}
FloatType (HirId ref, HirId ty_ref, FloatKind kind,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::FLOAT, refs), float_kind (kind)
+ : BaseType (ref, ty_ref, TypeKind::FLOAT, refs), float_kind (kind)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
FloatKind get_kind () const { return float_kind; }
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
FloatKind float_kind;
};
-class USizeType : public TyBase
+class USizeType : public BaseType
{
public:
USizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::USIZE)
+ : BaseType (ref, ref, TypeKind::USIZE)
{}
USizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::USIZE)
+ : BaseType (ref, ty_ref, TypeKind::USIZE)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class ISizeType : public TyBase
+class ISizeType : public BaseType
{
public:
ISizeType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::ISIZE)
+ : BaseType (ref, ref, TypeKind::ISIZE)
{}
ISizeType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::ISIZE)
+ : BaseType (ref, ty_ref, TypeKind::ISIZE)
{}
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class CharType : public TyBase
+class CharType : public BaseType
{
public:
CharType (HirId ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::CHAR)
+ : BaseType (ref, ref, TypeKind::CHAR)
{}
CharType (HirId ref, HirId ty_ref, std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::CHAR)
+ : BaseType (ref, ty_ref, TypeKind::CHAR)
{}
@@ -568,35 +568,35 @@ public:
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
};
-class ReferenceType : public TyBase
+class ReferenceType : public BaseType
{
public:
ReferenceType (HirId ref, HirId base,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ref, TypeKind::REF), base (base)
+ : BaseType (ref, ref, TypeKind::REF), base (base)
{}
ReferenceType (HirId ref, HirId ty_ref, HirId base,
std::set<HirId> refs = std::set<HirId> ())
- : TyBase (ref, ty_ref, TypeKind::REF), base (base)
+ : BaseType (ref, ty_ref, TypeKind::REF), base (base)
{}
- const TyTy::TyBase *get_base () const;
+ const TyTy::BaseType *get_base () const;
- TyTy::TyBase *get_base ();
+ TyTy::BaseType *get_base ();
void accept_vis (TyVisitor &vis) override;
std::string as_string () const override;
- TyBase *combine (TyBase *other) override;
+ BaseType *combine (BaseType *other) override;
- TyBase *clone () final override;
+ BaseType *clone () final override;
private:
HirId base;