Skip to content

Multiple let declaration with es6 #786

Closed
@fathyb

Description

@fathyb

protobuf.js version: 6.7.3

The verify method of messages with multiple messages field gets multiple es6 block-scoped let error declarations.

This causes Uncaught SyntaxError: Identifier 'error' has already been declared on v8.

/**
 * Verifies a Shadow message.
 * @param {Object.<string,*>} message Plain object to verify
 * @returns {?string} `null` if valid, otherwise the reason why it is not
 */
Shadow.verify = function verify(message) {
    if (typeof message !== "object" || message === null)
        return "object expected";
    let error = $root.Color.verify(message.color);
    if (error)
        return "color." + error;
    if (typeof message.blur !== "number")
        return "blur: number expected";
    let error = $root.Point.verify(message.offset);
    if (error)
        return "offset." + error;
    return null;
};
message Shadow {
    required Color color = 1;
    required double blur = 2;
    required Point offset = 3;
}

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