mirror of
https://github.com/godotengine/godot.git
synced 2025-11-01 22:21:18 +00:00
Reintroduce code completion
This commit is contained in:
parent
b6a2628c48
commit
aa09b4f85d
9 changed files with 2903 additions and 30 deletions
|
|
@ -1134,6 +1134,10 @@ void GDScriptAnalyzer::resolve_return(GDScriptParser::ReturnNode *p_return) {
|
|||
void GDScriptAnalyzer::reduce_expression(GDScriptParser::ExpressionNode *p_expression) {
|
||||
// This one makes some magic happen.
|
||||
|
||||
if (p_expression == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_expression->reduced) {
|
||||
// Don't do this more than once.
|
||||
return;
|
||||
|
|
@ -1248,6 +1252,10 @@ void GDScriptAnalyzer::reduce_assignment(GDScriptParser::AssignmentNode *p_assig
|
|||
reduce_expression(p_assignment->assignee);
|
||||
reduce_expression(p_assignment->assigned_value);
|
||||
|
||||
if (p_assignment->assigned_value == nullptr || p_assignment->assignee == nullptr) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (p_assignment->assignee->get_datatype().is_constant) {
|
||||
push_error("Cannot assign a new value to a constant.", p_assignment->assignee);
|
||||
}
|
||||
|
|
@ -2038,6 +2046,9 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
|
|||
|
||||
// Reduce index first. If it's a constant StringName, use attribute instead.
|
||||
if (!p_subscript->is_attribute) {
|
||||
if (p_subscript->index == nullptr) {
|
||||
return;
|
||||
}
|
||||
reduce_expression(p_subscript->index);
|
||||
|
||||
if (p_subscript->index->is_constant && p_subscript->index->reduced_value.get_type() == Variant::STRING_NAME) {
|
||||
|
|
@ -2053,6 +2064,9 @@ void GDScriptAnalyzer::reduce_subscript(GDScriptParser::SubscriptNode *p_subscri
|
|||
}
|
||||
|
||||
if (p_subscript->is_attribute) {
|
||||
if (p_subscript->attribute == nullptr) {
|
||||
return;
|
||||
}
|
||||
if (p_subscript->base->is_constant) {
|
||||
// Just try to get it.
|
||||
bool valid = false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue