summaryrefslogtreecommitdiff
path: root/src/codegen/helpers.rs
diff options
context:
space:
mode:
authorEmilio Cobos Álvarez <ecoal95@gmail.com>2016-09-22 02:41:26 +0200
committerEmilio Cobos Álvarez <ecoal95@gmail.com>2016-09-23 11:49:42 +0200
commit2916beaf1d6115b80902b847cd786f81dd14208c (patch)
treea32a68146c28ba644ae17db6edae5e364b877787 /src/codegen/helpers.rs
parentc41a1c28ef54fbc3a61d56777696860aae2c23c5 (diff)
Use the upstreamed version of the array builder.
Diffstat (limited to 'src/codegen/helpers.rs')
-rw-r--r--src/codegen/helpers.rs42
1 files changed, 1 insertions, 41 deletions
diff --git a/src/codegen/helpers.rs b/src/codegen/helpers.rs
index e2fc1120..e82d5c59 100644
--- a/src/codegen/helpers.rs
+++ b/src/codegen/helpers.rs
@@ -3,7 +3,6 @@
use aster;
use ir::layout::Layout;
use syntax::ast;
-use syntax::codemap::respan;
use syntax::ptr::P;
@@ -68,46 +67,7 @@ impl BlobTyBuilder {
if data_len == 1 {
inner_ty
} else {
- ArrayTyBuilder::new().with_len(data_len).build(inner_ty)
+ aster::ty::TyBuilder::new().array(data_len).build(inner_ty)
}
}
}
-
-pub struct ArrayTyBuilder {
- len: usize,
-}
-
-impl ArrayTyBuilder {
- pub fn new() -> Self {
- ArrayTyBuilder {
- len: 0,
- }
- }
-
- pub fn with_len(mut self, len: usize) -> Self {
- self.len = len;
- self
- }
-
- pub fn build(self, ty: P<ast::Ty>) -> P<ast::Ty> {
- use syntax::codemap::DUMMY_SP;
- let size =
- ast::LitKind::Int(self.len as u64,
- ast::LitIntType::Unsigned(ast::UintTy::Us));
- let size = ast::ExprKind::Lit(P(respan(DUMMY_SP, size)));
- let array_kind = ast::TyKind::FixedLengthVec(ty,
- P(ast::Expr {
- id: ast::DUMMY_NODE_ID,
- node: size,
- span: DUMMY_SP,
- attrs: ast::ThinVec::new(),
- })
- );
-
- P(ast::Ty {
- id: ast::DUMMY_NODE_ID,
- node: array_kind,
- span: DUMMY_SP,
- })
- }
-}