chaokunyang commented on code in PR #2112:
URL: https://github.com/apache/fury/pull/2112#discussion_r2008773388


##########
dart/packages/fury-core/lib/src/code_gen/analyse/impl/cons/constructor_analyzer.dart:
##########
@@ -0,0 +1,250 @@
+// ConstructorParams analyse(
+//   List<ConstructorElement> cons,
+//   int classId,
+//   @LocationEnsure(LocationLevel.clsLevel) LocationMark locationMark,
+// ){
+//   assert(locationMark.ensureClassLevel);
+//   // 虽说通过ConstructorElement也可以找到对应的ClassId, 但是调用者直接提供吧
+//   ConstructorElement? unnamedCons;
+//   for (var consEle in cons){
+//     if (consEle.name.isEmpty){
+//       unnamedCons = consEle;
+//       break;
+//     }
+//   }
+//   if (unnamedCons == null){
+//     throw FuryGenExcep.noUnamedConstructor(locationMark.libPath, 
locationMark.clsName);
+//   }
+//   assert(unnamedCons.superConstructor != null); // 现在分析的是一个类,不能是Object, 
Dart只有Object类没有super
+//   final res = _analyseInner(unnamedCons, locationMark, classId, 0);
+//   assert(res != null);
+//   return res!;
+// }
+// 多个bool flag的解释
+// isInitializingFormal: 是否是初始化参数,被this.修饰的参数(无论optional和named与否)
+// isSuperFormal: 是否是super参数, 被super.修饰的参数(无论optional和named与否)
+// isOptional: 是否是可选参数, optional的参数
+// isNamed: 是否是命名参数, named的参数
+
+// TODO:现在的分析函数是既不支持继承链中field override(dart官方也不推荐)
+// TODO: 并且只关注UnnamedConstructor
+// TODO: 并且UnnamedConstructor的参数只关心super和this修饰的参数
+// TODO: 目前的限制就是以上,之后可以考虑支持某些
+import 'package:analyzer/dart/constant/value.dart';
+import 'package:analyzer/dart/element/element.dart';
+import 'package:fury_core/src/code_gen/analyse/analysis_cache.dart';
+import 'package:fury_core/src/code_gen/entity/constructor_param.dart';
+import 'package:fury_core/src/code_gen/entity/contructor_params.dart';
+import 'package:fury_core/src/code_gen/entity/location_mark.dart';
+import 
'package:fury_core/src/code_gen/excep/constraint_violation/circular_incapable_risk.dart';
+import 
'package:fury_core/src/code_gen/excep/constraint_violation/no_usable_cons_excep.dart';
+import 'package:fury_core/src/code_gen/meta/impl/cons_info.dart';
+
+import '../../../const/location_level.dart';
+import '../../../excep/fury_gen_excep.dart';
+import '../../analysis_type_identifier.dart';
+import '../../annotation/location_level_ensure.dart';
+
+class ConstrcutorAnalyzer {

Review Comment:
   Do we have a better name for directory `cons` 



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to