Opened 10 years ago

Closed 10 years ago

#2854 closed defect (fixed)

Generate unique names for functions called via components

Reported by: Adrian Pop Owned by: Adrian Pop
Priority: high Milestone: 1.9.1
Component: Frontend Version: trunk
Keywords: Cc:

Description

model N
  constant Real c;
  function x
    input Real r;
    output Real o := r;
  end x;
  function f
    input Real r;
    output Real o := x(sum(c*i for i in r:r+1));
  end f;
end N;

model M
  N n1(c=1),n2(c=2);
  Real r1 = n1.f(time), r2 = n2.f(time);
end M;

currently flattens to:

function N.f
  input Real r;
  output Real o = N.x(sum(i for i in r:1.0 + r));
end N.f;

function N.x
  input Real r;
  output Real o = r;
end N.x;

class M
  constant Real n1.c = 1.0;
  constant Real n2.c = 2.0;
  Real r1 = N.f(time);
  Real r2 = N.f(time);
end M;

Change History (4)

comment:1 by Adrian Pop, 10 years ago

Owner: changed from somebody to Adrian Pop
Status: newaccepted

comment:2 by Adrian Pop, 10 years ago

There seems to be a bug here somewhere as the functions generated should be:

N$n1.f
N$n2.f

as the environment of n1 is N$n1 and for n2 is N$n2.
I'll look into it.

comment:3 by Adrian Pop, 10 years ago

Fixed in r22515.

comment:4 by Adrian Pop, 10 years ago

Resolution: fixed
Status: acceptedclosed
Note: See TracTickets for help on using tickets.