com.foursquare.spindle.codegen.runtime
Helper class to hold a type declaration and all the parts necessary for it to be properly scoped.
Given a set of programs and the currently resolved type declarations, finds any typedefs that are yet to be resolved and properly scopes them.
Given a set of programs and the currently resolved type declarations, finds any typedefs that are yet to be resolved and properly scopes them.
- set of programs for which to resolve typedef declarations
- a map of already-resolved type declarations, keyed first by program name and then by type alias
Takes a program and resolves the "first pass" TypeDeclarations.
Takes a program and resolves the "first pass" TypeDeclarations. That is, the easy ones.
Resolves types declared as enums, structs, unions, and exceptions. Typedefs are left for the recursive phase, because they can reference types across source boundaries.
Types declared as services are not resolved, because they cannot be referenced in Thrift files.
- program for which to resolve type declarations
Helper method to merge two nested maps.
Takes a set of programs and recursively resolves all the types declared as typedefs.
Takes a set of programs and recursively resolves all the types declared as typedefs.
These declarations can reference types across source boundaries, so we must keep track of all included program sources and all the type declarations seen so far in order to successfully resolve.
For each pass, the set of type declarations which have not yet been resolved is found. If the set is empty, the recursion is done. If the set is non-empty, an attempt is made to resolve those type declarations. If any progress is made, the recursion continues. If no progress is made, the recursion terminates with an exception.
- set of programs for which to resolve typedef declarations
- a map of already-resolved type declarations, keyed first by program name and then by type alias
Given a set of scoped type declarations, attempts to resolve them.
Given a set of scoped type declarations, attempts to resolve them. Returns a map of successfully resolved type declarations.
May not resolve all the given type declarations.
- set of scoped type declarations to resolve
Takes a set of programs and resolves all its type declarations.
Takes a set of programs and resolves all its type declarations.
This is accomplished in a series of passes. The first pass resolves all type declarations which cannot reference other types (enum, struct, union exception). Subsequent passes attempt to resolve type declarations that can reference other types (typedefs).
- set of programs for which to resolve type declarations
TypeDeclarations are used to bridge the gap between the type information contained in the TypeRegistry (which can only resolve types included in the same file) and the type information needed to compile a file (which might span several source files, because of includes).
TypeDeclarationResolver will look across several source files and resolve all the types declared in any of those files.
The following Thrift keywords can declare new types: enum, struct, union, exception, service, typedef.