Skip to content
This repository was archived by the owner on Apr 14, 2022. It is now read-only.

Fix processing of forward references #304

Merged
merged 7 commits into from
Nov 5, 2018
Merged

Fix processing of forward references #304

merged 7 commits into from
Nov 5, 2018

Conversation

MikhailArkhipov
Copy link

Fixes #294

  • Implement ordered processing of functions and properties. If return type is not known, process walker for that function which, in turn, can process more.
  • Fix some comments and clean up code.

public void ProcessSet() {
// Do not use foreach since walker list is dynamically
// modified and walkers are removed as they are done.
while (_functionWalkers.Count > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

var walkers = _functionWalkers.Values.ToArray();
_functionWalkers.Clear();
foreach (var walker in walkers) {
    walker.Walk();
}

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, the point is in keeping walkers in the array for recursive processing. We don't walk in order. Ex A calls B which calls D which calls C. We take A which then, when it needs return type of B will call ProcessFunction that needs to find B walker and process it. B walkers will cause ProcessFunction on D and then on C.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So if walker is removed b/c it was called in some chain, we don't want to walk it again so that's why there is no ToArray

Mikhail Arkhipov added 2 commits October 26, 2018 23:11
This was referenced Nov 1, 2018
@MikhailArkhipov MikhailArkhipov merged commit 15a78e1 into microsoft:master Nov 5, 2018
@MikhailArkhipov MikhailArkhipov deleted the walk branch November 6, 2018 01:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants