Created
January 23, 2020 03:18
-
-
Save Eyas/200fb82329d4912c87e3b478c5299606 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function ForwardDeclareClasses(topics: ReadonlyArray<TypedTopic>): ClassMap { | |
// ... | |
// ... | |
for (const topic of topics) { | |
if (!IsClass(topic)) continue; | |
// ... | |
classes.set( | |
topic.Subject.toString(), new Class(topic.Subject, /* ... */)); | |
} | |
// ... | |
return classes; | |
} | |
function BuildClasses(topics: ReadonlyArray<TypedTopic>, classes: ClassMap) { | |
for (const topic of topics) { | |
if (!IsClass(topic)) continue; | |
const cls = classes.get(topic.Subject.toString()); | |
if (!cls) { | |
throw new Error(/**... class should have been forward declared */); | |
} | |
toClass(cls, topic, classes); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment