#ifndef __X10_LANG_FINISHSTATE__COLLECTINGFINISH_H
#define __X10_LANG_FINISHSTATE__COLLECTINGFINISH_H

#include <x10rt.h>


#define X10_LANG_FINISHSTATE__FINISH_H_NODEPS
#include <x10/lang/FinishState__Finish.h>
#undef X10_LANG_FINISHSTATE__FINISH_H_NODEPS
#define X10_LANG_FINISHSTATE__COLLECTINGFINISHSTATE_H_NODEPS
#include <x10/lang/FinishState__CollectingFinishState.h>
#undef X10_LANG_FINISHSTATE__COLLECTINGFINISHSTATE_H_NODEPS
#define X10_IO_CUSTOMSERIALIZATION_H_NODEPS
#include <x10/io/CustomSerialization.h>
#undef X10_IO_CUSTOMSERIALIZATION_H_NODEPS
namespace x10 { namespace lang { 
template<class TPMGL(T)> class Reducible;
} } 
namespace x10 { namespace lang { 
class FinishState__RootFinish;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class FinishState__RootCollectingFinish;
} } 
namespace x10 { namespace io { 
class SerialData;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class GlobalRef;
} } 
namespace x10 { namespace lang { 
class FinishState;
} } 
namespace x10 { namespace lang { 
class Place;
} } 
namespace x10 { namespace lang { 
class FinishState__FinishSkeleton;
} } 
namespace x10 { namespace lang { 
class Runtime;
} } 
namespace x10 { namespace lang { 
class Boolean;
} } 
namespace x10 { namespace compiler { 
class CompilerFlags;
} } 
namespace x10 { namespace lang { 
class FailedDynamicCheckException;
} } 
namespace x10 { namespace lang { 
class FinishState__FinishStates;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(U)> class Fun_0_0;
} } 
namespace x10 { namespace lang { 
template<class TPMGL(T)> class FinishState__RemoteCollectingFinish;
} } 
namespace x10 { namespace lang { 
class Any;
} } 
namespace x10 { namespace lang { 
class Int;
} } 
namespace x10 { namespace lang { 

template<class TPMGL(T)> class FinishState__CollectingFinish;
template <> class FinishState__CollectingFinish<void>;
template<class TPMGL(T)> class FinishState__CollectingFinish : public x10::lang::FinishState__Finish
  {
    public:
    RTT_H_DECLS_CLASS
    
    static x10aux::itable_entry _itables[4];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    static x10::io::CustomSerialization::itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > _itable_0;
    
    static x10::lang::Any::itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > _itable_1;
    
    static typename x10::lang::FinishState__CollectingFinishState<TPMGL(T)>::template itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > _itable_2;
    
    x10aux::ref<x10::lang::Reducible<TPMGL(T)> > FMGL(reducer);
    
    void _constructor(x10aux::ref<x10::lang::Reducible<TPMGL(T)> > reducer);
    
    static x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > _make(
             x10aux::ref<x10::lang::Reducible<TPMGL(T)> > reducer);
    
    void _constructor(x10aux::ref<x10::io::SerialData> data);
    
    static x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > _make(
             x10aux::ref<x10::io::SerialData> data);
    
    virtual x10aux::ref<x10::io::SerialData> serialize();
    virtual void accept(TPMGL(T) t, x10_int id);
    virtual TPMGL(T) waitForFinishExpr();
    virtual x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >
      x10__lang__FinishState__CollectingFinish____x10__lang__FinishState__CollectingFinish__this(
      );
    
    // Serialization
    public: static const x10aux::serialization_id_t _serialization_id;
    
    public: virtual x10aux::serialization_id_t _get_serialization_id() {
         return _serialization_id;
    }
    
    public: virtual void _serialize_body(x10aux::serialization_buffer& buf);
    
    public: static x10aux::ref<x10::lang::Reference> _deserializer(x10aux::deserialization_buffer& buf);
    
    public: void _deserialize_body(x10aux::deserialization_buffer& buf);
    
};
template <> class FinishState__CollectingFinish<void> : public x10::lang::FinishState__Finish
{
    public:
    static x10aux::RuntimeType rtt;
    static const x10aux::RuntimeType* getRTT() { return & rtt; }
    
};

} } 
#endif // X10_LANG_FINISHSTATE__COLLECTINGFINISH_H

namespace x10 { namespace lang { 
template<class TPMGL(T)> class FinishState__CollectingFinish;
} } 

#ifndef X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_NODEPS
#define X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_NODEPS
#include <x10/lang/FinishState__Finish.h>
#include <x10/lang/FinishState__CollectingFinishState.h>
#include <x10/io/CustomSerialization.h>
#include <x10/lang/Reducible.h>
#include <x10/lang/FinishState__RootFinish.h>
#include <x10/lang/FinishState__RootCollectingFinish.h>
#include <x10/io/SerialData.h>
#include <x10/lang/GlobalRef.h>
#include <x10/lang/FinishState.h>
#include <x10/lang/Place.h>
#include <x10/lang/FinishState__FinishSkeleton.h>
#include <x10/lang/Runtime.h>
#include <x10/lang/Boolean.h>
#include <x10/compiler/CompilerFlags.h>
#include <x10/lang/FailedDynamicCheckException.h>
#include <x10/lang/FinishState__FinishStates.h>
#include <x10/lang/Fun_0_0.h>
#include <x10/lang/FinishState__RemoteCollectingFinish.h>
#include <x10/lang/Any.h>
#include <x10/lang/Int.h>
#ifndef X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_GENERICS
#define X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_GENERICS
#endif // X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_GENERICS
#ifndef X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_IMPLEMENTATION
#define X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_IMPLEMENTATION
#include <x10/lang/FinishState__CollectingFinish.h>

#ifndef X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__15_CLOSURE
#define X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__15_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_0.h>
template<class TPMGL(T)> class x10_lang_FinishState__CollectingFinish__closure__15 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > >::template itable <x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > __apply() {
        
        //#line 609 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10Return_c
        return x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)>::_make(_ref,
                                                                               tmpReducer);
        
    }
    
    // captured environment
    x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > _ref;
    x10aux::ref<x10::lang::Reducible<TPMGL(T)> > tmpReducer;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->_ref);
        buf.write(this->tmpReducer);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >* storage = x10aux::alloc<x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) > >(storage));
        x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > that__ref = buf.read<x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > >();
        x10aux::ref<x10::lang::Reducible<TPMGL(T)> > that_tmpReducer = buf.read<x10aux::ref<x10::lang::Reducible<TPMGL(T)> > >();
        x10aux::ref<x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) > > this_ = new (storage) x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >(that__ref, that_tmpReducer);
        return this_;
    }
    
    x10_lang_FinishState__CollectingFinish__closure__15(x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > _ref, x10aux::ref<x10::lang::Reducible<TPMGL(T)> > tmpReducer) : _ref(_ref), tmpReducer(tmpReducer) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > > >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > > >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10:609";
    }

};

template<class TPMGL(T)> typename x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > >::template itable <x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) > >x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::__apply, &x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState__RemoteCollectingFinish<TPMGL(T)> > > >, &x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(T)> const x10aux::serialization_id_t x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__15_CLOSURE
#ifndef X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__14_CLOSURE
#define X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__14_CLOSURE
#include <x10/lang/Closure.h>
#include <x10/lang/Fun_0_0.h>
template<class TPMGL(T)> class x10_lang_FinishState__CollectingFinish__closure__14 : public x10::lang::Closure {
    public:
    
    static typename x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> >::template itable <x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > > _itable;
    static x10aux::itable_entry _itables[2];
    
    virtual x10aux::itable_entry* _getITables() { return _itables; }
    
    // closure body
    x10aux::ref<x10::lang::FinishState> __apply() {
        
        //#line 609 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10Return_c
        return x10aux::class_cast_unchecked<x10aux::ref<x10::lang::FinishState> >(x10_lang_FinishState__CollectingFinish__closure__15<TPMGL(T)>(_ref, tmpReducer).__apply());
        
    }
    
    // captured environment
    x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > _ref;
    x10aux::ref<x10::lang::Reducible<TPMGL(T)> > tmpReducer;
    
    x10aux::serialization_id_t _get_serialization_id() {
        return _serialization_id;
    }
    
    void _serialize_body(x10aux::serialization_buffer &buf) {
        buf.write(this->_ref);
        buf.write(this->tmpReducer);
    }
    
    template<class __T> static x10aux::ref<__T> _deserialize(x10aux::deserialization_buffer &buf) {
        x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >* storage = x10aux::alloc<x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > >();
        buf.record_reference(x10aux::ref<x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > >(storage));
        x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > that__ref = buf.read<x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > >();
        x10aux::ref<x10::lang::Reducible<TPMGL(T)> > that_tmpReducer = buf.read<x10aux::ref<x10::lang::Reducible<TPMGL(T)> > >();
        x10aux::ref<x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > > this_ = new (storage) x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >(that__ref, that_tmpReducer);
        return this_;
    }
    
    x10_lang_FinishState__CollectingFinish__closure__14(x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > _ref, x10aux::ref<x10::lang::Reducible<TPMGL(T)> > tmpReducer) : _ref(_ref), tmpReducer(tmpReducer) { }
    
    static const x10aux::serialization_id_t _serialization_id;
    
    static const x10aux::RuntimeType* getRTT() { return x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> > >(); }
    virtual const x10aux::RuntimeType *_type() const { return x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> > >(); }
    
    x10aux::ref<x10::lang::String> toString() {
        return x10aux::string_utils::lit(this->toNativeString());
    }
    
    const char* toNativeString() {
        return "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10:609";
    }

};

template<class TPMGL(T)> typename x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> >::template itable <x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > >x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::_itable(&x10::lang::Reference::equals, &x10::lang::Closure::hashCode, &x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::__apply, &x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::toString, &x10::lang::Closure::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::_itables[2] = {x10aux::itable_entry(&x10aux::getRTT<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> > >, &x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::_itable),x10aux::itable_entry(NULL, NULL)};

template<class TPMGL(T)> const x10aux::serialization_id_t x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) >::template _deserialize<x10::lang::Reference>,x10aux::CLOSURE_KIND_NOT_ASYNC);

#endif // X10_LANG_FINISHSTATE__COLLECTINGFINISH__CLOSURE__14_CLOSURE
template<class TPMGL(T)> x10::io::CustomSerialization::itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >  x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_itable_0(&x10::lang::FinishState__CollectingFinish<TPMGL(T)>::equals, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::hashCode, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::serialize, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::toString, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10::lang::Any::itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >  x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_itable_1(&x10::lang::FinishState__CollectingFinish<TPMGL(T)>::equals, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::hashCode, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::toString, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::typeName);
template<class TPMGL(T)> typename x10::lang::FinishState__CollectingFinishState<TPMGL(T)>::template itable<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >  x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_itable_2(&x10::lang::FinishState__CollectingFinish<TPMGL(T)>::accept, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::equals, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::hashCode, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::toString, &x10::lang::FinishState__CollectingFinish<TPMGL(T)>::typeName);
template<class TPMGL(T)> x10aux::itable_entry x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_itables[4] = {x10aux::itable_entry(&x10aux::getRTT<x10::io::CustomSerialization>, &_itable_0), x10aux::itable_entry(&x10aux::getRTT<x10::lang::Any>, &_itable_1), x10aux::itable_entry(&x10aux::getRTT<x10::lang::FinishState__CollectingFinishState<TPMGL(T)> >, &_itable_2), x10aux::itable_entry(NULL, (void*)x10aux::getRTT<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >())};

//#line 596 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10FieldDecl_c

//#line 597 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_constructor(
                           x10aux::ref<x10::lang::Reducible<TPMGL(T)> > reducer) {
    
    //#line 598 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::lang::FinishState__Finish::_constructor(x10aux::class_cast_unchecked<x10aux::ref<x10::lang::FinishState__RootFinish> >(x10::lang::FinishState__RootCollectingFinish<TPMGL(T)>::_make(reducer)));
    
    //#line 597 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.AssignPropertyCall_c
    
    //#line 599 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
      FMGL(reducer) = reducer;
}
template<class TPMGL(T)> x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_make(
                           x10aux::ref<x10::lang::Reducible<TPMGL(T)> > reducer)
{
    x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >(), 0, sizeof(x10::lang::FinishState__CollectingFinish<TPMGL(T)>))) x10::lang::FinishState__CollectingFinish<TPMGL(T)>();
    this_->_constructor(reducer);
    return this_;
}



//#line 601 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10ConstructorDecl_c
template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_constructor(
                           x10aux::ref<x10::io::SerialData> data) {
    
    //#line 602 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10ConstructorCall_c
    (this)->::x10::lang::FinishState__Finish::_constructor(
      x10aux::class_cast<x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > >(x10aux::nullCheck(x10aux::nullCheck(data)->
                                                                                                          FMGL(superclassData))->
                                                                                        FMGL(data)));
    
    //#line 601 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.AssignPropertyCall_c
    
    //#line 603 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10LocalDecl_c
    x10aux::ref<x10::lang::Reducible<TPMGL(T)> > tmpReducer =
      x10aux::class_cast<x10aux::ref<x10::lang::Reducible<TPMGL(T)> > >(x10aux::nullCheck(data)->
                                                                          FMGL(data));
    
    //#line 604 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10FieldAssign_c
    ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
      FMGL(reducer) = tmpReducer;
    
    //#line 605 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10If_c
    if ((x10aux::struct_equals(x10::lang::Place::place((((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                                                          FMGL(ref))->location)->
                                 FMGL(id), x10aux::here)))
    {
        
        //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10FieldAssign_c
        ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
          FMGL(me) = ((__extension__ ({
            
            //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10LocalDecl_c
            x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > __desugarer__var__62__43871 =
              ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                FMGL(ref);
            
            //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10LocalDecl_c
            x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > ret43872;
            
            //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10If_c
            if (!((x10aux::struct_equals(x10::lang::Place::place((__desugarer__var__62__43871)->location),
                                         x10::lang::Place::_make(x10aux::here)))))
            {
                
                //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10If_c
                if (true) {
                    
                    //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": polyglot.ast.Throw_c
                    x10aux::throwException(x10aux::nullCheck(x10::lang::FailedDynamicCheckException::_make(x10aux::string_utils::lit("x10.lang.GlobalRef[x10.lang.FinishState]"))));
                }
                
            }
            
            //#line 606 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10LocalAssign_c
            ret43872 = __desugarer__var__62__43871;
            ret43872;
        }))
        )->__apply();
    } else {
        
        //#line 608 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10LocalDecl_c
        x10::lang::GlobalRef<x10aux::ref<x10::lang::FinishState> > _ref =
          ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
            FMGL(ref);
        
        //#line 609 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10FieldAssign_c
        ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
          FMGL(me) = x10::lang::Runtime::FMGL(finishStates)->__apply(
                       ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                         FMGL(ref), x10aux::ref<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> > >(x10aux::ref<x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T) > >(new (x10aux::alloc<x10::lang::Fun_0_0<x10aux::ref<x10::lang::FinishState> > >(sizeof(x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T)>)))x10_lang_FinishState__CollectingFinish__closure__14<TPMGL(T)>(_ref, tmpReducer))));
    }
    
}
template<class TPMGL(T)> x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_make(
                           x10aux::ref<x10::io::SerialData> data)
{
    x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >(), 0, sizeof(x10::lang::FinishState__CollectingFinish<TPMGL(T)>))) x10::lang::FinishState__CollectingFinish<TPMGL(T)>();
    this_->_constructor(data);
    return this_;
}



//#line 612 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::io::SerialData>
  x10::lang::FinishState__CollectingFinish<TPMGL(T)>::serialize(
  ) {
    
    //#line 612 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10Return_c
    return x10::io::SerialData::_make(x10aux::class_cast_unchecked<x10aux::ref<x10::lang::Any> >(((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                                                                                                   FMGL(reducer)),
                                      x10::lang::FinishState__Finish::serialize());
    
}

//#line 613 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::accept(
  TPMGL(T) t, x10_int id) {
    
    //#line 613 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": Eval of x10.ast.X10Call_c
    x10::lang::FinishState__CollectingFinishState<TPMGL(T)>::accept(x10aux::nullCheck(x10aux::class_cast<x10aux::ref<x10::lang::FinishState__CollectingFinishState<TPMGL(T)> > >(((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                                                                                                                                                                                   FMGL(me))), 
      t, id);
}

//#line 614 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> TPMGL(T) x10::lang::FinishState__CollectingFinish<TPMGL(T)>::waitForFinishExpr(
  ) {
    
    //#line 614 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10Return_c
    return x10aux::nullCheck((x10aux::class_cast<x10aux::ref<x10::lang::FinishState__RootCollectingFinish<TPMGL(T)> > >(((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this)->
                                                                                                                          FMGL(me))))->x10::lang::FinishState__RootCollectingFinish<TPMGL(T)>::waitForFinishExpr();
    
}

//#line 595 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10MethodDecl_c
template<class TPMGL(T)> x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >
  x10::lang::FinishState__CollectingFinish<TPMGL(T)>::x10__lang__FinishState__CollectingFinish____x10__lang__FinishState__CollectingFinish__this(
  ) {
    
    //#line 595 "/wrkdirs/usr/ports/lang/x10/work/x10.runtime/src-x10/x10/lang/FinishState.x10": x10.ast.X10Return_c
    return ((x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >)this);
    
}
template<class TPMGL(T)> const x10aux::serialization_id_t x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_serialization_id = 
    x10aux::DeserializationDispatcher::addDeserializer(x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_deserializer, x10aux::CLOSURE_KIND_NOT_ASYNC);

template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_serialize_body(x10aux::serialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    buf.write(this->serialize());
    
}

template<class TPMGL(T)> x10aux::ref<x10::lang::Reference> x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_deserializer(x10aux::deserialization_buffer& buf) {
    x10aux::ref<x10::lang::FinishState__CollectingFinish<TPMGL(T)> > this_ = new (memset(x10aux::alloc<x10::lang::FinishState__CollectingFinish<TPMGL(T)> >(), 0, sizeof(x10::lang::FinishState__CollectingFinish<TPMGL(T)>))) x10::lang::FinishState__CollectingFinish<TPMGL(T)>();
    buf.record_reference(this_);
    this_->_deserialize_body(buf);
    return this_;
}

template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_deserialize_body(x10aux::deserialization_buffer& buf) {
    /* NOTE: Implements x10.io.CustomSerialization */
    x10aux::ref<x10::io::SerialData>val_ = buf.read<x10aux::ref<x10::io::SerialData> >();
    _constructor(val_);
    
}

template<class TPMGL(T)> x10aux::RuntimeType x10::lang::FinishState__CollectingFinish<TPMGL(T)>::rtt;
template<class TPMGL(T)> void x10::lang::FinishState__CollectingFinish<TPMGL(T)>::_initRTT() {
    const x10aux::RuntimeType *canonical = x10aux::getRTT<x10::lang::FinishState__CollectingFinish<void> >();
    if (rtt.initStageOne(canonical)) return;
    const x10aux::RuntimeType* parents[3] = { x10aux::getRTT<x10::lang::FinishState__Finish>(), x10aux::getRTT<x10::lang::FinishState__CollectingFinishState<TPMGL(T)> >(), x10aux::getRTT<x10::io::CustomSerialization>()};
    const x10aux::RuntimeType* params[1] = { x10aux::getRTT<TPMGL(T)>()};
    x10aux::RuntimeType::Variance variances[1] = { x10aux::RuntimeType::invariant};
    const char *baseName = "x10.lang.FinishState.CollectingFinish";
    rtt.initStageTwo(baseName, x10aux::RuntimeType::class_kind, 3, parents, 1, params, variances);
}
#endif // X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_IMPLEMENTATION
#endif // __X10_LANG_FINISHSTATE__COLLECTINGFINISH_H_NODEPS
