HaxeFoundation / HaxeFoundation/hxcs

Fields initialization

Open
#31 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haxe
Stars
56
Forks
21
PR merge metrics
No merged PRs in 30d

Description

after targeting C#, all fields initializations are moved into class's constuctor, and puts after calling constructor of super class. In most of all cases it;s fine, but here is onle example, that will not work:
`class b {}`
`class a extends b {public var test:Int = 1;}`
If class b represents some kind of deserializator (from json-type string, for example), it will initialize some fields, implemented in class a, using reflection.
so:
1) constructor of class 'a' calls constroctor of class 'b'
2) class 'b' deserializes data, and initializes field 'test' of class 'a'
3) class 'a' replases data from field 'test' with default '1';

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the C# target's generated-constructor and field-initialization handling, then reproduce the issue with the class a and class b example in the report. Trace the order of superclass construction, deserialization, and default field initialization; done means the inherited deserialization value is not overwritten by the subclass default.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
compilers
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.