Skip to content

checkDuplicates return value #1

@fosler

Description

@fosler

Currently, the Env classes defined in files envVal and envRef have a void checkDuplicates method that can be used to throw an exception if a list of VAR tokens has any duplicates. This is used by the parser in LetDecls, Formals, Fields, Methods, and Statics constructor :init hooks to catch duplicate identifiers.

I propose to modify this method to return the Set<String> instance constructed in the method body instead of returning nothing (void). This will not break existing code (where the return value is simply ignored), but it can be useful in the OBJ language to check if the sets of Static, Field, and Method identifiers contain any of the 'reserved' identifiers self, super, etc. In the current OBJ version, these identifier sets are checked only for duplicates.

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