<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    On 10/02/2014 10:44 AM, Bert Freudenberg wrote:<br>
    <blockquote
      cite="mid:3406767B-90CF-4970-A9F2-FCB5286B0865@freudenbergs.de"
      type="cite">
      <pre wrap=""> </pre>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">On 02.10.2014, at 16:05, Alex Franchuk <a class="moz-txt-link-rfc2396E" href="mailto:alex.franchuk@gmail.com">&lt;alex.franchuk@gmail.com&gt;</a> wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">The changes were:
1. Fix a couple incorrect/faulty C type declarations for certain methods and scoped variables within the methods. 
2. Ensure functions which declare a return type will return some value at the end of the block (defaulting to null). 
3. Ensure assignments are properly casted when type data about the expression and variable is available.
4. Ensure functions arguments are properly casted when type data about the function's parameters and the argument expressions is available.
</pre>
      </blockquote>
      <pre wrap="">
That sounds rather useful. I need better type information, too.

E.g., I'd like to know that firstIndexableField() is really an 'unsigned char *' here, not a 'void *' as declared:

unsafeByteOf: bytesOop at: ix
        "Argument bytesOop must not be aSmallInteger!"
        &lt;inline: true&gt;
        | pointer |
        &lt;var: #pointer type: #'unsigned char *'&gt;
        ^(pointer := interpreterProxy firstIndexableField: bytesOop) at: ix - 1

I thought I could use the scopeStack but that appears to not be available when generating code ...

- Bert -

</pre>
    </blockquote>
    Right now the type data is only obtained by using the typeOfVariable
    method of the CCodeGeneration instance, or the arguments property of
    the TMethod instance, and unfortunately these return both the type
    and the name of variable, as if it were a declaration, so my code
    tries to get the type from this (it may not always work).<br>
    <br>
    Ideally typeOfVariable would return only the type, and perhaps a new
    method like declarationOfVariable would return what typeOfVariable
    currently returns. That would be more reliable, and scoped variables
    could perhaps be tracked through the CCodeGeneration instance.<br>
  </body>
</html>