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

Parameter name repeated in function declaration in compiled output #24

Open
bandersongit opened this issue Nov 1, 2019 · 0 comments
Open

Comments

@bandersongit
Copy link

Compiling the following function from this file

  let purple = (~underline=false, ~invert=false, ~dim=false, ~bold=false, s) =>
    <Pastel underline inverse=invert dim bold color=Magenta> s </Pastel>;

Results in generated output with duplicate paramater names (parameter s is both the second and the last parameter)

JS

function purple(opt, s, r, q, s) {
  if (opt) {
    var sth = opt[1];
    var underline = sth;
  }
  else var underline = 0;
  if (s) {
    var sth__0 = s[1];
    var invert = sth__0;
  }
  else var invert = 0;
  if (r) {
    var sth__1 = r[1];
    var dim = sth__1;
  }
  else var dim = 0;
  if (q) {
    var sth__2 = q[1];
    var bold = sth__2;
  }
  else var bold = 0;
  return call12(
    Pastel[36],
    0,
    [0,bold],
    [0,dim],
    0,
    [0,underline],
    [0,invert],
    0,
    0,
    f,
    0,
    [0,s,0],
    0
  );
}

Hack

$purple = function(
      dynamic $opt,
      dynamic $s,
      dynamic $r,
      dynamic $q,
      dynamic $s,
    ) use ($Pastel, $call12, $f) {
      if ($opt) {
        $sth = $opt[1];
        $underline = $sth;
      } else {
        $underline = 0;
      }
      if ($s) {
        $sth__0 = $s[1];
        $invert = $sth__0;
      } else {
        $invert = 0;
      }
      if ($r) {
        $sth__1 = $r[1];
        $dim = $sth__1;
      } else {
        $dim = 0;
      }
      if ($q) {
        $sth__2 = $q[1];
        $bold = $sth__2;
      } else {
        $bold = 0;
      }
      return $call12(
        $Pastel[36],
        0,
        Vector {0, $bold},
        Vector {0, $dim},
        0,
        Vector {0, $underline},
        Vector {0, $invert},
        0,
        0,
        $f,
        0,
        Vector {0, $s, 0},
        0,
      );
    };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant