P4C
The P4 Compiler
 
Loading...
Searching...
No Matches
CompileContextStack Struct Referencefinal

Static Public Member Functions

static bool isEmpty ()
 
template<typename CompileContextType >
static CompileContextType & top ()
 

Friends

struct AutoCompileContext
 

Detailed Description

A stack of active compilation contexts. Only the top context is accessible. Compilation contexts can be nested to allow composing programs without intermingling their stack.

Member Function Documentation

◆ top()

template<typename CompileContextType >
static CompileContextType & CompileContextStack::top ( )
inlinestatic
Returns
the current compilation context (i.e., the top of the compilation context stack), cast to the requested type. If the current compilation context is of the wrong type, or the stack is empty, an assertion fires.