Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8042061 Clean-up LambdaToMethod
  3. JDK-8042063

Collapse boiler-plate LambdaContext iteration code

    XMLWordPrintable

    Details

    • Type: Sub-task
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd_minor
    • Component/s: tools
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      The boiler-plate code, repeated at least 7 times --

      - TranslationContext<?> localContext = context();
      - while (localContext != null) {
      - if (localContext.tree.hasTag(LAMBDA)) {
      - /** do something with **/ (LambdaTranslationContext)localContext
      - }
      - localContext = localContext.prev;
      - }


      + for (LambdaTranslationContext ctx = lambdaContext; ctx != null; ctx = ctx.enclosingLambda()) {
      + /** do something with **/ ctx
      + }

      or possibly take it higher level.

        Attachments

          Activity

            People

            Assignee:
            Unassigned Unassigned
            Reporter:
            rfield Robert Field
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: