@@ -1987,22 +1987,34 @@ void GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode *p_assi
1987
1987
}
1988
1988
1989
1989
#if DEBUG_ENABLED
1990
- // TODO: Determine if specified type is deprecated, and emit warning if so
1991
1990
auto dd = EditorHelp::get_doc_data ();
1992
1991
bool is_deprecated = false ;
1992
+ String new_value_type = " value" ;
1993
+ String value_name = type.native_type ;
1993
1994
switch (type.kind ) {
1994
1995
case GDScriptParser::DataType::Kind::BUILTIN: // No built-in datatypes are deprecated.
1995
1996
break ;
1996
1997
case GDScriptParser::DataType::Kind::NATIVE:
1997
1998
is_deprecated = dd && dd->class_list .has (type.native_type ) && dd->class_list [type.native_type ].is_deprecated ;
1999
+ new_value_type = " class" ;
1998
2000
break ;
1999
2001
case GDScriptParser::DataType::Kind::SCRIPT: {
2000
2002
StringName class_name = type.script_type ->get_doc_class_name ();
2001
2003
is_deprecated = dd && dd->class_list .has (class_name) && dd->class_list [class_name].is_deprecated ;
2004
+ new_value_type = " class" ;
2002
2005
break ;
2003
2006
}
2004
2007
case GDScriptParser::DataType::Kind::CLASS:
2005
2008
is_deprecated = type.class_type ->doc_data .is_deprecated ;
2009
+ new_value_type = " class" ;
2010
+
2011
+ // TODO: Not recognizing the autoload name as a class type
2012
+ // var my_var: MyAutoload # <--- not getting this name
2013
+ if (type.class_type && type.class_type ->identifier ) {
2014
+ value_name = type.class_type ->identifier ->name ;
2015
+ } else {
2016
+ value_name = " " ;
2017
+ }
2006
2018
break ;
2007
2019
case GDScriptParser::DataType::Kind::ENUM: {
2008
2020
StringName enum_type = type.enum_type ; // Something like MyEnum.
@@ -2015,13 +2027,14 @@ void GDScriptAnalyzer::resolve_assignable(GDScriptParser::AssignableNode *p_assi
2015
2027
is_deprecated = class_doc.enums [enum_type].is_deprecated ;
2016
2028
}
2017
2029
}
2030
+ new_value_type = " enum" ;
2018
2031
break ;
2019
2032
}
2020
2033
default :
2021
2034
break ;
2022
2035
}
2023
2036
if (is_deprecated) {
2024
- parser->push_warning (p_assignable, GDScriptWarning::DEPRECATED_IDENTIFIER);
2037
+ parser->push_warning (p_assignable, GDScriptWarning::DEPRECATED_IDENTIFIER, new_value_type, value_name );
2025
2038
}
2026
2039
#endif
2027
2040
@@ -4055,7 +4068,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4055
4068
for (const DocData::ConstantDoc &doc : dd->class_list [class_name].constants ) {
4056
4069
if (doc.enumeration == base.enum_type && doc.name == name) {
4057
4070
if (doc.is_deprecated ) {
4058
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4071
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " enum value " , vformat ( " %s.%s " , base. enum_type , doc. name ) );
4059
4072
}
4060
4073
break ;
4061
4074
}
@@ -4209,7 +4222,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4209
4222
p_identifier->constant_source = member.constant ;
4210
4223
#if DEBUG_ENABLED
4211
4224
if (member.constant ->doc_data .is_deprecated ) {
4212
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4225
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " constant " , name );
4213
4226
}
4214
4227
#endif
4215
4228
return ;
@@ -4222,7 +4235,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4222
4235
p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CONSTANT;
4223
4236
#if DEBUG_ENABLED
4224
4237
if (member.enum_value .doc_data .is_deprecated ) {
4225
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4238
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " enum value " , name );
4226
4239
}
4227
4240
#endif
4228
4241
return ;
@@ -4235,7 +4248,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4235
4248
p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CONSTANT;
4236
4249
#if DEBUG_ENABLED
4237
4250
if (member.m_enum ->doc_data .is_deprecated ) {
4238
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4251
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " enum " , name );
4239
4252
}
4240
4253
#endif
4241
4254
return ;
@@ -4249,7 +4262,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4249
4262
member.variable ->usages += 1 ;
4250
4263
#if DEBUG_ENABLED
4251
4264
if (member.variable ->doc_data .is_deprecated ) {
4252
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4265
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " property or variable " , name );
4253
4266
}
4254
4267
#endif
4255
4268
return ;
@@ -4265,7 +4278,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4265
4278
4266
4279
#if DEBUG_ENABLED
4267
4280
if (member.signal ->doc_data .is_deprecated ) {
4268
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4281
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " signal " , name );
4269
4282
}
4270
4283
#endif
4271
4284
return ;
@@ -4287,7 +4300,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4287
4300
p_identifier->source = GDScriptParser::IdentifierNode::MEMBER_CLASS;
4288
4301
#ifdef DEBUG_ENABLED
4289
4302
if (script_class->get_member (name).m_class ->doc_data .is_deprecated ) {
4290
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4303
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " class " , name );
4291
4304
}
4292
4305
#endif
4293
4306
return ;
@@ -4385,7 +4398,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4385
4398
for (const DocData::PropertyDoc &doc : dd->class_list [native].properties ) {
4386
4399
if (doc.name == name) {
4387
4400
if (doc.is_deprecated ) {
4388
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4401
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " property " , name );
4389
4402
}
4390
4403
break ;
4391
4404
}
@@ -4410,7 +4423,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4410
4423
for (const DocData::MethodDoc &doc : dd->class_list [native].signals ) {
4411
4424
if (doc.name == name) {
4412
4425
if (doc.is_deprecated ) {
4413
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4426
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " signal " , name );
4414
4427
}
4415
4428
break ;
4416
4429
}
@@ -4427,7 +4440,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4427
4440
if (dd && dd->class_list .has (native) && dd->class_list [native].enums .has (name)) {
4428
4441
DocData::EnumDoc doc = dd->class_list [native].enums [name];
4429
4442
if (doc.is_deprecated ) {
4430
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4443
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " enum " , name );
4431
4444
}
4432
4445
}
4433
4446
#endif
@@ -4447,7 +4460,7 @@ void GDScriptAnalyzer::reduce_identifier_from_base(GDScriptParser::IdentifierNod
4447
4460
for (const DocData::ConstantDoc &doc : dd->class_list [native].constants ) {
4448
4461
if (doc.name == name) {
4449
4462
if (doc.is_deprecated ) {
4450
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4463
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " constant " , name );
4451
4464
}
4452
4465
break ;
4453
4466
}
@@ -4510,7 +4523,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4510
4523
4511
4524
#ifdef DEBUG_ENABLED
4512
4525
if (p_identifier->constant_source ->doc_data .is_deprecated ) {
4513
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4526
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " constant " , p_identifier-> name );
4514
4527
}
4515
4528
#endif
4516
4529
break ;
@@ -4534,7 +4547,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4534
4547
}
4535
4548
4536
4549
if (p_identifier->variable_source ->doc_data .is_deprecated ) {
4537
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4550
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " property or variable " , p_identifier-> name );
4538
4551
}
4539
4552
#endif
4540
4553
break ;
@@ -4657,7 +4670,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4657
4670
DocTools *dd = EditorHelp::get_doc_data ();
4658
4671
if (dd && dd->class_list .has (name)) {
4659
4672
if (dd->class_list [name].is_deprecated ) {
4660
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4673
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " class " , name );
4661
4674
}
4662
4675
}
4663
4676
#endif
@@ -4671,7 +4684,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4671
4684
DocTools *dd = EditorHelp::get_doc_data ();
4672
4685
if (dd && dd->class_list .has (name)) {
4673
4686
if (dd->class_list [name].is_deprecated ) {
4674
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4687
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " class " , name );
4675
4688
}
4676
4689
}
4677
4690
#endif
@@ -4719,7 +4732,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4719
4732
DocTools *dd = EditorHelp::get_doc_data ();
4720
4733
if (dd && dd->class_list .has (name)) {
4721
4734
if (dd->class_list [name].is_deprecated ) {
4722
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4735
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " class " , name );
4723
4736
}
4724
4737
}
4725
4738
#endif
@@ -4746,7 +4759,7 @@ void GDScriptAnalyzer::reduce_identifier(GDScriptParser::IdentifierNode *p_ident
4746
4759
if (dd && dd->class_list .has (" @GlobalScope" )) {
4747
4760
for (const DocData::ConstantDoc &cd : dd->class_list [" @GlobalScope" ].constants ) {
4748
4761
if (cd.name == name && cd.is_deprecated ) {
4749
- parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER);
4762
+ parser->push_warning (p_identifier, GDScriptWarning::DEPRECATED_IDENTIFIER, " constant " , name );
4750
4763
}
4751
4764
}
4752
4765
}
@@ -5947,7 +5960,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo
5947
5960
// For user-defined methods.
5948
5961
#ifdef DEBUG_ENABLED
5949
5962
if (found_function->doc_data .is_deprecated ) {
5950
- parser->push_warning (p_source, GDScriptWarning::DEPRECATED_IDENTIFIER);
5963
+ parser->push_warning (p_source, GDScriptWarning::DEPRECATED_IDENTIFIER, " function " , found_function-> identifier -> name );
5951
5964
}
5952
5965
#endif
5953
5966
return true ;
@@ -5999,7 +6012,7 @@ bool GDScriptAnalyzer::get_function_signature(GDScriptParser::Node *p_source, bo
5999
6012
auto method_list = dd->class_list [base_native].methods ;
6000
6013
for (int i = 0 ; i < method_list.size (); i++) {
6001
6014
if (method_list[i].name == function_name && method_list[i].is_deprecated ) {
6002
- parser->push_warning (p_source, GDScriptWarning::DEPRECATED_IDENTIFIER);
6015
+ parser->push_warning (p_source, GDScriptWarning::DEPRECATED_IDENTIFIER, " function " , function_name );
6003
6016
break ;
6004
6017
}
6005
6018
}
0 commit comments