37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|
-
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
return InvalidIndex;
return it->second;
}
uint32_t UnificationContext::createValue()
{
m_values = m_values.push_back( { nullopt,0 } );
m_values = m_values.push_back( StoredValue() );
uint32_t index = m_values.size() - 1;
return index;
}
++m_numUnknownValues;
return index;
}
void UnificationContext::setValueRequired( uint32_t index )
{
assert( m_values.size() > index );
if( m_values[index].m_required )
return;
m_values = m_values.set( index, { m_values[index].m_term, m_values[index].m_complexity, true } );
if( !m_values[index].m_term )
++m_numUnknownValues;
}
void UnificationContext::setLHSHoleIndex( const StringId& name, uint32_t index )
{
if( name == "_"_sid )
{
++m_numAnonymousHoles;
return;
}
HoleName holeName( name, m_currentLHSNamespaceIndex );
CoW( m_pCow )->holeDict.emplace( holeName, index );
if( m_valuesAreRequired )
setValueRequired( index );
}
void UnificationContext::setRHSHoleIndex( const StringId& name, uint32_t index )
{
if( name == "_"_sid )
{
++m_numAnonymousHoles;
return;
}
HoleName holeName( name, m_currentRHSNamespaceIndex );
CoW( m_pCow )->holeDict.emplace( holeName, index );
if( m_valuesAreRequired )
setValueRequired( index );
}
void UnificationContext::eraseLHSName( const StringId& name )
{
HoleName holeName( name, m_currentLHSNamespaceIndex );
CoW( m_pCow )->holeDict.erase( holeName );
}
|