swift
816ae45a - [IDE] Don't assume the corresponding token nodes haven't been consumed when handling special attributes

Commit
5 years ago
[IDE] Don't assume the corresponding token nodes haven't been consumed when handling special attributes There are still parts of the AST that aren't walked in order. Because we consume all tokens up to the end location whenever we pop a StructureNode in the ModelASTWalker, if anything before that end location is visited after popping that structure node, the corresponding tokens will have been consumed already. This happens at the moment when specifying a an enum case with a defaulted function-type associated value (where the default value is a closure). The closure body is walked after the the structure node corresponding to the enum case is popped. This is a purely defensive fix that prevents crashing in such cases. Resolves rdar://problem/53343735
Author
Nathan Hawes
Committer
Nathan Hawes
Parents
  • lib/IDE
    • File
      SyntaxModel.cpp
  • test/IDE
    • File
      coloring_invalid.swift