Skip to content

Put multiple assignments on the same line #1536

@nex3

Description

@nex3

Rather than

void main() {
  DeprecationProcessingLogger deprecationLogger =
      logger = DeprecationProcessingLogger(
        logger ?? Logger.stderr(),
        silenceDeprecations: {...?silenceDeprecations},
        fatalDeprecations: {...?fatalDeprecations},
        futureDeprecations: {...?futureDeprecations},
        limitRepetition: !verbose,
      );
}

I'd prefer

void main() {
  DeprecationProcessingLogger deprecationLogger = logger =
      DeprecationProcessingLogger(
        logger ?? Logger.stderr(),
        silenceDeprecations: {...?silenceDeprecations},
        fatalDeprecations: {...?fatalDeprecations},
        futureDeprecations: {...?futureDeprecations},
        limitRepetition: !verbose,
      );
}

While the AST thinks of the second assignment as an expression, as a user I think of it as an addendum to the LHS, and so I expect it to bind more tightly there than to the value of the assignment.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions