コード例 #1
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     EquelleType lt = left_->type();
     EquelleType rt = right_->type();
     switch (op_) {
     case Add:
         return lt; // should be identical to rt.
     case Subtract:
         return lt; // should be identical to rt.
     case Multiply: {
         const bool isvec = lt.basicType() == Vector || rt.basicType() == Vector;
         const BasicType bt = isvec ? Vector : Scalar;
         const bool coll = lt.isCollection() || rt.isCollection();
         const bool sequence = lt.isSequence() || rt.isSequence();
         const CompositeType ct = coll ? Collection : (sequence ? Sequence : None);
         const int gm = lt.isCollection() ? lt.gridMapping() : rt.gridMapping();
         return EquelleType(bt, ct, gm);
     }
     case Divide: {
         const BasicType bt = lt.basicType();
         const bool coll = lt.isCollection() || rt.isCollection();
         const int gm = lt.isCollection() ? lt.gridMapping() : rt.gridMapping();
         return EquelleType(bt, coll ? Collection : None, gm);
     }
     default:
         yyerror("internal compiler error in BinaryOpNode::type().");
         return EquelleType();
     }
 }
コード例 #2
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 CollectionTypeNode(TypeNode* btype, ExpressionNode* gridmapping, ExpressionNode* subsetof)
     : TypeNode(EquelleType()),
       btype_(btype),
       gridmapping_(gridmapping),
       subsetof_(subsetof)
 {
     // TODO. Check if this assert is what we want.
     //       Is "Collection Of X On Y Subset Of Z" allowed?
     assert(gridmapping == nullptr || subsetof == nullptr);
 }
コード例 #3
0
 EquelleType type() const
 {
     EquelleType t = SymbolTable::getFunction(funcname_).returnType(funcargs_->argumentTypes());
     if (dsr_ != NotApplicable) {
         assert(t.isEntityCollection());
         return EquelleType(t.basicType(), Collection, dsr_, t.subsetOf(), t.isMutable(), t.isDomain());
     } else {
         return t;
     }
 }
コード例 #4
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     EquelleType bt = btype_->type();
     int gm = NotApplicable;
     if (gridmapping_) {
         gm = gridmapping_->type().gridMapping();
     }
     int subset = NotApplicable;
     if (subsetof_) {
         gm = PostponedDefinition;
         subset = subsetof_->type().gridMapping();
     }
     return EquelleType(bt.basicType(), Collection, gm, subset);
 }
コード例 #5
0
ファイル: ParseActions.cpp プロジェクト: atgeirr/equelle
TypeNode* handleSequenceType(TypeNode* type_expr)
{
    SequenceTypeNode* tn = new SequenceTypeNode(type_expr);
    tn->setLocation(FileLocation(yylineno));
    return tn;
#if 0
    const EquelleType et = type_expr->type();
    if (!et.isBasic()) {
        yyerror("cannot create a Sequence of non-basic types.");
    }
    TypeNode* node = new TypeNode(EquelleType(et.basicType(), Sequence, et.gridMapping(), et.subsetOf()));
    node->setLocation(FileLocation(yylineno));
    return node;
#endif
}
コード例 #6
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     // We do not want mutability of a variable to be passed on to
     // expressions involving that variable.
     if (SymbolTable::isVariableDeclared(varname_)) {
         EquelleType et = SymbolTable::variableType(varname_);
         if (et.isMutable()) {
             et.setMutable(false);
         }
         return et;
     } else if (SymbolTable::isFunctionDeclared(varname_)) {
         // Function reference.
         return EquelleType();
     } else {
         throw std::logic_error("Internal compiler error in VarNode::type().");
     }
 }
コード例 #7
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     return EquelleType(Scalar);
 }
コード例 #8
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     return EquelleType();
 }
コード例 #9
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     // Functions' types cannot be expressed as an EquelleType
     return EquelleType();
 }
コード例 #10
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     return EquelleType(left_->type().basicType(), Collection, right_->type().gridMapping(), left_->type().subsetOf());
 }
コード例 #11
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     return EquelleType(Scalar,
                        expr_to_norm_->type().compositeType(),
                        expr_to_norm_->type().gridMapping());
 }
コード例 #12
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     EquelleType lt = left_->type();
     return EquelleType(Bool, lt.compositeType(), lt.gridMapping());
 }
コード例 #13
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 explicit MutableTypeNode(TypeNode* btype)
     : TypeNode(EquelleType()),
       btype_(btype)
 {
 }
コード例 #14
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 explicit SequenceTypeNode(TypeNode* btype)
     : TypeNode(EquelleType()),
       btype_(btype)
 {
 }
コード例 #15
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 ArrayTypeNode(TypeNode* btype, const int array_size)
     : TypeNode(EquelleType()),
       btype_(btype),
       array_size_(array_size)
 {
 }
コード例 #16
0
ファイル: ASTNodes.hpp プロジェクト: atgeirr/equelle
 EquelleType type() const
 {
     return EquelleType(String);
 }