Project

General

Profile

Feature #2048

BUFFER parameters without name in forward function definitions

Added by Constantin Asofiei about 11 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Costin Savin
Start date:
02/25/2013
Due date:
% Done:

100%

billable:
No
vendor_id:
GCD

cs_upd20130226a.zip (41.2 KB) Costin Savin, 02/26/2013 04:44 AM

History

#1 Updated by Constantin Asofiei about 11 years ago

  • Target version set to Milestone 4

Conversion fails in this case:

function func0 returns char (buffer for book) forward.

as forward function definitions allow the parameters to be defined without explicitly setting the name.

#2 Updated by Costin Savin about 11 years ago

The conversion fails because of code in record_scoping_prep.rules which assumes the buffer annotation is in the copy.parent.prevSibling which in the case of
function func0 returns char (buffer for book) forward. is not true and the prevSibling node does not exist
A null check for copy.parent.prevSibling and getting the annotation from the current node in the case this is null solved the problem.
However the code is still not converted correctly or persistent:

Example:

forward.p

FUNCTION doubler RETURNS INTEGER (buffer for book) FORWARD.
FUNCTION doubler RETURNS INTEGER (buffer bb for book). end.

FUNCTION doubler2 RETURNS INTEGER (buffer cc for book) FORWARD.
FUNCTION doubler2 RETURNS INTEGER (buffer cc for book). end.

the first function doubler converts wrong to

   public integer doubler(final Book.Buf bb)
   {
      return function(integer.class, new Block()
      {
         public void init()
         {
            Winhand.this.bb = bb;
         }

         public void body()
         {
            RecordBuffer.openScope(bb, book);
         }
      });
   }

This happens because book is put as a javaname annotation together with bb which are then are used as parameter for emiting RecordBuffer.openScope statement

in the second case it converts correctly to:

   public integer doubler2(final Book.Buf ccBuf2)
   {
      return function(integer.class, new Block()
      {
         public void init()
         {
            Winhand.this.ccBuf2 = ccBuf2;
         }
         public void body()
         {
            RecordBuffer.openScope(ccBuf2, ccBuf2);
         }
      });
   }

but in this case the javaname annotations are emitted correctly to ccBuf2.
I'll think on how can this be fixed.

#3 Updated by Greg Shah about 11 years ago

Actually, both results look wrong. doubler2() gets an openScope() with the same buffer name passed twice. That may be OK, but is definitely not what we want. The core remaining issue is that there should not ever be 2 buffers emitted in an openScope() for a single buffer parameter.

#4 Updated by Greg Shah about 11 years ago

Keep in mind that the FORWARD declaration should not be changing buffer scoping at all. My guess is that somewhere we are not bypassing the addition of a new buffer when it is a FORWARD function.

#5 Updated by Costin Savin about 11 years ago

Added proposed update

#6 Updated by Constantin Asofiei about 11 years ago

The update looks OK, is going through conversion regression testing now.

#7 Updated by Constantin Asofiei about 11 years ago

Update has passed conversion regression testing, please check in and distribute.

#8 Updated by Costin Savin about 11 years ago

Commited to bazaar as revision number 10209.

#9 Updated by Greg Shah about 11 years ago

  • Status changed from New to Closed

#10 Updated by Eric Faulhaber about 11 years ago

  • % Done changed from 0 to 100

#11 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 4 to Conversion Support for Server Features

Also available in: Atom PDF