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