21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
.setLocationId( lvval.locationId() ) );
co_yield TypeCheck( lhs, ref, tcc );
}
TCGen TypeCheckingDereference( const Term& lhs, const Term& rhs, TypeCheckingContext tcc )
{
auto refval = EIRToValue( rhs );
if( !refval )
co_return;
auto refType = FromValue< ReferenceType >( *EIRToValue( refval->type() ) );
if( !refType )
co_return;
auto loc = refval->locationId() ;
auto content = ValueToEIR( BuildComputedValue( refType->type(),
*refval, cir::Load( refType->type(), loc ) )
.setLocationId( loc ) );
// TypeCheck the param with the ref's content
co_yield TypeCheck( lhs, content, tcc );
}
TCGen TypeCheckingBuildTempRef( const Term& lhs, const Term& rhs, const TypeCheckingContext& tcc )
{
auto lRefType = *FromValue< ReferenceType >( *EIRToValue( EIRToValuePattern( lhs )->type() ) );
if( IsMutReferenceType( lRefType ) )
co_return;
|
|
|
|
|
|
|
|
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
.setLocationId( lvval.locationId() ) );
co_yield TypeCheck( lhs, ref, tcc );
}
TCGen TypeCheckingDereference( const Term& lhs, const Term& rhs, TypeCheckingContext tcc )
{
auto refVal = EIRToValue( rhs );
if( !refVal )
co_return;
auto refType = FromValue< ReferenceType >( *EIRToValue( refVal->type() ) );
if( !refType )
co_return;
auto loc = refVal->locationId() ;
auto content = ValueToEIR( BuildComputedValue( refType->type(),
*refVal, cir::Load( refType->type(), loc ) )
.setLocationId( loc ) );
// TypeCheck the param with the ref's content
co_yield TypeCheck( lhs, move( content ), tcc );
}
TCGen TypeCheckingBuildTempRef( const Term& lhs, const Term& rhs, const TypeCheckingContext& tcc )
{
auto lRefType = *FromValue< ReferenceType >( *EIRToValue( EIRToValuePattern( lhs )->type() ) );
if( IsMutReferenceType( lRefType ) )
co_return;
|