summaryrefslogtreecommitdiff
path: root/src/ir/function.rs
diff options
context:
space:
mode:
authorbors-servo <lbergstrom+bors@mozilla.com>2018-05-15 19:31:50 -0400
committerGitHub <noreply@github.com>2018-05-15 19:31:50 -0400
commitd6d097cc1a662ef8131e47eaea72bc0c863e43b2 (patch)
tree10ab032849549f0e74e39caa5ac4551515317e70 /src/ir/function.rs
parent74dcb202e398f8101a5bb387628d21ed0f781359 (diff)
parent716d53b02d363880184c05e80f8bf4982ee1ed23 (diff)
Auto merge of #1312 - emilio:constness-woes, r=fitzgen
ir: Handle *const T at the codegen level. Followup to #1311.
Diffstat (limited to 'src/ir/function.rs')
-rw-r--r--src/ir/function.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/ir/function.rs b/src/ir/function.rs
index 602de80c..5e8d2fc8 100644
--- a/src/ir/function.rs
+++ b/src/ir/function.rs
@@ -402,14 +402,27 @@ impl FunctionSig {
let is_virtual = is_method && cursor.method_is_virtual();
let is_static = is_method && cursor.method_is_static();
if !is_static && !is_virtual {
- let class = Item::parse(cursor.semantic_parent(), None, ctx)
+ let parent = cursor.semantic_parent();
+ let class = Item::parse(parent, None, ctx)
.expect("Expected to parse the class");
// The `class` most likely is not finished parsing yet, so use
// the unchecked variant.
let class = class.as_type_id_unchecked();
+ let class = if is_const {
+ let const_class_id = ctx.next_item_id();
+ ctx.build_const_wrapper(
+ const_class_id,
+ class,
+ None,
+ &parent.cur_type(),
+ )
+ } else {
+ class
+ };
+
let ptr =
- Item::builtin_type(TypeKind::Pointer(class), is_const, ctx);
+ Item::builtin_type(TypeKind::Pointer(class), false, ctx);
args.insert(0, (Some("this".into()), ptr));
} else if is_virtual {
let void = Item::builtin_type(TypeKind::Void, false, ctx);