Skip to content

Rebinding

slepher edited this page Sep 25, 2019 · 9 revisions

Types

  • Rebinding Scope Groups
    • Case/If/Try-Catch/Receive
    • Function Call Arguments
  • Rebinding Scopes
    • Function Clause - shadowed:true
    • Named Function - shadowed:true
    • List/BitString Comprehension - shadowed:true
    • List/BitString Comprehension Generate Pattern - shadowed:true
    • Case/If/Try-Catch/Receive Clause - shadowed:false
    • Function Call Argument - shadowed:false
  • Rebinding Pattern Variable Group
    • Function Patterns
    • Case/If/Try-Catch/Receive Clause Pattern
    • Match Left Pattern
    • List/BitString Comprehension Generate Pattern
  • Rebinding Pattern Variable
    • Function Pattern Variable - function_clause
    • Case/If/Try-Catch/Receive Clause Pattern Variable - match_clause
    • Match Left Pattern Variable - match_left
    • New Syntax: Left Pattern Variable with Oprator + Before - pinned_match_left
    • List/BitString Comprehension Generate Pattern Variable - comprehension_generate

Rebinding Strategy

  • Rebinding Scope Group
    • Entry
      • push scope variables to scope stack
      • empty scope varialbes
    • Exit
      • merge scope group variables to local variables
  • Rebinding Scope
    • entry
      • push local variables to variables stack
      • push local renames to renames stack
      • emtpy local variables
      • empty local renames
    • exit
      • shadowed:false
        • merge local variables to scope variables
      • shadowed:true
        • no extra changes
      • global variables regenerate from full variables stack
      • local variables from pop variables stack
      • global renames regenerate by full renames stack
      • local renames regenerate from pop renames stack
  • Rebinding Pattern Variable Group
    • entry
      • clear pattern variables
    • exit
      • clear pattern variables
  • Rebinding Pattern Variable
    • function_clause | match_left | comprehension_generate
      • exists in pattern variables
        • rename by global renames
      • not exists in pattern variables
        • exists in global variables
          • generate a new variable name
          • update global renames by new variable name
          • update local renames by new variable name
          • insert new variable name to local variables
          • insert new variable name to global variables
        • not exists in global variables
          • variable local variables
          • insert variable name to local variables
          • insert variable name to global variables
    • pinned_match_left | match_clause
      • rename by global renames
Clone this wiki locally