Loading...
Searching...
No Matches
CBot::CBotExprVar Class Reference

Expression representing a variable name. More...

`#include <src/CBot/CBotInstr/CBotExprVar.h>`

Inheritance diagram for CBot::CBotExprVar:
[legend]

## Public Member Functions

bool | Execute (CBotStack *&pj) override
| Execute Execute, making the value of a variable.
void | RestoreState (CBotStack *&pj, bool bMain) override
| RestoreState.
bool | ExecuteVar (CBotVar *&pVar, CBotStack *&pile, CBotToken *prevToken, bool bStep)
| ExecuteVar Fetch a variable at runtime.
void | RestoreStateVar (CBotStack *&pj, bool bMain) override
| RestoreStateVar Fetch variable at runtime.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotCStack *&pile)
| ExecuteVar.
virtual bool | ExecuteVar (CBotVar *&pVar, CBotStack *&pile, CBotToken *prevToken, bool bStep, bool bExtend)
| ExecuteVar.
Public Member Functions inherited from CBot::CBotInstr
| CBotInstr ()
| Constructor.
virtual | ~CBotInstr ()
| Destructor.
virtual bool | Execute (CBotStack *&pj, CBotVar *pVar)
| Execute.
void | SetToken (CBotToken *p)
| SetToken Set the token corresponding to the instruction.
int | GetTokenType ()
| GetTokenType Return the type of the token assicated with the instruction.
CBotToken * | GetToken ()
| GetToken Return associated token.
void | AddNext (CBotInstr *n)
| AddNext Adds the statement following the other.
CBotInstr * | GetNext ()
| GetNext Returns next statement.
void | AddNext3 (CBotInstr *n)
| AddNext3.
CBotInstr * | GetNext3 ()
| GetNext3.
void | AddNext3b (CBotInstr *n)
| AddNext3b.
CBotInstr * | GetNext3b ()
| GetNext3b.
virtual bool | HasReturn ()
| Check a list of instructions for a return statement.

## Static Public Member Functions

static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack, bool bCheckReadOnly=false)
| Compile an expression of a variable, possibly chained with index operators and/or dot operators.
static CBotInstr * | CompileMethode (CBotToken *&p, CBotCStack *pStack)
| CompileMethode.
Static Public Member Functions inherited from CBot::CBotInstr
static CBotInstr * | Compile (CBotToken *&p, CBotCStack *pStack)
| Compile an instruction.
static CBotInstr * | CompileArray (CBotToken *&p, CBotCStack *pStack, CBotTypResult type, bool first=true)
| CompileArray.
static void | IncLvl (std::string &label)
| IncLvl Adds a level with a label.
static void | IncLvl ()
| IncLvl Adds a level (switch statement).
static void | DecLvl ()
| DecLvl Free a level.
static bool | ChkLvl (const std::string &label, int type)
| ChkLvl Control validity of break and continue.

## Protected Member Functions

virtual const std::string | GetDebugName () override
| Returns the name of this class.
virtual std::string | GetDebugData () override
| Returns additional data associated with this instruction for debugging purposes.
Protected Member Functions inherited from CBot::CBotInstr
virtual std::map< std::string, CBotInstr * > | GetDebugLinks ()

## Friends

class | CBotPostIncExpr
class | CBotPreIncExpr

## Additional Inherited Members

Protected Attributes inherited from CBot::CBotInstr
CBotToken | m_token
| Keeps the token.
CBotInstr * | m_next
| Linked command.
CBotInstr * | m_next2b
| Second list definition chain.
CBotInstr * | m_next3
| Third list for indices and fields.
CBotInstr * | m_next3b
| Necessary for reporting tables.
Static Protected Attributes inherited from CBot::CBotInstr
static int | m_LoopLvl = 0
| Counter of nested loops, to determine the break and continue valid.

## Detailed Description

Expression representing a variable name.

Verifies that variable is known during compilation Verifies taht variable is initialized during execution

## Member Function Documentation

## Compile()

CBotInstr * CBot::CBotExprVar::Compile | ( | CBotToken *& | p,
|  | CBotCStack * | pStack,
|  | bool | bCheckReadOnly = false )

static

Compile an expression of a variable, possibly chained with index operators and/or dot operators.

Parameters

  p[in,out] | Pointer to first token of the expression, will be updated to point to first token after the expression
  pStack | Current compilation stack frame
  bCheckReadOnly | True for operations that would modify the value of the variable

Returns

## CompileMethode()

CBotInstr * CBot::CBotExprVar::CompileMethode | ( | CBotToken *& | p,
|  | CBotCStack * | pStack )

static

CompileMethode.

Parameters

  p |
  pStack |

Returns

## Execute()

bool CBot::CBotExprVar::Execute | ( | CBotStack *& | pj | ) |

override virtual

Execute Execute, making the value of a variable.

Parameters

  pj |

Returns

Reimplemented from CBot::CBotInstr.

## RestoreState()

void CBot::CBotExprVar::RestoreState | ( | CBotStack *& | pj,
|  | bool | bMain )

override virtual

RestoreState.

Parameters

  pj |
  bMain |

Reimplemented from CBot::CBotInstr.

## ExecuteVar() [1/3]

bool CBot::CBotExprVar::ExecuteVar | ( | CBotVar *& | pVar,
|  | CBotStack *& | pile,
|  | CBotToken * | prevToken,
|  | bool | bStep )

ExecuteVar Fetch a variable at runtime.

Parameters

  pVar |
  pile |
  prevToken |
  bStep |

Returns

## RestoreStateVar()

void CBot::CBotExprVar::RestoreStateVar | ( | CBotStack *& | pj,
|  | bool | bMain )

override virtual

RestoreStateVar Fetch variable at runtime.

Parameters

  pj |
  bMain |

Reimplemented from CBot::CBotInstr.

## GetDebugName()

virtual const std::string CBot::CBotExprVar::GetDebugName | ( |  | ) |

inline override protected virtual

Returns the name of this class.

See also
  CBotDebug

Implements CBot::CBotInstr.

## GetDebugData()

std::string CBot::CBotExprVar::GetDebugData | ( |  | ) |

override protected virtual

Returns additional data associated with this instruction for debugging purposes.

See also
  CBotDebug

Reimplemented from CBot::CBotInstr.

## ExecuteVar() [2/3]

bool CBot::CBotInstr::ExecuteVar | ( | CBotVar *& | pVar,
|  | CBotCStack *& | pile )

virtual

ExecuteVar.

Parameters

  pVar |
  pile |

Returns

Reimplemented from CBot::CBotInstr.

## ExecuteVar() [3/3]

bool CBot::CBotInstr::ExecuteVar | ( | CBotVar *& | pVar,
|  | CBotStack *& | pile,
|  | CBotToken * | prevToken,
|  | bool | bStep,
|  | bool | bExtend )

virtual

ExecuteVar.

Parameters

  pVar |
  pile |
  prevToken |
  bStep |
  bExtend |

Returns

Reimplemented from CBot::CBotInstr.

The documentation for this class was generated from the following files:

- src/CBot/CBotInstr/CBotExprVar.h
- src/CBot/CBotInstr/CBotExprVar.cpp