Skip to content

in 'as' expansion in JavaMaker the type node is getting shared between the three expressions #13

Open
@twiglet

Description

@twiglet

With Source code:

using System.Collections;

namespace RusticiSoftware.ScormContentPlayer.Logic
{
    /// <summary>
    /// Contains default methods for integration methods which are not specific to a client integration. Most implementations can inherit from this class and only
    /// override the LMS specific methods rather than overriding all the utility methods (such as configuration, logging, etc).
    /// </summary>
    public abstract class Fred
    {
           public int[] fred()
           {
              ArrayList result = new ArrayList();
              return result.ToArray(typeof(int)) as int[];
           }
        }
}

Giving internal trees:

Java Syntax Parse Tree for Fred

package{ RusticiSoftware.ScormContentPlayer.Logic class{ public abstract Fred { METHOD{ public TYPE{ int [ ] } fred { TYPE{ ArrayList } result = new{ TYPE{ ArrayList } } ; return{ ?:{ instanceof{ APPLY{ .{ result ToArray } ARGS{ typeof{ TYPE{ int } } } } TYPE{ int [ ] } } (cast){ TYPE{ int [ ] } APPLY{ .{ result ToArray } ARGS{ typeof{ TYPE{ int } } } } } (cast){ TYPE{ int [ ] } null } } } } Exception } } } } } }

Final Java Parse Tree for Fred

package{ RusticiSoftware.ScormContentPlayer.Logic import CS2JNet.System.Collections.ArrayListSupport import java.util.ArrayList class{ public abstract Fred { METHOD{ public TYPE{ int [ ] } fred { TYPE{ JAVAWRAPPER{ ArrayList } } result = JAVAWRAPPER{ new ArrayList() } ; return{ ?:{ instanceof{ JAVAWRAPPER{ ArrayListSupport.toArray(${this}, new ${TYPEOF_expr_TYPE}[0]) this EXPRESSION{ result } TYPEOF_expr ARGUMENT{ typeof{ TYPE{ int } } } TYPEOF_expr_TYPE EXPRESSION{ int } } TYPE{ Integer [ ] } } (cast){ TYPE{ Integer [ ] } JAVAWRAPPER{ ArrayListSupport.toArray(${this}, new ${TYPEOF_expr_TYPE}[0]) this EXPRESSION{ result } TYPEOF_expr ARGUMENT{ typeof{ TYPE{ int } } } TYPEOF_expr_TYPE EXPRESSION{ int } } } (cast){ TYPE{ Integer [ ] } null } } } } Exception } } } }

The 'int' node is being changed to 'Integer' throughout, yet these type trees are dupTree'd

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions