//----------------------------------------------------------- public static void exit( ) { if (current_context == null) { ERROR.SystemErrorIn("exit", "attempt to exit from empty context"); return; } current_context = (DECLARATION)current_context.enclosing; if (current_context is NAMESPACE_DECL) { current_namespace_decl = (NAMESPACE_DECL)current_context; current_program_unit = null; } if (current_context is UNIT_DECL && !(current_context is NAMESPACE_DECL)) { current_program_unit = (UNIT_DECL)current_context; } else { current_program_unit = null; } // For the case if we exit from a nested routine... if (current_context is ROUTINE_DECL) { current_routine = (ROUTINE_DECL)current_context; } else { current_routine = null; } }
public static void enter(DECLARATION block) { if (current_context != null && current_context != block.enclosing) // System error { ERROR.SystemErrorIn("enter", "attempt to enter to an unrelated scope"); return; } current_context = block; if (block is UNIT_DECL && !(block is NAMESPACE_DECL)) { current_program_unit = (UNIT_DECL)block; current_routine_decl = null; } if (block is ROUTINE_DECL) { current_routine_decl = (ROUTINE_DECL)block; } else if (block is NAMESPACE_DECL) { current_namespace_decl = (NAMESPACE_DECL)block; } }
protected virtual void Visit_UNKNOWN_NODE(NODE node) { ERROR.SystemErrorIn("Visit_UNKNOWN_NODE", "should never been called"); }