1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
-
+
-
+
-
+
-
+
|
#include "sema.h"
using namespace empathy;
using namespace empathy::sema;
UnificationContext::UnificationContext( const ptr< UnificationRuleSet >& rules ) :
m_rules( rules )
{}
UnificationContext::UnificationContext( ptr< UnificationRuleSet >&& rules ) :
m_rules( move( rules ) )
{}
optional< uint32_t > UnificationContext::getLHSHoleIndex( const StringId& name ) const
uint32_t UnificationContext::getLHSHoleIndex( const StringId& name ) const
{
HoleName holeName( name, m_currentLHSNamespaceIndex );
auto it = m_pCoW->m_holes.find( holeName );
if( it == m_pCoW->m_holes.end() )
return nullopt;
return InvalidIndex;
return it->second;
}
optional< uint32_t > UnificationContext::getRHSHoleIndex( const StringId& name ) const
uint32_t UnificationContext::getRHSHoleIndex( const StringId& name ) const
{
HoleName holeName( name, m_currentRHSNamespaceIndex );
auto it = m_pCoW->m_holes.find( holeName );
if( it == m_pCoW->m_holes.end() )
return nullopt;
return InvalidIndex;
return it->second;
}
uint32_t UnificationContext::createValue()
{
m_values = m_values.push_back( nullopt );
|