system/src/sc/lang/java/NewExpression.java
public void transformBindingArgs(SemanticNodeList<Expression> bindArgs, BindDescriptor bd) {
      LayeredSystem sys = getLayeredSystem();
      if (ModelUtil.needsDynType(boundType) && constructor != null) {
         TypeDeclaration td = (TypeDeclaration) boundType;
         TypeDeclaration outerType = td.getRootType();
         if (outerType == null)
            outerType = td;

         IdentifierExpression getMethod = create(outerType.getFullTypeName() + ".resolveMethod" + td.getDynamicStubParameters().getRuntimeInnerName());
         SemanticNodeList<Expression> getMethodArgs = new SemanticNodeList<Expression>();
         getMethodArgs.add(StringLiteral.create(td.getTypeName()));
         getMethodArgs.add(StringLiteral.create(ModelUtil.getTypeSignature(constructor)));
         /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */
         getMethod.setProperty("arguments",getMethodArgs);
         bindArgs.add(getMethod);
      }
      else if (sys.needsExtDynType(boundType) && constructor != null) {
         String fullTypeName = ModelUtil.getTypeName(boundType);
         IdentifierExpression getMethod = IdentifierExpression.create(sys.buildInfo.getExternalDynTypeName(fullTypeName) + ".resolveMethod");
         SemanticNodeList<Expression> getMethodArgs = new SemanticNodeList<Expression>();
         getMethodArgs.add(StringLiteral.create(CTypeUtil.getClassName(fullTypeName)));
         getMethodArgs.add(StringLiteral.create(ModelUtil.getTypeSignature(constructor)));
         /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */
         getMethod.setProperty("arguments",getMethodArgs);
         bindArgs.add(getMethod);
      }
      else
         bindArgs.add(ClassValueExpression.create(typeIdentifier));
      if (arrayDimensions == null) {
         bindArgs.add(constructor == null ? NullLiteral.create() : StringLiteral.create(ModelUtil.getTypeSignature(constructor)));

         Object enclosingInstType = ModelUtil.getEnclosingInstType(boundType);
         // For instance "new" operators for inner classes
         if (!bd.isStatic && enclosingInstType != null) {
            SemanticNodeList<Expression> argsWithThis = new SemanticNodeList<Expression>(this, arguments.size() + 1);
            IdentifierExpression ic = IdentifierExpression.create("sc.bind.Bind.constantP");
            SemanticNodeList<Expression> thisArg = new SemanticNodeList<Expression>(1);
            Object enclType = getEnclosingType();
            if (ModelUtil.sameTypes(enclType, enclosingInstType))
               thisArg.add(IdentifierExpression.create("this"));
            else
               thisArg.add(IdentifierExpression.create(ModelUtil.getClassName(enclosingInstType) + ".this"));
            ic.setProperty("arguments", thisArg);
            argsWithThis.add(ic);
            argsWithThis.addAll(arguments);
            bindArgs.add(createBindingArray(argsWithThis, false));
         }
         else
            bindArgs.add(createBindingArray(arguments, false));
      }
      else {
         bindArgs.add(createBindingArray(arrayInitializer.initializers, false));
      }
   }
// TODO: need to handle the identifiers that might prefix this expression and array initializers
need to handle the identifiers that might prefix this expression and array initializers
need to handle the identifiers that might prefix this expression and array initializers
public void transformBindingArgs(SemanticNodeList<Expression> bindArgs, BindDescriptor bd) {
      LayeredSystem sys = getLayeredSystem();
      if (ModelUtil.needsDynType(boundType) && constructor != null) {
         TypeDeclaration td = (TypeDeclaration) boundType;
         TypeDeclaration outerType = td.getRootType();
         if (outerType == null)
            outerType = td;
         IdentifierExpression getMethod = create(outerType.getFullTypeName() + ".resolveMethod" + td.getDynamicStubParameters().getRuntimeInnerName());
         SemanticNodeList<Expression> getMethodArgs = new SemanticNodeList<Expression>();
         getMethodArgs.add(StringLiteral.create(td.getTypeName()));
         getMethodArgs.add(StringLiteral.create(ModelUtil.getTypeSignature(constructor)));
         /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */
         getMethod.setProperty("arguments",getMethodArgs);
         bindArgs.add(getMethod);
      }
      else if (sys.needsExtDynType(boundType) && constructor != null) {
         String fullTypeName = ModelUtil.getTypeName(boundType);
         IdentifierExpression getMethod = IdentifierExpression.create(sys.buildInfo.getExternalDynTypeName(fullTypeName) + ".resolveMethod");
         SemanticNodeList<Expression> getMethodArgs = new SemanticNodeList<Expression>();
         getMethodArgs.add(StringLiteral.create(CTypeUtil.getClassName(fullTypeName)));
         getMethodArgs.add(StringLiteral.create(ModelUtil.getTypeSignature(constructor)));
         /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */
         getMethod.setProperty("arguments",getMethodArgs);
         bindArgs.add(getMethod);
      }
      else
         bindArgs.add(ClassValueExpression.create(typeIdentifier));
      if (arrayDimensions == null) {
         bindArgs.add(constructor == null ? NullLiteral.create() : StringLiteral.create(ModelUtil.getTypeSignature(constructor)));
         Object enclosingInstType = ModelUtil.getEnclosingInstType(boundType);
         if (!bd.isStatic && enclosingInstType != null) {
            SemanticNodeList<Expression> argsWithThis = new SemanticNodeList<Expression>(this, arguments.size() + 1);
            IdentifierExpression ic = IdentifierExpression.create("sc.bind.Bind.constantP");
            SemanticNodeList<Expression> thisArg = new SemanticNodeList<Expression>(1);
            Object enclType = getEnclosingType();
            if (ModelUtil.sameTypes(enclType, enclosingInstType))
               thisArg.add(IdentifierExpression.create("this"));
            else
               thisArg.add(IdentifierExpression.create(ModelUtil.getClassName(enclosingInstType) + ".this"));
            ic.setProperty("arguments", thisArg);
            argsWithThis.add(ic);
            argsWithThis.addAll(arguments);
            bindArgs.add(createBindingArray(argsWithThis, false));
         }
         else
            bindArgs.add(createBindingArray(arguments, false));
      }
      else {
         bindArgs.add(createBindingArray(arrayInitializer.initializers, false));
      }
   }
public void transformBindingArgs ( SemanticNodeList < Expression > bindArgs , BindDescriptor bd ) { LayeredSystem sys = getLayeredSystem ( ) ; if ( ModelUtil . needsDynType ( boundType ) && constructor != null ) { TypeDeclaration td = ( TypeDeclaration ) boundType ; TypeDeclaration outerType = td . getRootType ( ) ; if ( outerType == null ) outerType = td ; IdentifierExpression getMethod = create ( outerType . getFullTypeName ( ) + ".resolveMethod" + td . getDynamicStubParameters ( ) . getRuntimeInnerName ( ) ) ; SemanticNodeList < Expression > getMethodArgs = new SemanticNodeList < Expression > ( ) ; getMethodArgs . add ( StringLiteral . create ( td . getTypeName ( ) ) ) ; getMethodArgs . add ( StringLiteral . create ( ModelUtil . getTypeSignature ( constructor ) ) ) ; /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */ getMethod . setProperty ( "arguments" , getMethodArgs ) ; bindArgs . add ( getMethod ) ; } else if ( sys . needsExtDynType ( boundType ) && constructor != null ) { String fullTypeName = ModelUtil . getTypeName ( boundType ) ; IdentifierExpression getMethod = IdentifierExpression . create ( sys . buildInfo . getExternalDynTypeName ( fullTypeName ) + ".resolveMethod" ) ; SemanticNodeList < Expression > getMethodArgs = new SemanticNodeList < Expression > ( ) ; getMethodArgs . add ( StringLiteral . create ( CTypeUtil . getClassName ( fullTypeName ) ) ) ; getMethodArgs . add ( StringLiteral . create ( ModelUtil . getTypeSignature ( constructor ) ) ) ; /*
         for (int i = 0; i < arguments.size(); i++) {
            Object argType = arguments.get(i).getTypeDeclaration();
            if (argType == null) {
               System.err.println("*** No defined type for argument: " + arguments.get(i).toDefinitionString() + " in expression: " + toDefinitionString());
               getMethodArgs.add(NullLiteral.create());
            }
            else
               getMethodArgs.add(ClassValueExpression.create(ModelUtil.getTypeName(argType)));
         }
         */ getMethod . setProperty ( "arguments" , getMethodArgs ) ; bindArgs . add ( getMethod ) ; } else bindArgs . add ( ClassValueExpression . create ( typeIdentifier ) ) ; if ( arrayDimensions == null ) { bindArgs . add ( constructor == null ? NullLiteral . create ( ) : StringLiteral . create ( ModelUtil . getTypeSignature ( constructor ) ) ) ; Object enclosingInstType = ModelUtil . getEnclosingInstType ( boundType ) ; if ( ! bd . isStatic && enclosingInstType != null ) { SemanticNodeList < Expression > argsWithThis = new SemanticNodeList < Expression > ( this , arguments . size ( ) + 1 ) ; IdentifierExpression ic = IdentifierExpression . create ( "sc.bind.Bind.constantP" ) ; SemanticNodeList < Expression > thisArg = new SemanticNodeList < Expression > ( 1 ) ; Object enclType = getEnclosingType ( ) ; if ( ModelUtil . sameTypes ( enclType , enclosingInstType ) ) thisArg . add ( IdentifierExpression . create ( "this" ) ) ; else thisArg . add ( IdentifierExpression . create ( ModelUtil . getClassName ( enclosingInstType ) + ".this" ) ) ; ic . setProperty ( "arguments" , thisArg ) ; argsWithThis . add ( ic ) ; argsWithThis . addAll ( arguments ) ; bindArgs . add ( createBindingArray ( argsWithThis , false ) ) ; } else bindArgs . add ( createBindingArray ( arguments , false ) ) ; } else { bindArgs . add ( createBindingArray ( arrayInitializer . initializers , false ) ) ; } }
TODO: need to handle the identifiers that might prefix this expression and array initializers
TODO : need to handle the identifiers that might prefix this expression and array initializers
// For instance "new" operators for inner classes