Compare commits
No commits in common. "c7f1b81c9dee1d2194d70b997b3dd92598c6a3a8" and "101ee2d8e5865756c7f442990f3635781ce405ba" have entirely different histories.
c7f1b81c9d
...
101ee2d8e5
@ -358,7 +358,8 @@ pub fn analyze_expr(
|
||||
})
|
||||
.collect::<Vec<_>>(),
|
||||
);
|
||||
set_autocomplete(map, meta.range.start, function_autocomplete.clone());
|
||||
dbg!(ty);
|
||||
dbg!(&source_module.associated_functions);
|
||||
set_autocomplete(map, meta.range.end, function_autocomplete.clone());
|
||||
}
|
||||
mir::ExprKind::If(IfExpression(cond, then_e, else_e)) => {
|
||||
|
@ -175,20 +175,6 @@ impl Parse for AssociatedFunctionCall {
|
||||
let ty = stream.parse()?;
|
||||
stream.expect(Token::Colon)?;
|
||||
stream.expect(Token::Colon)?;
|
||||
|
||||
if stream.next_is_whitespace() {
|
||||
stream.expecting_err_nonfatal("associated function name");
|
||||
return Ok(AssociatedFunctionCall(
|
||||
ty,
|
||||
FunctionCallExpression {
|
||||
name: String::new(),
|
||||
params: Vec::new(),
|
||||
range: stream.get_range_prev_curr().unwrap(),
|
||||
is_macro: false,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
match stream.parse() {
|
||||
Ok(fn_call) => Ok(AssociatedFunctionCall(ty, fn_call)),
|
||||
_ => {
|
||||
@ -201,7 +187,7 @@ impl Parse for AssociatedFunctionCall {
|
||||
FunctionCallExpression {
|
||||
name: fn_name,
|
||||
params: Vec::new(),
|
||||
range: stream.get_range_prev_curr().unwrap(),
|
||||
range: stream.get_range_prev_single().unwrap(),
|
||||
is_macro: false,
|
||||
},
|
||||
))
|
||||
@ -212,7 +198,7 @@ impl Parse for AssociatedFunctionCall {
|
||||
FunctionCallExpression {
|
||||
name: String::new(),
|
||||
params: Vec::new(),
|
||||
range: stream.get_range_prev_curr().unwrap(),
|
||||
range: stream.get_range_prev_single().unwrap(),
|
||||
is_macro: false,
|
||||
},
|
||||
))
|
||||
@ -674,11 +660,11 @@ impl Parse for ImportStatement {
|
||||
let mut import_list = Vec::new();
|
||||
|
||||
if let Some(Token::Identifier(name)) = stream.next() {
|
||||
import_list.push((name, stream.get_range_prev_curr().unwrap()));
|
||||
import_list.push((name, stream.get_range_prev_single().unwrap()));
|
||||
while stream.expect(Token::Colon).is_ok() && stream.expect(Token::Colon).is_ok() {
|
||||
if let Some(Token::Identifier(name)) = stream.peek() {
|
||||
stream.next(); // Consume identifier
|
||||
import_list.push((name, stream.get_range_prev_curr().unwrap()));
|
||||
import_list.push((name, stream.get_range_prev_single().unwrap()));
|
||||
} else {
|
||||
stream.expected_err_nonfatal("identifier");
|
||||
break;
|
||||
@ -968,7 +954,7 @@ impl Parse for DotIndexKind {
|
||||
stream.expecting_err_nonfatal("struct index");
|
||||
Ok(Self::StructValueIndex(
|
||||
String::new(),
|
||||
stream.get_range_prev_curr().unwrap(),
|
||||
stream.get_range_prev_single().unwrap(),
|
||||
))
|
||||
} else {
|
||||
Err(stream.expecting_err("struct index")?)
|
||||
|
@ -216,8 +216,8 @@ impl<'a, 'b> TokenStream<'a, 'b> {
|
||||
}
|
||||
|
||||
/// Gets range of the previous token only.
|
||||
pub fn get_range_prev_curr(&self) -> Option<TokenRange> {
|
||||
Some(TokenRange {
|
||||
pub fn get_range_prev_single(&self) -> Option<TokenRange> {
|
||||
self.ref_position.as_ref().map(|ref_pos| TokenRange {
|
||||
start: self.previous_token(self.position).0,
|
||||
end: self.previous_token(self.position).0,
|
||||
})
|
||||
|
@ -721,7 +721,6 @@ impl Expression {
|
||||
expr.resolve_ref(typerefs).cast_into(type_kind)
|
||||
}
|
||||
ExprKind::AssociatedFunctionCall(type_kind, function_call) => {
|
||||
*type_kind = type_kind.or_default().unwrap();
|
||||
let true_function = state
|
||||
.scope
|
||||
.get_associated_function(&pass::AssociatedFunctionKey(
|
||||
@ -733,7 +732,7 @@ impl Expression {
|
||||
type_kind.clone(),
|
||||
));
|
||||
|
||||
if let Some(f) = state.ok(true_function, function_call.meta) {
|
||||
if let Some(f) = state.ok(true_function, self.1) {
|
||||
let param_len_given = function_call.parameters.len();
|
||||
let param_len_expected = f.params.len();
|
||||
|
||||
|
@ -636,12 +636,10 @@ impl Expression {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let ExprKind::Borrow(val, _) = &first_param.0 {
|
||||
*first_param = *val.clone();
|
||||
}
|
||||
if let TypeKind::Borrow(inner_ty, _) = type_kind {
|
||||
*type_kind = *inner_ty.clone();
|
||||
}
|
||||
let ExprKind::Borrow(val, _) = &first_param.0 else {
|
||||
panic!()
|
||||
};
|
||||
*first_param = *val.clone();
|
||||
}
|
||||
|
||||
if !is_mutable {
|
||||
|
Loading…
Reference in New Issue
Block a user