79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
|
// Create a local identity for the constant, from which the current identity will be visible.
// This is to avoid anything declared from within the using expression to leak outside,
// and also to make sure that whenever it will be parsed, it will have access to the current
// context in which it has been declared.
auto localIdentity = AppendToVectorTerm( InjectDomainIntoIdentity( context.identity(), ANYTERM( _ ) ), nameTerm->first );
context.env()->addVisibilityRule( InjectDomainIntoIdentity( context.identity(), ANYTERM( _ ) ), localIdentity );
auto nameSid = *name;
auto nameLoc = nameTerm->second;
bool bInUse = false;
auto loc = Location::CreateSpanningLocation( locationId, nameLoc );
auto UsingValProvider = [toks, localIdentity, bInUse, nameSid, loc]( Env& e, const Term& identity, const Term& contextId, Term& result ) mutable
{
auto& dm = DiagnosticsManager::GetInstance();
// In case of errors, we poison the result so that code invoking
// this using expression will not emit cascading errors.
if( bInUse )
{
|
<
<
|
|
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
|
// Create a local identity for the constant, from which the current identity will be visible.
// This is to avoid anything declared from within the using expression to leak outside,
// and also to make sure that whenever it will be parsed, it will have access to the current
// context in which it has been declared.
auto localIdentity = AppendToVectorTerm( InjectDomainIntoIdentity( context.identity(), ANYTERM( _ ) ), nameTerm->first );
context.env()->addVisibilityRule( InjectDomainIntoIdentity( context.identity(), ANYTERM( _ ) ), localIdentity );
auto nameLoc = nameTerm->second;
bool bInUse = false;
auto loc = Location::CreateSpanningLocation( locationId, nameLoc );
auto UsingValProvider = [toks, localIdentity, bInUse, loc]( Env& e, const Term& identity, const Term& contextId, Term& result ) mutable
{
auto& dm = DiagnosticsManager::GetInstance();
// In case of errors, we poison the result so that code invoking
// this using expression will not emit cascading errors.
if( bInUse )
{
|