Opened 10 years ago

Closed 3 years ago

#641 closed defect (fixed)

InstAccess can be expression in two ways

Reported by: Jesper Mattsson Owned by: Jesper Mattsson
Priority: major Milestone: Pending
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description (last modified by Jesper Mattsson)

There are two ways to encode an expression that is an access in the instance tree:

  • FInstAccessExp -> InstAccess
  • FIdUseExp -> FIdUseInstAccess -> InstAccess

This generates code duplication, since both paths must support any operation that spans from expression to access.

Also, FIdUseInstAccess has both an FQName and an InstAccess as children.

Either FInstAccessExp or FIdUseInstAccess needs to be removed and if FIdUseInstAccess is kept it should not have an FQName as child.

Change History (9)

comment:1 Changed 10 years ago by Jesper Mattsson

The reason FIdUseInstAccess éxists is probably that some node types that are used in both the instance tree and the flat tree and have an FIdUse as children (e.g. FConnectClause). Thus, an FIdUse needs to be able to be an InstAccess.

I suggest removing FIdUseInstAccess and adding an abstract superclass for FIdUse and FInstAccessExp.

It is clear that a common superclass is needed somewhere, and FInstAccessExp and FIdUse are probably the two classes involved with the most in common.

comment:2 Changed 10 years ago by Jesper Mattsson

The above comment seems a bit confused.

The proposed structure is:

abstract CommonIdUse;
FIdUse : CommonIdUse ::= Name:FQName
InstIdUse : CommonIdUse ::= Name:InstAccess   // Replaces FIdUseInstAccess

If an interface is added that both FQName & InstAccess implements and adding an abstract method getName() to CommonIdUse, then even more code could be moved to CommonIdUse.

comment:3 Changed 10 years ago by Jesper Mattsson

Description: modified (diff)

comment:4 Changed 9 years ago by Jesper Mattsson

Milestone: 1.4.x

The proposed interface for FQName & InstAccess would contain methods that they both already have and that both FIdUse & FIdeUseInstAccess delegate to.

comment:5 Changed 9 years ago by jakesson

Owner: set to Jesper Mattsson
Status: newassigned

comment:6 Changed 9 years ago by Jesper Mattsson

Milestone: 1.4.x1.5.x

comment:7 Changed 9 years ago by Jesper Mattsson

Milestone: 1.5.xFuture

comment:8 Changed 6 years ago by Tove Bergdahl

Milestone: FuturePending
Priority: minormajor

comment:9 Changed 3 years ago by Jesper Mattsson

Resolution: fixed
Status: assignedclosed

This was fixed in r7825, as a part of #3669.

Note: See TracTickets for help on using tickets.