/** * * OOAS Compiler - C++ AST * * Copyright 2015, AIT Austrian Institute of Technology. * All rights reserved. * * SEE THE "LICENSE" FILE FOR THE TERMS UNDER WHICH THIS FILE IS PROVIDED. * * If you modify the file please update the list of contributors below to in- * clude your name. Please also stick to the coding convention of using TABs * to do the basic (block-level) indentation and spaces for anything after * that. (Enable the display of special chars and it should be pretty obvious * what this means.) Also, remove all trailing whitespace. * * Contributors: * Willibald Krenn (AIT) * Stephan Zimmerer (AIT) * Christoph Czurda (AIT) * */ #pragma once #include #include #include #include namespace Ast { class TupleConstructor final : public TypeConstructionExpression { protected: ExpressionList m_values; Identifier* m_tupleType; bool m_matcher; TupleConstructor(): TypeConstructionExpression(ExpressionKind::TupleConstr), m_values(), m_tupleType(nullptr), m_matcher(false) {}; TupleConstructor(const TupleConstructor &toCopy): TypeConstructionExpression(toCopy), m_values(toCopy.m_values), m_tupleType(toCopy.m_tupleType), m_matcher(toCopy.m_matcher) {}; static TupleConstructor* create(ExpressionKind) {return new TupleConstructor();} static TupleConstructor* createCopy(const TupleConstructor& toCopy) {return new TupleConstructor(toCopy);} public: friend class Ast; friend class Expression; void init(std::int32_t line, std::int32_t pos, Type* typeRef,IdentifierList* callTargetsIdentifierListRef, SymbolTable* symbTabRef, ExpressionList* exprList, Identifier* tupleTypeId, bool isMatcher) { TypeConstructionExpression::init(line,pos,typeRef,callTargetsIdentifierListRef, symbTabRef); m_values = std::move(*exprList); m_tupleType = tupleTypeId, m_matcher = isMatcher; } ExpressionList& values() {return m_values;} Identifier* tupleType() {return m_tupleType;}; bool isMatcher() {return m_matcher;} void setIsMatcher(bool newVal) {m_matcher = newVal;}; void accept(IAstVisitor& visitor) override {visitor.visit(this);}; //void setTupleValues(ExpressionList& values) {m_values = values;}; }; }