Goose  Diff

Differences From Artifact [6e5e7ee18e]:

  • File bs/builtins/api/compiler.cpp — part of check-in [aee388d9c0] at 2019-08-09 19:54:22 on branch trunk — Cleanup: got rid of the half-assed location and poisoning systems in ir::Terms. (user: achavasse size: 5057)

To Artifact [ecfea93975]:

  • File bs/builtins/api/compiler.cpp — part of check-in [bd2fd03a33] at 2019-08-10 17:50:32 on branch trunk — lexer: generate token locations. (user: achavasse size: 4977)

19
20
21
22
23
24
25
26
27
28

29
30
31

32
33
34
35
36
37


38
39
40
41
42
43
44
19
20
21
22
23
24
25



26
27
28

29
30
31
32
33
34

35
36
37
38
39
40
41
42
43







-
-
-
+


-
+





-
+
+








                return ToValue( BuildExternalFunc( *ft, symbol ) );
            } );

        RegisterBuiltinFunc< Eager< uint32_t > ( string ) >( e, "ExecuteFile"_sid,
            [pEnv]( const string& filename ) -> uint32_t
            {
                auto pFN = make_shared< string >( filename );

                ifstream sourcefile( pFN->c_str() );
                ifstream sourcefile( filename.c_str() );
                if( !sourcefile.good() )
                {
                    cout << "can't open '" << *pFN << "'\n";
                    cout << "can't open '" << filename << "'\n";
                    return 0;
                }

                sema::Context c( pEnv.lock(), RootIdentity(), GetValueType< uint32_t >() );

                auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, pFN ), c );
                auto r = make_shared< parse::Resolver >(
                    make_shared< lex::Lexer >( sourcefile, filename ), c );
                parse::Parser p( r );

                auto cfg = make_shared< llr::CFG >();
                p.setCFG( cfg );
                p.setCurrentBB( cfg->entryBB() );

                p.parseSequence();
88
89
90
91
92
93
94
95
96
97

98
99
100
101

102
103
104
105

106
107
108
109
110
111
112
87
88
89
90
91
92
93



94
95
96
97

98
99
100
101

102
103
104
105
106
107
108
109







-
-
-
+



-
+



-
+







                sema::Context c( pEnv.lock(), RootIdentity(), ftype.returnType() );

                auto identity = AppendToVectorTerm( InjectDomainIntoIdentity( RootIdentity(), DomainRunTime() ),
                    TERM( StringId( pEnv.lock()->GetUniqueId() ) ) );
                auto func = BuildFunc( c, ftype, identity, params, make_shared< Vector >(), c );
                const auto& pFuncLLR = func.llr();

                auto pFN = make_shared< string >( filename );

                ifstream sourcefile( pFN->c_str() );
                ifstream sourcefile( filename.c_str() );
                if( !sourcefile.good() )
                {
                    pFuncLLR->setInvalid();
                    cout << "can't open '" << *pFN << "'\n";
                    cout << "can't open '" << filename << "'\n";
                    return ToValue( func );
                }

                auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, pFN ), c );
                auto r = make_shared< parse::Resolver >( make_shared< lex::Lexer >( sourcefile, filename ), c );
                parse::Parser p( r );

                auto cfg = make_shared< llr::CFG >();
                p.setCFG( cfg );
                p.setCurrentBB( cfg->entryBB() );

                p.parseSequence();