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
Mikhail Arkhipov (MikhailArkhipov) merged 7 commits into
microsoft:masterfrom
MikhailArkhipov:walk
Nov 5, 2018
Merged

Mikhail Arkhipov (MikhailArkhipov) merged 7 commits into
microsoft:masterfrom
MikhailArkhipov:walk

Conversation

@MikhailArkhipov

Copy link
Copy Markdown

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
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