Skip to content

Not capturing the declaration of a variable within a switch condition #36

Description

@EnderHubris

C++:

int main() {
  int a = 2;
  switch(int b = 4; a+b) {
    ...
  }
}

The srcML XML of the condition looks like:

<condition>(<decl><type><name>int</name></type> <name>b</name> <init>= <expr><name>a</name> <operator>+</operator> <literal type="number">4</literal></expr></init></decl>; a+b)</condition>

srcSlice when it gives this XML to Dispatcher, srcSlice does not receive data about the decl within the condition of the switch causing srcSlice not to generate a slice for b.

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