GDevelop Core
Core library for developing platforms and tools compatible with GDevelop.
|
Generate code for a parsed expression. More...
#include <ExpressionCodeGenerator.h>
Inherits gd::ExpressionParser2NodeWorker.
Public Member Functions | |
ExpressionCodeGenerator (const gd::String &rootType_, const gd::String &rootObjectName_, EventsCodeGenerator &codeGenerator_, EventsCodeGenerationContext &context_) | |
const gd::String & | GetOutput () |
Static Public Member Functions | |
static gd::String | GenerateExpressionCode (EventsCodeGenerator &codeGenerator, EventsCodeGenerationContext &context, const gd::String &type, const gd::Expression &expression, const gd::String &objectName="", const gd::String &extraInfo="") |
Protected Member Functions | |
void | OnVisitSubExpressionNode (SubExpressionNode &node) override |
void | OnVisitOperatorNode (OperatorNode &node) override |
void | OnVisitUnaryOperatorNode (UnaryOperatorNode &node) override |
void | OnVisitNumberNode (NumberNode &node) override |
void | OnVisitTextNode (TextNode &node) override |
void | OnVisitVariableNode (VariableNode &node) override |
void | OnVisitVariableAccessorNode (VariableAccessorNode &node) override |
void | OnVisitVariableBracketAccessorNode (VariableBracketAccessorNode &node) override |
void | OnVisitIdentifierNode (IdentifierNode &node) override |
void | OnVisitObjectFunctionNameNode (ObjectFunctionNameNode &node) override |
void | OnVisitFunctionCallNode (FunctionCallNode &node) override |
void | OnVisitEmptyNode (EmptyNode &node) override |
Generate code for a parsed expression.
Almost all code generation is dedicated to the gd::EventsCodeGenerator, so that it can be adapted to the target.
|
static |
Helper to generate the code for an expression. If expression is invalid, a default generated value is returned (0 for number expression, empty string for strings).
codeGenerator | The code generator to use to output code. |
context | The context of the code generation. |
type | The type of the expression (see gd::ExpressionParser2). |
expression | The expression to parse and generate code for. |
object | The object the expression refers too (only for "objectvar" type). |