diff options
author | Rhys Weatherley <[email protected]> | 2010-11-12 10:23:46 +1000 |
---|---|---|
committer | Rhys Weatherley <[email protected]> | 2010-11-12 14:04:09 +1000 |
commit | 1f8f99df28c49b66a48c357f4565e9779de25394 (patch) | |
tree | ff5823b474453dc32b8f6b793a36ba223593c412 /src/libs/glsl/glslast.cpp | |
parent | 73f77a0b8e3f3bec4c42392a5840cc2c5966f33c (diff) |
Build AST nodes from within the parser.
Diffstat (limited to 'src/libs/glsl/glslast.cpp')
-rw-r--r-- | src/libs/glsl/glslast.cpp | 24 |
1 files changed, 20 insertions, 4 deletions
diff --git a/src/libs/glsl/glslast.cpp b/src/libs/glsl/glslast.cpp index b6ab81930a6..b627edefd16 100644 --- a/src/libs/glsl/glslast.cpp +++ b/src/libs/glsl/glslast.cpp @@ -111,11 +111,19 @@ void FunctionCallExpression::accept0(Visitor *visitor) { if (visitor->visit(this)) { accept(expr, visitor); + accept(id, visitor); accept(arguments, visitor); } visitor->endVisit(this); } +void FunctionIdentifier::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) + accept(type, visitor); + visitor->endVisit(this); +} + void ExpressionStatement::accept0(Visitor *visitor) { if (visitor->visit(this)) @@ -198,8 +206,8 @@ void CaseLabelStatement::accept0(Visitor *visitor) visitor->endVisit(this); } -BasicType::BasicType(int _token) - : Type(Kind_BasicType), token(_token) +BasicType::BasicType(int _token, const char *_name, Category _category) + : Type(Kind_BasicType), token(_token), name(_name), categ(_category) { switch (token) { case GLSLParserTable::T_VOID: @@ -314,14 +322,22 @@ void StructType::Field::setInnerType(Type *innerType) *parent = innerType; } -void StructType::fixInnerTypes(Type *innerType, List<Field *> *fields) +List<StructType::Field *> *StructType::fixInnerTypes(Type *innerType, List<Field *> *fields) { if (!fields) - return; + return fields; List<Field *> *head = fields->next; List<Field *> *current = head; do { current->value->setInnerType(innerType); current = current->next; } while (current && current != head); + return fields; +} + +void PrecisionDeclaration::accept0(Visitor *visitor) +{ + if (visitor->visit(this)) + accept(type, visitor); + visitor->endVisit(this); } |