std json parser
This commit is contained in:
@@ -812,7 +812,6 @@ _builtin_environ:
|
||||
if *use_heap {
|
||||
emit!(&mut self.output, " mov rdi, {}", memory_size);
|
||||
emit!(&mut self.output, " call mem.alloc");
|
||||
emit!(&mut self.output, " push rax");
|
||||
} else {
|
||||
let aligned_size = (memory_size + 15) & !15;
|
||||
emit!(&mut self.output, " sub rsp, {}", aligned_size);
|
||||
|
||||
@@ -596,6 +596,15 @@ impl<'a> TypeChecker<'a> {
|
||||
|
||||
match &func_type.params {
|
||||
FnParams::Normal(params) => {
|
||||
if params.is_empty() || params[0] != receiver_type {
|
||||
return error!(
|
||||
method.loc,
|
||||
format!(
|
||||
"first parameter of the method must be of type {}",
|
||||
receiver_type
|
||||
)
|
||||
);
|
||||
}
|
||||
if params.len() != args.len() + 1 {
|
||||
return error!(
|
||||
method.loc,
|
||||
@@ -606,15 +615,6 @@ impl<'a> TypeChecker<'a> {
|
||||
)
|
||||
);
|
||||
}
|
||||
if params[0] != receiver_type {
|
||||
return error!(
|
||||
method.loc,
|
||||
format!(
|
||||
"first parameter of the method must be of type {}",
|
||||
receiver_type
|
||||
)
|
||||
);
|
||||
}
|
||||
for (i, arg) in args.iter().enumerate() {
|
||||
expect_type!(self.typecheck_expr(env, arg)?, params[i + 1], method.loc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user