Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error generating whistler proto when using a globally defined local variable within a named function #4

Open
jakeval opened this issue Aug 25, 2020 · 0 comments
Labels

Comments

@jakeval
Copy link

jakeval commented Aug 25, 2020

When using a globally-defined local variable from within a named projector, the FieldMapping containing the projector does not list the local variable as an argument. However, when doing the same from an anonymous block, the local variable is listed as an argument.

Example with named projector:
whistle:

var a: "a"

x1: {
   y1: a
}

x2: foo()

def foo() {
    y2: a
}

protobuf:

{
   "root_mapping":{
       "value_source":{
         "const_string":"a"
      },
      "target_local_var":"a"
   },
   "root_mapping":{
      "value_source":{
         "projector":"foo"               <==== the local variable isn't listed as an argument
      },
      "target_field":"x2"
   },
   "projector":{
      "name":"foo",
      "mapping":{
         "value_source":{
            "from_input":{
               "arg":1
            }
         },
         "target_field":"y2"
      }
   },
}

Example with anonymous block:
whistle:

var a: "a"

x1: {
   y1: a
}

protobuf:

{
   "root_mapping":{
      "value_source":{
         "const_string":"a"
      },
      "target_local_var":"a"
   },
   "root_mapping":{
      "value_source":{
         "from_local_var":"a",                <=== the local variable is listed as an argument
         "projector":"$anonblock_3_3"
      },
      "target_field":"x1"
   },
   "projector":{
      "name":"$anonblock_3_3",
      "mapping":{
         "value_source":{
            "from_input":{
               "arg":1
            }
         },
         "target_field":"y1"
      }
   }
}
jakeval pushed a commit that referenced this issue Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants