64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
|
*sig,
AppendToVectorTerm( c.identity(), TERM( id ) ),
move( pToks ) ) );
}
optional< Term > BuildArgPatternFromTFuncType( const Context& c, const Value& tfuncType )
{
const auto& ftype = *FromValue< TFuncType >( tfuncType );
immer::vector< Term > apv;
auto apvt = apv.transient();
bool success = true;
ForEachInVectorTerm( ftype.params(), [&]( auto&& param )
{
auto teArgPat = BuildTemplateArgPattern( c, param );
if( !teArgPat )
{
cout << "Invalid template parameter.\n";
success = false;
return false;
}
apvt.push_back( move( *teArgPat ) );
return true;
} );
if( !success )
return nullopt;
auto rtArgPat = BuildTemplateArgPattern( c, ftype.returnType() );
if( !rtArgPat )
{
cout << "Invalid template return type or texpr.\n";
return nullopt;
}
return TVEC(
TERM( make_shared< Vector >( apvt.persistent(), false ) ),
*rtArgPat
);
}
}
|
|
>
|
|
|
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
*sig,
AppendToVectorTerm( c.identity(), TERM( id ) ),
move( pToks ) ) );
}
optional< Term > BuildArgPatternFromTFuncType( const Context& c, const Value& tfuncType )
{
const auto& ftype = FromValue< TFuncType >( tfuncType );
assert( ftype );
immer::vector< Term > apv;
auto apvt = apv.transient();
bool success = true;
ForEachInVectorTerm( ftype->params(), [&]( auto&& param )
{
auto teArgPat = BuildTemplateArgPattern( c, param );
if( !teArgPat )
{
cout << "Invalid template parameter.\n";
success = false;
return false;
}
apvt.push_back( move( *teArgPat ) );
return true;
} );
if( !success )
return nullopt;
auto rtArgPat = BuildTemplateArgPattern( c, ftype->returnType() );
if( !rtArgPat )
{
cout << "Invalid template return type or texpr.\n";
return nullopt;
}
return TVEC(
TERM( make_shared< Vector >( apvt.persistent(), false ) ),
*rtArgPat
);
}
}
|