Lucas Ste
Lucas Ste
My IDE points 320 places with repeated code. I am selecting the glaring ones and opening issues. Here are 12 of them (more to come in other issues). 1. https://github.com/hyperledger/solang/blob/77d78369fafc2948f7ce26abcfff86edc18de144/src/sema/expression/assign.rs#L126-L137...
- [x] https://github.com/hyperledger/solang/pull/1254 - [x] It should be possible to pass AccountMetas to constructors. This entails refactoring `Instr::Constructor` for Solana and maybe unify it with `Instr::ExternalCall`. #1271 - [x] `@payer`...
When compiling this contract, the polkadot ABI generation overflows its stack. ```solidity contract hatchling { struct A { A [][2][1] b; } A private n1; constructor() {} function foo(uint a,...
This contract: ```solidity contract Foo { struct My { bytes bb; } function bar() public pure returns (uint32) { My s; s.bb.push(2); return s.bb.length; } } ``` causes this error:...
After that PR #1474 is merged, constructors are left in an awkward situation. If a contract has no storage variables, no function will require a data account, but the constructor...
1. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/emit/math.rs#L90-L107 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/emit/math.rs#L318-L335 =============================================== 2. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/member_access.rs#L419-L427 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/member_access.rs#L431-L439 =============================================== 3. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L421-L437 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L455-L471 =============================================== 4. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L484-L500 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L620-L636 =============================================== 5. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L513-L543 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L618-L648 =============================================== 6. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L583-L611 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L654-L682 =============================================== 7. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L908-L934 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L940-L966 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L971-L997 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/mod.rs#L1050-L1076 ===============================================...
1. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/target.rs#L364-L371 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/target.rs#L452-L459 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/target.rs#L528-L535 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/target.rs#L638-L645 ======================================== 2. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/types.rs#L588-L594 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/types.rs#L682-L689 ======================================== 3. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/codegen/vector_to_slice.rs#L60-L65 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/codegen/vector_to_slice.rs#L79-L83 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/codegen/vector_to_slice.rs#L91-L95
1. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L493-L499 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L507-L516 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L550-L556 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L564-L573 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L607-L613 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L621-L630 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L664-L670 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/codegen/strength_reduce/expression_values.rs#L678-L687 ========================================== 2. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/solang-parser/src/helpers/fmt.rs#L201-L206 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/solang-parser/src/helpers/fmt.rs#L277-L282 =========================================== 3. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/format.rs#L255-L263 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/format.rs#L269-L277 =========================================== 4. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/function_call.rs#L75-L85 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/function_call.rs#L134-L144 =========================================== 5. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/function_call.rs#L420-L440 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/expression/function_call.rs#L1759-L1779 ============================================== 6. https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/functions.rs#L137-L146 https://github.com/hyperledger/solang/blob/c5e430461b9f9934d08afa2fc3b81962637c6c5d/src/sema/functions.rs#L695-L704 ==============================================...
2. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/statements.rs#L1043-L1063 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/sema/expression/function_call.rs#L1715-L1735 ====================================== 3. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/storage.rs#L152-L158 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/solana/target.rs#L776-L783 ======================================= 4. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/storage.rs#L582-L590 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/storage.rs#L760-L769 ======================================= 5. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/storage.rs#L693-L703 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/substrate/storage.rs#L739-L749 ======================================== 6. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/codegen/storage.rs#L114-L135 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/codegen/storage.rs#L288-L309 ======================================== 7. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L236-L246 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L260-L270 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L282-L292 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L312-L322 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L336-L346 https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/emit/strings.rs#L403-L413 ======================================== 8. https://github.com/hyperledger/solang/blob/1b46d73b32449a09ba1c1e54c8073ecb4d7cf4a0/src/abi/substrate.rs#L287-L300...
Expressions in the CFG are moved around freely by our optimizations passes. The Borsh decoding implementation leverages such a property to make decoding more efficient but avoiding creating a new...