1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "builtins/builtins.h"
#include "parse/parse.h"
#include "precedence.h"
#include "builtins/helpers.h"
using namespace goose;
using namespace goose::ir;
using namespace goose::parse;
namespace goose::builtins
{
void SetupBreakStmt( Env& e )
{
auto handleBreak = []( Parser& p, uint32_t locationId, uint32_t prec )
|
|
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
#include "builtins/builtins.h"
#include "parse/parse.h"
#include "precedence.h"
#include "builtins/helpers.h"
using namespace goose;
using namespace goose::eir;
using namespace goose::parse;
namespace goose::builtins
{
void SetupBreakStmt( Env& e )
{
auto handleBreak = []( Parser& p, uint32_t locationId, uint32_t prec )
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
cb->poison();
return true;
}
// Emit cleanups for all live variables in the scopes that we are breaking through.
cb->destroyAllLiveValuesFromBreakScope( p.context(), cb->breakableScopeLevels() );
cfg->currentBB()->setTerminator( llr::Break( cb->breakableScopeLevels() ) );
return true;
};
Rule r( handleBreak );
auto ruleVal = ToValue( move( r ) );
auto ruleTerm = ValueToIRExpr( ruleVal );
e.storeValue( AppendToVectorTerm( RootIdentity(), TSID( break ) ), ANYTERM( _ ), ruleTerm );
}
}
|
|
|
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
cb->poison();
return true;
}
// Emit cleanups for all live variables in the scopes that we are breaking through.
cb->destroyAllLiveValuesFromBreakScope( p.context(), cb->breakableScopeLevels() );
cfg->currentBB()->setTerminator( cir::Break( cb->breakableScopeLevels() ) );
return true;
};
Rule r( handleBreak );
auto ruleVal = ToValue( move( r ) );
auto ruleTerm = ValueToIRExpr( ruleVal );
e.storeValue( AppendToVectorTerm( RootIdentity(), TSID( break ) ), ANYTERM( _ ), ruleTerm );
}
}
|