Skip to content

Parameter Evaluation Order Not Documented #16116

@Subway2023

Description

@Subway2023

In the legacy codegen, the log arguments are evaluated from right to left, whereas in the IR-based codegen, they are evaluated from left to right. However, this difference is not reflected in the documentation.

contract EventEvalOrder {
    uint public a;

    event Log(uint indexed first, uint indexed second, uint indexed third);

    function call1() public returns (uint) {
        a = 1;
        return 10;
    }

    function call2() public returns (uint) {
        a = 2;
        return 20;
    }

    function call3() public returns (uint) {
        a = 3;
        return 30;
    }

    function triggerEvent() public returns (uint) {
        emit Log(call1(), call2(), call3());
        return a;
    }
}

legacy codegen: a=1
ir-based codegen: a=3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions