Goose  Diff

Differences From Artifact [6256d2f260]:

  • File bs/g0api/compiler.cpp — part of check-in [24415e41e4] at 2021-09-30 23:37:41 on branch trunk — Fixed a couple of bugs, but the linux version is broken for now (due to language bugs that can't be worked around and need to be fixed) (user: zlodo size: 9192)

To Artifact [203b7092a8]:

  • File bs/g0api/compiler.cpp — part of check-in [55994a469a] at 2021-11-03 22:55:10 on branch trunk —
    • References: ref now creates a template type accepting any kind of reference, and mut/const/temp are prefix operators turning that into a ref (or template ref) type of the corresponding kind (this also changes the syntax from ref mut XXX to mut ref XXX which is more natural)
    • Fixed the bizarely broken implicit referencing typechecking rule that performed a superfluous intermediate TypeCheck that crashed on non mutable template reference types
    • Fixed builtin function wrapper that omitted a cast of the return value to the specified type, which allowed builtin functions to silently return values of a different type than advertised, resulting in fun type checking errors
    • Fixed a bunch of fucked up return types that worked by chance (because of the above) in several g0 api functions
    • Implemented non mutable reference passing verification + related tests (it doesn't work yet but too many fixes need to be committed first)
    (user: zlodo size: 9220)

136
137
138
139
140
141
142
143

144
145
146
147
148
149
150
151
152
153
154
155
156
157


158
159

160
161
162
163
164
165
166
136
137
138
139
140
141
142

143
144
145
146
147
148
149
150
151
152
153
154
155


156
157
158

159
160
161
162
163
164
165
166







-
+












-
-
+
+

-
+







                if( !result )
                    return ToValue< uint32_t >( 0 );

                return *result;
            } );

        RegisterBuiltinFunc< uint32_t ( string ) >( e, "ExecuteFile"_sid,
            [pEnv]( const string& filename ) -> Value
            [pEnv]( const string& filename ) -> uint32_t
            {
                auto identity = AppendToVectorTerm( RootG0Identity(),
                    TERM( StringId( Env::NewUniqueId() ) ) );
                auto locVarsIdentity = AppendToVectorTerm( identity, TSID( locvars ) );

                auto env = pEnv.lock();
                env->addVisibilityRule( builtins::RootG0Identity(), identity );
                env->addVisibilityRule( identity, locVarsIdentity );

                auto result = Compiler::LoadAndExecuteFile( env, filename, locVarsIdentity,
                    GetValueType< uint32_t >(), ToValue< uint32_t >( 0 ) );

                if( !result )
                    return ToValue< uint32_t >( 0 );
                if( !result || result->isPoison() )
                    return 0;

                return *result;
                return *FromValue< uint32_t >( *result );
            } );

        RegisterBuiltinFunc< Intrinsic< Value ( string, TypeWrapper< Term >, Value, Value, Value ) > >( e, "#CompileFileToFunction"_sid,
            [pEnv]( auto&& c, const Value& filenameVal, const Value& identityVal, const Value& rt, const Value& defReturnValue, const Value& params ) -> Value
            {
                ProfileZoneScopedN( "#CompileFileToFunction" );