mirror of
https://github.com/godotengine/godot.git
synced 2025-10-22 17:33:33 +00:00
Fixes
-=-=-= -Added missing quaternion constructor -code completion fixes -winrt fixes
This commit is contained in:
parent
7dbc19f32d
commit
a36a774897
23 changed files with 398 additions and 235 deletions
|
@ -606,6 +606,16 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
|
|||
|
||||
if (base.type==Variant::OBJECT) {
|
||||
|
||||
if (id.operator String()=="new" && base.value.get_type()==Variant::OBJECT) {
|
||||
Object *obj = base.value;
|
||||
if (obj && obj->cast_to<GDNativeClass>()) {
|
||||
GDNativeClass *gdnc = obj->cast_to<GDNativeClass>();
|
||||
r_type.type=Variant::OBJECT;
|
||||
r_type.value=Variant();
|
||||
r_type.obj_type=gdnc->get_name();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (ObjectTypeDB::has_method(base.obj_type,id)) {
|
||||
|
||||
|
@ -677,7 +687,8 @@ static bool _guess_expression_type(GDCompletionContext& context,const GDParser::
|
|||
v.get_method_list(&mi);
|
||||
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
|
||||
|
||||
if (E->get().name==id.operator String()) {
|
||||
if (!E->get().name.begins_with("_") && E->get().name==id.operator String()) {
|
||||
|
||||
|
||||
MethodInfo mi = E->get();
|
||||
r_type.type=mi.return_val.type;
|
||||
|
@ -934,7 +945,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
|
|||
block=block->parent_block;
|
||||
}
|
||||
|
||||
//TODO guess identifier type of arguments (ONLY if this is a virtual function)
|
||||
//guess from argument if virtual
|
||||
if (context.function && context.function->name!=StringName()) {
|
||||
|
||||
int argindex = -1;
|
||||
|
@ -995,7 +1006,7 @@ static bool _guess_identifier_type(GDCompletionContext& context,int p_line,const
|
|||
}
|
||||
}
|
||||
|
||||
if (context.function && !context.function->_static) {
|
||||
if (!(context.function && context.function->_static)) {
|
||||
|
||||
for(int i=0;i<context._class->variables.size();i++) {
|
||||
|
||||
|
@ -1136,6 +1147,8 @@ static void _find_identifiers_in_class(GDCompletionContext& context,bool p_stati
|
|||
List<MethodInfo> methods;
|
||||
ObjectTypeDB::get_method_list(type,&methods);
|
||||
for(List<MethodInfo>::Element *E=methods.front();E;E=E->next()) {
|
||||
if (E->get().name.begins_with("_"))
|
||||
continue;
|
||||
if (E->get().arguments.size())
|
||||
result.insert(E->get().name+"(");
|
||||
else
|
||||
|
@ -1196,7 +1209,7 @@ static void _find_identifiers(GDCompletionContext& context,int p_line,bool p_onl
|
|||
}
|
||||
|
||||
|
||||
static String _get_visual_datatype(const PropertyInfo& p_info) {
|
||||
static String _get_visual_datatype(const PropertyInfo& p_info,bool p_isarg=true) {
|
||||
|
||||
String n = p_info.name;
|
||||
int idx = n.find(":");
|
||||
|
@ -1206,8 +1219,12 @@ static String _get_visual_datatype(const PropertyInfo& p_info) {
|
|||
|
||||
if (p_info.type==Variant::OBJECT && p_info.hint==PROPERTY_HINT_RESOURCE_TYPE)
|
||||
return p_info.hint_string;
|
||||
if (p_info.type==Variant::NIL)
|
||||
return "void";
|
||||
if (p_info.type==Variant::NIL) {
|
||||
if (p_isarg)
|
||||
return "var";
|
||||
else
|
||||
return "void";
|
||||
}
|
||||
|
||||
return Variant::get_type_name(p_info.type);
|
||||
}
|
||||
|
@ -1297,7 +1314,7 @@ static void _find_type_arguments(const GDParser::Node*p_node,int p_line,const St
|
|||
|
||||
}
|
||||
|
||||
arghint = _get_visual_datatype(m->get_argument_info(-1))+" "+p_method.operator String()+String("(");
|
||||
arghint = _get_visual_datatype(m->get_argument_info(-1),false)+" "+p_method.operator String()+String("(");
|
||||
|
||||
for(int i=0;i<m->get_argument_count();i++) {
|
||||
if (i>0)
|
||||
|
@ -1361,7 +1378,7 @@ static void _find_call_arguments(GDCompletionContext& context,const GDParser::No
|
|||
const GDParser::BuiltInFunctionNode *fn = static_cast<const GDParser::BuiltInFunctionNode*>(op->arguments[0]);
|
||||
MethodInfo mi = GDFunctions::get_info(fn->function);
|
||||
|
||||
arghint = _get_visual_datatype(mi.return_val)+" "+GDFunctions::get_func_name(fn->function)+String("(");
|
||||
arghint = _get_visual_datatype(mi.return_val,false)+" "+GDFunctions::get_func_name(fn->function)+String("(");
|
||||
for(int i=0;i<mi.arguments.size();i++) {
|
||||
if (i>0)
|
||||
arghint+=", ";
|
||||
|
@ -1674,7 +1691,6 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||
isfunction=true;
|
||||
case GDParser::COMPLETION_INDEX: {
|
||||
|
||||
print_line("index");
|
||||
const GDParser::Node *node = p.get_completion_node();
|
||||
if (node->type!=GDParser::Node::TYPE_OPERATOR)
|
||||
break;
|
||||
|
@ -1686,6 +1702,32 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||
if (_guess_expression_type(context,static_cast<const GDParser::OperatorNode *>(node)->arguments[0],p.get_completion_line(),t)) {
|
||||
|
||||
if (t.type==Variant::OBJECT && t.obj_type!=StringName()) {
|
||||
|
||||
|
||||
if (t.value.get_type()) {
|
||||
Object *obj=t.value;
|
||||
if (obj) {
|
||||
GDScript *scr = obj->cast_to<GDScript>();
|
||||
while (scr) {
|
||||
|
||||
if (!isfunction) {
|
||||
for (const Map<StringName,Variant>::Element *E=scr->get_constants().front();E;E=E->next()) {
|
||||
options.insert(E->key());
|
||||
}
|
||||
}
|
||||
for (const Map<StringName,GDFunction>::Element *E=scr->get_member_functions().front();E;E=E->next()) {
|
||||
options.insert(E->key());
|
||||
}
|
||||
|
||||
if (scr->get_base().is_valid())
|
||||
scr=scr->get_base().ptr();
|
||||
else
|
||||
scr=NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!isfunction) {
|
||||
ObjectTypeDB::get_integer_constant_list(t.obj_type,r_options);
|
||||
}
|
||||
|
@ -1693,6 +1735,9 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||
ObjectTypeDB::get_method_list(t.obj_type,&mi);
|
||||
for (List<MethodInfo>::Element *E=mi.front();E;E=E->next()) {
|
||||
|
||||
if (E->get().name.begins_with("_"))
|
||||
continue;
|
||||
|
||||
if (E->get().arguments.size())
|
||||
options.insert(E->get().name+"(");
|
||||
else
|
||||
|
@ -1700,6 +1745,7 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||
|
||||
}
|
||||
} else {
|
||||
|
||||
if (t.value.get_type()==Variant::NIL) {
|
||||
Variant::CallError ce;
|
||||
t.value=Variant::construct(t.type,NULL,0,ce);
|
||||
|
@ -1728,7 +1774,6 @@ Error GDScriptLanguage::complete_code(const String& p_code, const String& p_base
|
|||
}
|
||||
|
||||
|
||||
|
||||
} break;
|
||||
case GDParser::COMPLETION_CALL_ARGUMENTS: {
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue