Goose  Check-in [4fe0527143]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fixed shift operators precedence.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 4fe0527143d75268fd122e53d0b0ac2cbb54b4cab7fd89c3b91d101fe173675b
User & Date: achavasse 2019-08-05 21:14:49.715
Context
2019-08-06
00:33
  • Improved the operator parsing rules construction helpers to support both an unary and an infix operators sharing the same identifier.
  • Updated the comma operator implementation to use the same helpers as other operators, which makes it possible to overload it.
check-in: 035cf4826c user: achavasse tags: trunk
2019-08-05
21:14
Fixed shift operators precedence. check-in: 4fe0527143 user: achavasse tags: trunk
21:04
Implemented the shift operators. check-in: 2fdf1d1929 user: achavasse tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to bs/builtins/operators/logic.cpp.
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
                pEndBB->setTerminator( Ret( move( resultVal ) ) );

                // Pachage our cfg in a value with an inline CFG instruction.
                return BuildComputedValue( GetValueType< bool >(), move( cfg ) );
            } )
        );

        CreateLeftAssInfixOp( e, "<<"_sid, "operator_shift_left"_sid, precedence::OrOp,
            // ct_int left shift
            ForType< BigInt, Shl >(),

            // runtime integer left shift, defined to work for any two integers of same
            // bit size and signedness.
            ForType< CustomPattern< RTInteger, RTInteger::Pattern > >(
            []( auto&& lhs, auto&& rhs ) -> Value
            {
                return BuildComputedValue( lhs.type(),
                    Shl( lhs, rhs ) );
            } )
        );

        CreateLeftAssInfixOp( e, ">>"_sid, "operator_shift_right"_sid, precedence::OrOp,
            // ct_int right shift
            ForType< BigInt, AShr >(),

            // runtime signed integer right shift, defined to work for any two integers of same
            // bit size.
            ForType< CustomPattern< RTInteger, RTInteger::PatternSigned > >(
            []( auto&& lhs, auto&& rhs ) -> Value







|













|







165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
                pEndBB->setTerminator( Ret( move( resultVal ) ) );

                // Pachage our cfg in a value with an inline CFG instruction.
                return BuildComputedValue( GetValueType< bool >(), move( cfg ) );
            } )
        );

        CreateLeftAssInfixOp( e, "<<"_sid, "operator_shift_left"_sid, precedence::BitShiftOp ,
            // ct_int left shift
            ForType< BigInt, Shl >(),

            // runtime integer left shift, defined to work for any two integers of same
            // bit size and signedness.
            ForType< CustomPattern< RTInteger, RTInteger::Pattern > >(
            []( auto&& lhs, auto&& rhs ) -> Value
            {
                return BuildComputedValue( lhs.type(),
                    Shl( lhs, rhs ) );
            } )
        );

        CreateLeftAssInfixOp( e, ">>"_sid, "operator_shift_right"_sid, precedence::BitShiftOp ,
            // ct_int right shift
            ForType< BigInt, AShr >(),

            // runtime signed integer right shift, defined to work for any two integers of same
            // bit size.
            ForType< CustomPattern< RTInteger, RTInteger::PatternSigned > >(
            []( auto&& lhs, auto&& rhs ) -> Value