Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
twiglet opened this issue Apr 19, 2011 · 0 comments
Labels

Comments

@twiglet
Copy link
Owner

twiglet commented Apr 19, 2011

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant