Ignore:
Timestamp:
May 17, 2015, 1:19:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
0dd3a2f
Parents:
b87a5ed
Message:

licencing: second groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/ResolvExpr/Alternative.cc

    rb87a5ed ra32b204  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// Alternative.cc --
     8//
     9// Author           : Richard C. Bilson
     10// Created On       : Sat May 16 23:44:23 2015
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sat May 16 23:54:23 2015
     13// Update Count     : 2
     14//
     15
    116#include "Alternative.h"
    217#include "SynTree/Type.h"
     
    520
    621namespace ResolvExpr {
    7     Alternative::Alternative() : expr( 0 ) {}
     22        Alternative::Alternative() : expr( 0 ) {}
    823
    9     Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
    10         : cost( cost ), cvtCost( Cost::zero ), expr( expr ), env( env ) {}
     24        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost )
     25                : cost( cost ), cvtCost( Cost::zero ), expr( expr ), env( env ) {}
    1126
    12     Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost, const Cost &cvtCost )
    13         : cost( cost ), cvtCost( cvtCost ), expr( expr ), env( env ) {}
     27        Alternative::Alternative( Expression *expr, const TypeEnvironment &env, const Cost& cost, const Cost &cvtCost )
     28                : cost( cost ), cvtCost( cvtCost ), expr( expr ), env( env ) {}
    1429
    15     Alternative::Alternative( const Alternative &other ) {
    16         initialize( other, *this );
    17     }
     30        Alternative::Alternative( const Alternative &other ) {
     31                initialize( other, *this );
     32        }
    1833
    19     Alternative &Alternative::operator=( const Alternative &other ) {
    20         if ( &other == this ) return *this;
    21         initialize( other, *this );
    22         return *this;
    23     }
     34        Alternative &Alternative::operator=( const Alternative &other ) {
     35                if ( &other == this ) return *this;
     36                initialize( other, *this );
     37                return *this;
     38        }
    2439
    25     void Alternative::initialize( const Alternative &src, Alternative &dest ) {
    26         dest.cost = src.cost;
    27         dest.cvtCost = src.cvtCost;
    28         dest.expr = maybeClone( src.expr );
    29         dest.env = src.env;
    30     }
     40        void Alternative::initialize( const Alternative &src, Alternative &dest ) {
     41                dest.cost = src.cost;
     42                dest.cvtCost = src.cvtCost;
     43                dest.expr = maybeClone( src.expr );
     44                dest.env = src.env;
     45        }
    3146
    32     Alternative::~Alternative() {
    33         delete expr;
    34     }
     47        Alternative::~Alternative() {
     48                delete expr;
     49        }
    3550
    36     void Alternative::print( std::ostream &os, int indent ) const {
    37         os << std::string( indent, ' ' ) << "Cost " << cost << ": ";
    38         if ( expr ) {
    39             expr->print( os, indent );
    40             os << "(types:" << std::endl;
    41             printAll( expr->get_results(), os, indent + 4 );
    42             os << ")" << std::endl;
    43         } else {
    44             os << "Null expression!" << std::endl;
     51        void Alternative::print( std::ostream &os, int indent ) const {
     52                os << std::string( indent, ' ' ) << "Cost " << cost << ": ";
     53                if ( expr ) {
     54                        expr->print( os, indent );
     55                        os << "(types:" << std::endl;
     56                        printAll( expr->get_results(), os, indent + 4 );
     57                        os << ")" << std::endl;
     58                } else {
     59                        os << "Null expression!" << std::endl;
     60                } // if
     61                os << std::string( indent, ' ' ) << "Environment: ";
     62                env.print( os, indent+2 );
     63                os << std::endl;
    4564        }
    46         os << std::string( indent, ' ' ) << "Environment: ";
    47         env.print( os, indent+2 );
    48         os << std::endl;
    49     }
    5065} // namespace ResolvExpr
     66
     67// Local Variables: //
     68// tab-width: 4 //
     69// mode: c++ //
     70// compile-command: "make install" //
     71// End: //
Note: See TracChangeset for help on using the changeset viewer.