Coverage Report - com.sun.tools.javafx.comp.JavafxToBound
 
Classes in this File Line Coverage Branch Coverage Complexity
JavafxToBound
60%
262/438
37%
105/284
0
JavafxToBound$1
100%
2/2
N/A
0
JavafxToBound$1$1
82%
9/11
50%
2/4
0
JavafxToBound$2
100%
2/2
N/A
0
JavafxToBound$2$1
100%
2/2
N/A
0
JavafxToBound$3
100%
2/2
N/A
0
JavafxToBound$4
0%
0/12
N/A
0
JavafxToBound$5
98%
57/58
95%
19/20
0
JavafxToBound$6
100%
7/7
N/A
0
JavafxToBound$7
100%
2/2
N/A
0
JavafxToBound$8
100%
2/2
N/A
0
JavafxToBound$8$1
100%
2/2
N/A
0
JavafxToBound$9
87%
26/30
71%
17/24
0
JavafxToBound$9$1
100%
6/6
N/A
0
JavafxToBound$9$2
100%
16/16
100%
2/2
0
JavafxToBound$9$3
100%
4/4
N/A
0
JavafxToBound$BindingExpressionClosureTranslator
94%
16/17
N/A
0
JavafxToBound$ClosureTranslator
96%
49/51
80%
16/20
0
JavafxToBound$Function1ClosureTranslator
100%
11/11
N/A
0
 
 1  
 /*
 2  
  * Copyright 2007 Sun Microsystems, Inc.  All Rights Reserved.
 3  
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 4  
  *
 5  
  * This code is free software; you can redistribute it and/or modify it
 6  
  * under the terms of the GNU General Public License version 2 only, as
 7  
  * published by the Free Software Foundation.  Sun designates this
 8  
  * particular file as subject to the "Classpath" exception as provided
 9  
  * by Sun in the LICENSE file that accompanied this code.
 10  
  *
 11  
  * This code is distributed in the hope that it will be useful, but WITHOUT
 12  
  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 13  
  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
 14  
  * version 2 for more details (a copy is included in the LICENSE file that
 15  
  * accompanied this code).
 16  
  *
 17  
  * You should have received a copy of the GNU General Public License version
 18  
  * 2 along with this work; if not, write to the Free Software Foundation,
 19  
  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 20  
  *
 21  
  * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
 22  
  * CA 95054 USA or visit www.sun.com if you need additional information or
 23  
  * have any questions.
 24  
  */
 25  
 package com.sun.tools.javafx.comp;
 26  
 
 27  
 import com.sun.javafx.api.JavafxBindStatus;
 28  
 import com.sun.javafx.api.tree.SequenceSliceTree;
 29  
 import com.sun.tools.javac.code.*;
 30  
 import static com.sun.tools.javac.code.Flags.*;
 31  
 import com.sun.tools.javac.code.Symbol;
 32  
 import com.sun.tools.javac.code.Type.*;
 33  
 import com.sun.tools.javac.tree.JCTree;
 34  
 import com.sun.tools.javac.tree.JCTree.*;
 35  
 import com.sun.tools.javac.util.*;
 36  
 import com.sun.tools.javac.util.JCDiagnostic.DiagnosticPosition;
 37  
 import com.sun.tools.javafx.code.FunctionType;
 38  
 import com.sun.tools.javafx.comp.JavafxToJava.UseSequenceBuilder;
 39  
 import com.sun.tools.javafx.comp.JavafxToJava.Translator;
 40  
 import com.sun.tools.javafx.comp.JavafxToJava.FunctionCallTranslator;
 41  
 import com.sun.tools.javafx.comp.JavafxToJava.InstanciateTranslator;
 42  
 import com.sun.tools.javafx.comp.JavafxToJava.StringExpressionTranslator;
 43  
 import com.sun.tools.javafx.comp.JavafxToJava.TypeCastTranslator;
 44  
 import com.sun.tools.javafx.comp.JavafxToJava.Wrapped;
 45  
 import static com.sun.tools.javafx.code.JavafxVarSymbol.*;
 46  
 import static com.sun.tools.javafx.comp.JavafxDefs.*;
 47  
 import com.sun.tools.javafx.comp.JavafxTypeMorpher.TypeMorphInfo;
 48  
 import com.sun.tools.javafx.comp.JavafxTypeMorpher.VarMorphInfo;
 49  
 import com.sun.tools.javafx.tree.*;
 50  
 import com.sun.tools.javafx.util.MsgSym;
 51  
 
 52  1115
 public class JavafxToBound extends JavafxTranslationSupport implements JavafxVisitor {
 53  12
     protected static final Context.Key<JavafxToBound> jfxToBoundKey =
 54  
         new Context.Key<JavafxToBound>();
 55  
 
 56  
     /*
 57  
      * the result of translating a tree by a visit method
 58  
      */
 59  
     JCExpression result;
 60  
 
 61  
     /*
 62  
      * modules imported by context
 63  
      */
 64  
     private final JavafxToJava toJava;
 65  
 
 66  
     /*
 67  
      * other instance information
 68  
      */
 69  
     private final Symbol doubleObjectTypeSymbol;
 70  
     private final Symbol intObjectTypeSymbol;
 71  
     private final Symbol booleanObjectTypeSymbol;
 72  
     
 73  
     private final Name param1Name;
 74  
     private final Name computeElementsName;
 75  
 
 76  
 
 77  
     private JavafxEnv<JavafxAttrContext> attrEnv;
 78  399
     private TypeMorphInfo tmiTarget = null;
 79  
 
 80  
     /*
 81  
      * static information
 82  
      */
 83  
     private static final String cBoundSequences = sequencePackageNameString + ".BoundSequences";
 84  
     private static final String cBoundOperators = locationPackageNameString + ".BoundOperators";
 85  
     private static final String cLocations = locationPackageNameString + ".Locations";
 86  
     private static final String cFunction0 = functionsPackageNameString + ".Function0";
 87  
     private static final String cFunction1 = functionsPackageNameString + ".Function1";
 88  
 
 89  
     public static JavafxToBound instance(Context context) {
 90  399
         JavafxToBound instance = context.get(jfxToBoundKey);
 91  399
         if (instance == null)
 92  399
             instance = new JavafxToBound(context);
 93  399
         return instance;
 94  
     }
 95  
 
 96  
     protected JavafxToBound(Context context) {
 97  399
         super(context);
 98  
         
 99  399
         context.put(jfxToBoundKey, this);
 100  
 
 101  399
         toJava = JavafxToJava.instance(context);
 102  
 
 103  399
         doubleObjectTypeSymbol = types.boxedClass(syms.doubleType).type.tsym;
 104  399
         intObjectTypeSymbol = types.boxedClass(syms.intType).type.tsym;
 105  399
         booleanObjectTypeSymbol = types.boxedClass(syms.booleanType).type.tsym;
 106  
 
 107  399
         param1Name = names.fromString("x1$");
 108  399
         computeElementsName = names.fromString("computeElements$");
 109  399
     }
 110  
 
 111  
     /** Visitor method: Translate a single node.
 112  
      */
 113  
     @SuppressWarnings("unchecked")
 114  
     <T extends JCExpression> T translate(T tree, TypeMorphInfo tmi) {
 115  1142
         TypeMorphInfo tmiPrevTarget = tmiTarget;
 116  1142
         this.tmiTarget = tmi;
 117  
         T ret;
 118  1142
         if (tree == null) {
 119  20
             ret = null;
 120  
         } else {
 121  1122
             tree.accept(this);
 122  1122
             ret = (T)this.result;
 123  1122
             this.result = null;
 124  
         }
 125  1142
         this.tmiTarget = tmiPrevTarget;
 126  1142
         return ret;
 127  
     }
 128  
 
 129  
     public <T extends JCExpression> T translate(T tree, Type type) {
 130  512
         return translate(tree, typeMorpher.typeMorphInfo(type));
 131  
     }
 132  
 
 133  
     public <T extends JCExpression> T translate(T tree) {
 134  592
         return translate(tree, (TypeMorphInfo) null);
 135  
     }
 136  
 
 137  
     private List<JCExpression> translate(List<JCExpression> trees, Type methType, boolean toStatic, boolean usesVarArgs) {
 138  98
         ListBuffer<JCExpression> translated = ListBuffer.lb();
 139  98
         boolean handlingVarargs = false;
 140  98
         Type formal = null;
 141  98
         List<Type> t = methType.getParameterTypes();
 142  220
         for (List<JCExpression> l = trees; l.nonEmpty(); l = l.tail) {
 143  122
             if (!handlingVarargs) {
 144  122
                 formal = t.head;
 145  122
                 t = t.tail;
 146  122
                 if (usesVarArgs && t.isEmpty()) {
 147  0
                     formal = types.elemtype(formal);
 148  0
                     handlingVarargs = true;
 149  
                 }
 150  
             }
 151  122
             JCExpression tree = translate(l.head, formal);
 152  122
             if (tree != null) {
 153  122
                 if (tree.type == null) { // if not set by convert()
 154  57
                     tree.type = formal; // mark the type to declare the holder of this arg
 155  
                 }
 156  122
                 translated.append(tree);
 157  
             }
 158  
         }
 159  98
         List<JCExpression> args = translated.toList();
 160  
 
 161  
         // if this is a super.foo(x) call, "super" will be translated to referenced class,
 162  
         // so we add a receiver arg to make a direct call to the implementing method  MyClass.foo(receiver$, x)
 163  98
         if (toStatic) {
 164  2
             args = args.prepend(make.Ident(defs.receiverName));
 165  
         }
 166  
 
 167  98
         return args;
 168  
     }
 169  
 
 170  
     private JCExpression convert(Type inType, JCExpression tree) {
 171  649
         if (tmiTarget == null) {
 172  380
             tree.type = inType;
 173  380
             return tree;
 174  
         }
 175  269
         DiagnosticPosition diagPos = tree.pos();
 176  269
         Type targetType = tmiTarget.getRealType();
 177  269
         if (!types.isSameType(inType, targetType)) {
 178  32
             if (types.isSequence(targetType) && types.isSequence(inType)) {
 179  4
                 Type targetElementType = tmiTarget.getElementType();
 180  4
                 if (targetElementType == null) {  // runtime classes written in Java do this
 181  0
                     tree.type = inType;
 182  0
                     return tree;
 183  
                 }
 184  
                 // this additional test is needed because wildcards compare as different
 185  4
                 Type inElementType = typeMorpher.typeMorphInfo(inType).getElementType();
 186  4
                 if (!types.isSameType(inElementType, targetElementType)) {
 187  0
                     JCExpression targetClass = makeElementClassObject(diagPos, targetElementType);
 188  0
                     tree = runtime(diagPos, cBoundSequences, "upcast", List.of(targetClass, tree));
 189  
                 }
 190  4
             } else if (targetType == syms.doubleType) {
 191  17
                 tree = runtime(diagPos, cLocations, "asDoubleLocation", List.of(tree));
 192  11
             } else if (targetType == syms.intType) {
 193  0
                 tree = runtime(diagPos, cLocations, "asIntLocation", List.of(tree));
 194  11
             } else if (targetType == syms.booleanType) {
 195  0
                 tree = runtime(diagPos, cLocations, "asBooleanLocation", List.of(tree));
 196  
             } else {
 197  11
                 if (tmiTarget.getTypeKind() == TYPE_KIND_OBJECT) {
 198  11
                     List<JCExpression> typeArgs = List.of(makeTypeTree(diagPos, targetType, true),
 199  
                             makeTypeTree( diagPos,syms.boxIfNeeded(inType), true));
 200  11
                     Type inRealType = typeMorpher.typeMorphInfo(inType).getRealType();
 201  11
                     JCExpression inClass = makeElementClassObject(diagPos, inRealType);
 202  11
                     tree = runtime(diagPos, cLocations, "upcast", typeArgs, List.of(inClass, tree));
 203  
                 }
 204  
             }
 205  
         }
 206  269
         tree.type = targetType; // as a way of passing it to methods which needs to know the target type
 207  269
         return tree;
 208  
     }
 209  
 
 210  
     private Type targetType(Type type) {
 211  294
         return tmiTarget!=null? tmiTarget.getRealType() : type;
 212  
     }
 213  
 
 214  
     private JCVariableDecl translateVar(JFXVar tree) {
 215  9
         DiagnosticPosition diagPos = tree.pos();
 216  
 
 217  9
         JCModifiers mods = tree.getModifiers();
 218  9
         long modFlags = mods == null ? 0L : mods.flags;
 219  9
         modFlags |= Flags.FINAL;  // Locations are never overwritten
 220  9
         mods = make.at(diagPos).Modifiers(modFlags);
 221  
 
 222  9
         VarMorphInfo vmi = typeMorpher.varMorphInfo(tree.sym);
 223  9
         toJava.setLocallyBound(tree.sym); //TODO temporary until only one function is generated, and bound functions can be handled in var usage analysis (note: fragile, requires unbound version to be processed first).
 224  9
         JCExpression typeExpression = makeTypeTree( diagPos,vmi.getLocationType(), true);
 225  
 
 226  
         //TODO: handle array initializers (but, really, shouldn't that be somewhere else?)
 227  
         JCExpression init;
 228  9
         if (tree.init == null) {
 229  0
             init = makeLocationAttributeVariable(vmi, diagPos);
 230  
         } else {
 231  9
             init = translate(tree.init, vmi.getRealFXType());
 232  
         }
 233  9
         return make.at(diagPos).VarDef(mods, tree.name, typeExpression, init);
 234  
     }
 235  
 
 236  
     private JCStatement definitionalAssignmentToSet(DiagnosticPosition diagPos,
 237  
             JCExpression init, JavafxBindStatus bindStatus, VarSymbol vsym,
 238  
             JCExpression instance, int milieu) {
 239  94
         return make.at(diagPos).Exec( definitionalAssignmentToSetExpression(diagPos,
 240  
             init, bindStatus, vsym,
 241  
              instance, milieu) );
 242  
     }
 243  
 
 244  
     private JCExpression definitionalAssignmentToSetExpression(DiagnosticPosition diagPos,
 245  
             JCExpression init, JavafxBindStatus bindStatus, VarSymbol vsym,
 246  
             JCExpression instance, int milieu) {
 247  94
         VarMorphInfo vmi = typeMorpher.varMorphInfo(vsym);
 248  94
         JCExpression nonNullInit = (init == null)? makeDefaultValue(diagPos, vmi) : init;
 249  94
         List<JCExpression> args = List.<JCExpression>of( nonNullInit );
 250  
         JCExpression localAttr;
 251  94
         if ((vsym.flags() & STATIC) != 0) {
 252  
             // statics are accessed directly
 253  0
             localAttr = make.Ident(vsym);
 254  
         } else {
 255  94
             String attrAccess = attributeGetMethodNamePrefix + vsym;
 256  94
             localAttr = callExpression(diagPos, instance, attrAccess);
 257  
         }
 258  
         Name methName;
 259  94
         if (bindStatus.isUnidiBind()) {
 260  23
             methName = defs.locationBindMilieuMethodName[milieu];
 261  71
         } else if (bindStatus.isBidiBind()) {
 262  0
             methName = defs.locationBijectiveBindMilieuMethodName[milieu];
 263  
         } else {
 264  71
             methName = defs.locationSetMilieuMethodName[vmi.getTypeKind()][milieu];
 265  
         }
 266  94
         return callExpression(diagPos, localAttr, methName, args);
 267  
     }
 268  
 
 269  1
     private abstract class ClosureTranslator extends Translator {
 270  
 
 271  
         protected final TypeMorphInfo tmiResult;
 272  
         protected final int typeKindResult;
 273  
         protected final Type elementTypeResult;
 274  
 
 275  
         // these only used when fields are built
 276  253
         ListBuffer<JCTree> members = ListBuffer.lb();
 277  253
         ListBuffer<JCStatement> fieldInits = ListBuffer.lb();
 278  253
         ListBuffer<JCExpression> dependents = ListBuffer.lb();
 279  253
         ListBuffer<JCExpression> callArgs = ListBuffer.lb();
 280  253
         int argNum = 0;
 281  
 
 282  
         ClosureTranslator(DiagnosticPosition diagPos, Type resultType) {
 283  253
             this(diagPos, JavafxToBound.this.toJava, (tmiTarget != null) ? tmiTarget : typeMorpher.typeMorphInfo(resultType));
 284  253
         }
 285  
 
 286  253
         private ClosureTranslator(DiagnosticPosition diagPos, JavafxToJava toJava, TypeMorphInfo tmiResult) {
 287  253
             super(diagPos, toJava);
 288  253
             this.tmiResult = tmiResult;
 289  253
             typeKindResult = tmiResult.getTypeKind();
 290  253
             elementTypeResult = elementType(tmiResult.getLocationType()); // want boxed, JavafxTypes version won't work
 291  253
         }
 292  
 
 293  
         /**
 294  
          * Make a method paramter
 295  
          */
 296  
         protected JCVariableDecl makeParam(Type type, Name name) {
 297  48
             return make.at(diagPos).VarDef(
 298  
                     m().Modifiers(Flags.PARAMETER | Flags.FINAL),
 299  
                     name,
 300  
                     makeExpression(type),
 301  
                     null);
 302  
         }
 303  
 
 304  
         protected JCTree makeClosureMethod(String methName, JCExpression expr, List<JCVariableDecl> params, Type returnType, long flags) {
 305  406
             return m().MethodDef(
 306  
                     m().Modifiers(flags),
 307  
                     names.fromString(methName),
 308  
                     makeExpression(returnType),
 309  
                     List.<JCTypeParameter>nil(),
 310  
                     params==null? List.<JCVariableDecl>nil() : params,
 311  
                     List.<JCExpression>nil(),
 312  
                     m().Block(0L, List.<JCStatement>of(m().Return(expr))),
 313  
                     null);
 314  
         }
 315  
 
 316  
         protected JCTree makeClosureMethod(String methName, JCExpression expr, List<JCVariableDecl> params) {
 317  0
             return makeClosureMethod(methName, expr, params, tmiResult.getLocationType(), Flags.PROTECTED);
 318  
         }
 319  
 
 320  
         protected abstract List<JCTree> makeBody();
 321  
 
 322  
         protected abstract JCExpression makeBaseClass();
 323  
 
 324  
         protected JCExpression makeBaseClass(Type clazzType, Type additionTypeParamOrNull) {
 325  153
             JCExpression clazz = makeExpression(types.erasure(clazzType));  // type params added below, so erase formals
 326  153
             ListBuffer<JCExpression> typeParams = ListBuffer.lb();
 327  
 
 328  153
             if (typeKindResult == TYPE_KIND_OBJECT || typeKindResult == TYPE_KIND_SEQUENCE) {
 329  114
                 typeParams.append(makeExpression(elementTypeResult));
 330  
             }
 331  153
             if (additionTypeParamOrNull != null) {
 332  0
                 typeParams.append(makeExpression(additionTypeParamOrNull));
 333  
             }
 334  153
             return typeParams.isEmpty()? clazz : m().TypeApply(clazz, typeParams.toList());
 335  
         }
 336  
 
 337  
         protected abstract List<JCExpression> makeConstructorArgs();
 338  
 
 339  
         protected JCExpression buildClosure() {
 340  253
             JCClassDecl classDecl = m().AnonymousClassDef(m().Modifiers(0L), makeBody());
 341  253
             List<JCExpression> typeArgs = List.nil();
 342  253
             return m().NewClass(null/*encl*/, typeArgs, makeBaseClass(), makeConstructorArgs(), classDecl);
 343  
         }
 344  
 
 345  
         protected JCExpression doit() {
 346  100
             return buildClosure();
 347  
         }
 348  
 
 349  
 
 350  
         // field building support
 351  
 
 352  
         protected List<JCTree> completeMembers() {
 353  201
             members.append(m().Block(0L, fieldInits.toList()));
 354  201
             return members.toList();
 355  
         }
 356  
 
 357  
         protected JCExpression makeGet(JCExpression locExpr, int typeKind) {
 358  260
             Name getMethodName = defs.locationGetMethodName[typeKind];
 359  260
             JCFieldAccess select = m().Select(locExpr, getMethodName);
 360  260
             return m().Apply(null, select, List.<JCExpression>nil());
 361  
         }
 362  
 
 363  
         protected JCExpression makeGetField(Name fieldName, TypeMorphInfo tmiField) {
 364  218
             return makeGetField(fieldName, tmiField.getTypeKind());
 365  
         }
 366  
 
 367  
         protected JCExpression makeGetField(Name fieldName, int typeKind) {
 368  234
             return makeGet(m().Ident(fieldName), typeKind);
 369  
         }
 370  
 
 371  
         protected JCTree makeLocationField(JCExpression targ, Name argName, TypeMorphInfo tmiArg) {
 372  261
             fieldInits.append( m().Exec( m().Assign(m().Ident(argName), targ)) );
 373  261
             return m().VarDef(
 374  
                     m().Modifiers(Flags.PRIVATE),
 375  
                     argName,
 376  
                     makeExpression(tmiArg.getLocationType()),
 377  
                     null);
 378  
         }
 379  
 
 380  
         protected JCExpression buildArgField(JCExpression arg, Type type) {
 381  28
             return buildArgField(arg, type, false);
 382  
         }
 383  
 
 384  
         protected JCExpression buildArgField(JCExpression arg, Type type, boolean isBound) {
 385  144
             return buildArgField(arg, type, "arg$" + argNum++, isBound);
 386  
         }
 387  
 
 388  
         protected JCExpression buildArgField(JCExpression arg, Type type, String argLabel) {
 389  22
             return buildArgField(arg, type, argLabel, false);
 390  
         }
 391  
 
 392  
         protected JCExpression buildArgField(JCExpression arg, Type type, String argLabel, boolean isBound) {
 393  261
                 TypeMorphInfo tmiArg = typeMorpher.typeMorphInfo(type);
 394  261
                 Name argName = names.fromString(argLabel);
 395  
 
 396  
                 // translate the method arg into a Location field of the BindingExpression
 397  
                 // XxxLocation arg$0 = ...;
 398  261
                 members.append(makeLocationField(arg, argName, tmiArg));
 399  
 
 400  
             // build a list of these args, for use as dependents -- arg$0, arg$1, ...
 401  261
             if (isBound) {
 402  43
                 return m().Ident(argName);
 403  
             } else {
 404  218
                 dependents.append(m().Ident(argName));
 405  
 
 406  
                 // set up these arg for the call -- arg$0.getXxx()
 407  218
                 return makeGetField(argName, tmiArg);
 408  
             }
 409  
          }
 410  
 
 411  
         protected void buildArgFields(List<JCExpression> targs, boolean isBound) {
 412  90
             for (JCExpression targ : targs) {
 413  116
                 assert targ.type != null : "caller is supposed to decorate the translated arg with its type";
 414  116
                 callArgs.append( buildArgField(targ, targ.type, isBound) );
 415  
             }
 416  90
         }
 417  
     }
 418  
 
 419  
     @Override
 420  
     public void visitInstanciate(final JFXInstanciate tree) {
 421  64
         result = new BindingExpressionClosureTranslator(tree.pos(), tree.type) {
 422  
 
 423  
             protected JCExpression resultValue() {
 424  64
                 return new InstanciateTranslator(tree, toJava) {
 425  
 
 426  
                     protected void processLocalVar(JFXVar var) {
 427  1
                         JCExpression init = var.getInitializer();
 428  1
                         JCExpression tinit = init==null?
 429  
                                 makeLocationAttributeVariable(typeMorpher.varMorphInfo(var.sym), diagPos)
 430  
                                 : translate(init);
 431  1
                         buildArgField(tinit, var.type, var.getName().toString(), var.isBound());
 432  1
                     }
 433  
 
 434  
                     @Override
 435  
                     protected List<JCExpression> translatedConstructorArgs() {
 436  64
                         if (tree.getArgs().size() > 0) {
 437  0
                             buildArgFields(translate(tree.getArgs(), tree.constructor.type, false, false), false);
 438  0
                             return callArgs.toList();
 439  
                         } else {
 440  64
                             return List.<JCExpression>nil();
 441  
                         }
 442  
                     }
 443  
 
 444  
                     protected JCStatement translateAttributeSet(JCExpression init, JavafxBindStatus bindStatus, VarSymbol vsym, JCExpression instance) {
 445  94
                         JCExpression initRef = buildArgField(translate(init, vsym.type), vsym.type, vsym.name.toString() + "$attr", bindStatus.isBound());
 446  94
                         return definitionalAssignmentToSet(diagPos, initRef, bindStatus,
 447  
                                 vsym, instance, FROM_LITERAL_MILIEU);
 448  
                     }
 449  
                 }.doit();
 450  
             }
 451  
         }.doit();
 452  64
     }
 453  
 
 454  
     @Override
 455  
     public void visitStringExpression(final JFXStringExpression tree) {
 456  14
         result = new BindingExpressionClosureTranslator(tree.pos(), syms.stringType) {
 457  
 
 458  
             protected JCExpression resultValue() {
 459  14
                 return new StringExpressionTranslator(tree, toJava) {
 460  
 
 461  
                     protected JCExpression translateArg(JCExpression arg) {
 462  28
                         return buildArgField(translate(arg), arg.type);
 463  
                     }
 464  
                 }.doit();
 465  
             }
 466  
         }.doit();
 467  14
     }
 468  
 
 469  
     @Override
 470  
     public void visitFunctionValue(JFXFunctionValue tree) {
 471  0
         JFXFunctionDefinition def = tree.definition;
 472  0
         result = makeConstantLocation(tree.pos(), targetType(tree.type), toJava.makeFunctionValue(make.Ident(defs.lambdaName), def, tree.pos(), (MethodType) def.type) );
 473  0
     }
 474  
 
 475  
     public void visitBlockExpression(JFXBlockExpression tree) {   //done
 476  24
         assert (tree.type != syms.voidType) : "void block expressions should be not exist in bind expressions";
 477  24
         DiagnosticPosition diagPos = tree.pos();
 478  
 
 479  24
         JCExpression value = tree.value;
 480  24
         ListBuffer<JCStatement> translatedVars = ListBuffer.lb();
 481  
 
 482  24
         for (JCStatement stmt : tree.getStatements()) {
 483  11
             switch (stmt.getTag()) {
 484  
                 case JavafxTag.RETURN:
 485  2
                     assert value == null;
 486  2
                     value = ((JCReturn) stmt).getExpression();
 487  2
                     break;
 488  
                 case JavafxTag.VAR_DEF:
 489  9
                     translatedVars.append(translateVar((JFXVar) stmt));
 490  9
                     break;
 491  
                 default:
 492  0
                     log.error(diagPos, MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, stmt.toString());
 493  11
                     break;
 494  
             }
 495  
         }
 496  24
         result = ((JavafxTreeMaker) make).at(diagPos).BlockExpression(tree.flags,
 497  
                 translatedVars.toList(),
 498  
                 translate(value, tmiTarget) );
 499  24
     }
 500  
 
 501  
     @Override
 502  
     public void visitAssign(JCAssign tree) {
 503  
         //TODO: this should probably not be allowed
 504  
         // log.error(tree.pos(), "javafx.not.allowed.in.bind.context", "=");
 505  1
         DiagnosticPosition diagPos = tree.pos();
 506  1
         TypeMorphInfo tmi = typeMorpher.typeMorphInfo(tree.type);
 507  1
         int typeKind = tmi.getTypeKind();
 508  
         // create a temp var to hold the RHS
 509  1
         JCVariableDecl varDecl = makeTmpVar(diagPos, tmi.getLocationType(), translate(tree.rhs));
 510  
         // call the set method
 511  1
         JCStatement setStmt = callStatement(diagPos,
 512  
                 translate(tree.lhs),
 513  
                 defs.locationSetMethodName[typeKind],
 514  
                 callExpression(diagPos,
 515  
                     make.at(diagPos).Ident(varDecl.name),
 516  
                     defs.locationGetMethodName[typeKind]));
 517  
         // bundle it all into a block-expression that looks like --
 518  
         // { ObjectLocation tmp = rhs; lhs.set(tmp.get()); tmp }
 519  1
         result = ((JavafxTreeMaker) make).at(diagPos).BlockExpression(0L,
 520  
                 List.of(varDecl, setStmt),
 521  
                 make.at(diagPos).Ident(varDecl.name));
 522  1
     }
 523  
 
 524  
     @Override
 525  
     public void visitAssignop(JCAssignOp tree) {
 526  0
         log.error(tree.pos(), MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, "=");
 527  0
     }
 528  
 
 529  
     private JCExpression makeBoundSelect(final DiagnosticPosition diagPos,
 530  
             final Type resultType,
 531  
             final JCExpression receiverExpr,
 532  
             final Function1ClosureTranslator translator) {
 533  48
         TypeMorphInfo tmi = (tmiTarget != null) ? tmiTarget : typeMorpher.typeMorphInfo(resultType);
 534  48
         List<JCExpression> args = List.of(
 535  
                 makeLaziness(diagPos),
 536  
                 receiverExpr,
 537  
                 translator.doit());
 538  48
         if (tmi.isSequence() || tmi.getTypeKind() == TYPE_KIND_OBJECT) {
 539  
             // prepend "Foo.class, "
 540  23
             args = args.prepend(makeElementClassObject(diagPos, tmi.getElementType()));
 541  
         }
 542  48
         return runtime(diagPos, cBoundOperators, "makeBoundSelect", args);
 543  
     }
 544  
 
 545  
     abstract class Function1ClosureTranslator extends ClosureTranslator {
 546  
 
 547  
         final Type param1Type;
 548  
 
 549  
         Function1ClosureTranslator(DiagnosticPosition diagPos,
 550  
                 Type resultType,
 551  48
                 final Type param1Type) {
 552  48
             super(diagPos, resultType);
 553  48
             this.param1Type = param1Type;
 554  48
         }
 555  
 
 556  
         abstract protected JCExpression makeInvokeMethodBody();
 557  
 
 558  
         protected List<JCTree> makeBody() {
 559  48
             List<JCVariableDecl> params = List.of(makeParam(param1Type, param1Name));
 560  48
             members.append(
 561  
                     makeClosureMethod("invoke", makeInvokeMethodBody(), params, tmiResult.getLocationType(), Flags.PUBLIC));
 562  48
             return completeMembers();
 563  
         }
 564  
 
 565  
         protected JCExpression makeBaseClass() {
 566  48
             JCExpression objFactory = makeQualifiedTree(diagPos, cFunction1);
 567  48
             Type clazzType = tmiResult.getLocationType();
 568  48
             return m().TypeApply(objFactory, List.of(
 569  
                     makeExpression(clazzType),
 570  
                     makeExpression(param1Type)));
 571  
         }
 572  
 
 573  
         protected List<JCExpression> makeConstructorArgs() {
 574  48
             return List.<JCExpression>nil();
 575  
         }
 576  
     }
 577  
 
 578  
     @Override
 579  
     public void visitSelect(final JCFieldAccess tree) {
 580  32
         if (tree.type instanceof FunctionType && tree.sym.type instanceof MethodType) {
 581  0
             result = convert(tree.type, toJava.translate(tree, Wrapped.InLocation)); //TODO -- for now punt, translate like normal case
 582  0
             return;
 583  
         }
 584  32
         DiagnosticPosition diagPos = tree.pos();
 585  
 
 586  32
         Symbol owner = tree.sym.owner;
 587  32
         if (types.isJFXClass(owner)) {
 588  29
             if (tree.sym.isStatic()) {
 589  
                 // if this is a static reference to an attribute, eg.   MyClass.myAttribute
 590  7
                 JCExpression classRef = makeTypeTree( diagPos,types.erasure(tree.sym.owner.type), false);
 591  7
                 result = convert(tree.type, make.at(diagPos).Select(classRef, tree.getIdentifier()));
 592  7
             } else {
 593  
                 // this is a dynamic reference to an attribute
 594  22
                 JCExpression expr = tree.getExpression();
 595  22
                 result = makeBoundSelect(diagPos,
 596  
                         tree.type,
 597  
                         translate(expr),
 598  22
                         new Function1ClosureTranslator(diagPos, tree.type, expr.type) {
 599  
 
 600  
                             protected JCExpression makeInvokeMethodBody() {
 601  22
                                 return convert(tree.type, toJava.convertVariableReference(diagPos,
 602  
                                         make.at(diagPos).Select(make.at(diagPos).Ident(param1Name), tree.getIdentifier()),
 603  
                                         tree.sym,
 604  
                                         true));
 605  
                             }
 606  
                         });
 607  22
             }
 608  
         } else {
 609  3
             if (tree.sym.isStatic()) {
 610  
                 // if this is a static reference to a Java member e.g. System.out -- do unbound translation, then wrap
 611  3
                 result = this.makeUnboundLocation(diagPos, targetType(tree.type), toJava.translate(tree, Wrapped.InNothing));
 612  
             } else {
 613  
                 // dynamic reference to a Java member
 614  0
                 result = (new BindingExpressionClosureTranslator(diagPos, tree.type) {
 615  
 
 616  0
                     private JCExpression selector = tree.getExpression();
 617  0
                     private TypeMorphInfo tmiSelector = typeMorpher.typeMorphInfo(selector.type);
 618  0
                     private Name selectorName = getSyntheticName("selector");
 619  
 
 620  
                     protected JCExpression resultValue() {
 621  
                         // create two accesses to the value of to selector field -- selector$.blip
 622  
                         // one for the method call and one for the nul test
 623  0
                         JCExpression transSelector = makeGetField(selectorName, tmiSelector);
 624  0
                         JCExpression toTest = makeGetField(selectorName, tmiSelector);
 625  
 
 626  
                         // construct the actual select
 627  0
                         JCExpression selectExpr = m().Select(transSelector, tree.getIdentifier());
 628  
 
 629  
                         // test the selector for null before attempting to select the field
 630  
                         // if it would dereference null, then instead give the default value
 631  0
                         JCExpression cond = m().Binary(JCTree.NE, toTest, make.Literal(TypeTags.BOT, null));
 632  0
                         JCExpression defaultExpr = makeDefaultValue(diagPos, tmiResult);
 633  0
                         return m().Conditional(cond, selectExpr, defaultExpr);
 634  
                     }
 635  
 
 636  
                     @Override
 637  
                     protected void buildFields() {
 638  
                         // translate the selector into a Location field of the BindingExpression
 639  
                         // XxxLocation selector$ = ...;
 640  0
                         buildArgField(translate(selector), selector.type, selectorName.toString());
 641  0
                     }
 642  
                 }).doit();
 643  
             }
 644  
         }
 645  32
     }
 646  
 
 647  
     @Override
 648  
     public void visitIdent(JCIdent tree)   {  //TODO: don't use toJava
 649  
        // assert (tree.sym.flags() & Flags.PARAMETER) != 0 || tree.name == names._this || tree.sym.isStatic() || toJava.shouldMorph(typeMorpher.varMorphInfo(tree.sym)) : "we are bound, so should have been marked to morph: " + tree;
 650  446
         JCExpression transId = toJava.translate(tree, Wrapped.InLocation);
 651  446
         result = convert(tree.type, transId );
 652  446
     }
 653  
 
 654  
     @Override
 655  
     public void visitSequenceExplicit(JFXSequenceExplicit tree) { //done
 656  29
         ListBuffer<JCStatement> stmts = ListBuffer.lb();
 657  29
         Type elemType = elementType(targetType(tree.type));
 658  29
         UseSequenceBuilder builder = toJava.useBoundSequenceBuilder(tree.pos(), elemType);
 659  29
         stmts.append(builder.makeBuilderVar());
 660  29
         for (JCExpression item : tree.getItems()) {
 661  80
             stmts.append(builder.makeAdd( item ) );
 662  
         }
 663  29
         result = makeBlockExpression(tree.pos(), stmts, builder.makeToSequence());
 664  29
     }
 665  
 
 666  
     @Override
 667  
     public void visitSequenceRange(JFXSequenceRange tree) { //done: except for step and exclusive
 668  26
         DiagnosticPosition diagPos = tree.pos();
 669  26
         ListBuffer<JCExpression> args = ListBuffer.lb();
 670  26
         args.append( translate( tree.getLower() ));
 671  26
         args.append( translate( tree.getUpper() ));
 672  26
         if (tree.getStepOrNull() != null) {
 673  8
             args.append( translate( tree.getStepOrNull() ));
 674  
         }
 675  26
         if (tree.isExclusive()) {
 676  7
             args.append( make.at(diagPos).Literal(TypeTags.BOOLEAN, 1) );
 677  
         }
 678  26
         result = convert(tree.type, runtime(diagPos, cBoundSequences, "range", args));
 679  26
     }
 680  
 
 681  
     @Override
 682  
     public void visitSequenceEmpty(JFXSequenceEmpty tree) { //done
 683  3
         DiagnosticPosition diagPos = tree.pos();
 684  3
         if (types.isSequence(tree.type)) {
 685  2
             Type elemType = types.elementType(targetType(tree.type));
 686  2
             result = runtime(diagPos, cBoundSequences, "empty", List.of(makeElementClassObject(diagPos, elemType)));
 687  2
         } else {
 688  1
             result = makeConstantLocation(diagPos, targetType(tree.type), makeNull(diagPos));
 689  
         }
 690  3
     }
 691  
 
 692  
     @Override
 693  
     public void visitSequenceIndexed(JFXSequenceIndexed tree) {   //done
 694  4
         result = convert(tree.type, runtime(tree.pos(), cBoundSequences, "element",
 695  
                 List.of(translate(tree.getSequence()),
 696  
                 translate(tree.getIndex()))));
 697  4
     }
 698  
 
 699  
     @Override
 700  
     public void visitSequenceSlice(JFXSequenceSlice tree) {    //done
 701  6
         DiagnosticPosition diagPos = tree.pos();
 702  6
         result = runtime(diagPos, cBoundSequences,
 703  
                 tree.getEndKind()==SequenceSliceTree.END_EXCLUSIVE? "sliceExclusive" : "slice",
 704  
                 List.of(
 705  
                     makeElementClassObject(diagPos, types.elementType(targetType(tree.type))),
 706  
                     translate(tree.getSequence()),
 707  
                     translate(tree.getFirstIndex()),
 708  
                     tree.getLastIndex()==null? makeNull(diagPos) : translate(tree.getLastIndex())
 709  
                     ));
 710  6
     }
 711  
 
 712  
     /**
 713  
      * Generate this template, expanding to handle multiple in-clauses
 714  
      *
 715  
      *  SequenceLocation<V> derived = new BoundComprehension<T,V>(V.class, IN_SEQUENCE, USE_INDEX) {
 716  
             protected SequenceLocation<V> getMappedElement$(final ObjectLocation<T> IVAR_NAME, final IntLocation INDEXOF_IVAR_NAME) {
 717  
                 return SequenceVariable.make(V.class,
 718  
                                              new SequenceBindingExpression<V>() {
 719  
                                                  public Sequence<V> computeValue() {
 720  
                                                      if (WHERE)
 721  
                                                          return BODY with s/indexof IVAR_NAME/INDEXOF_IVAR_NAME/;
 722  
                                                      else
 723  
                                                         return Sequences.emptySequence(V.class);
 724  
                                                  }
 725  
                                              }, maybe IVAR_NAME, maybe INDEXOF_IVAR_NAME);
 726  
             }
 727  
         };
 728  
      *
 729  
      * **/
 730  
     @Override
 731  
     public void visitForExpression(final JFXForExpression tree) {
 732  26
         result = (new Translator( tree.pos(), toJava ) {
 733  
 
 734  26
             private final TypeMorphInfo tmiResult = typeMorpher.typeMorphInfo(targetType(tree.type));
 735  
 
 736  
             /**
 737  
              * V
 738  
              */
 739  26
             private final Type resultElementType = tmiResult.getElementType();
 740  
 
 741  
             /**
 742  
              * SequenceLocation<V>
 743  
              */
 744  26
             private final Type resultSequenceLocationType = typeMorpher.generifyIfNeeded(typeMorpher.locationType(TYPE_KIND_SEQUENCE), tmiResult);
 745  
             
 746  
             /**
 747  
              * isSimple -- true if the for-loop is simple enough that it can use SimpleBoundComprehension
 748  
              */
 749  26
             private final boolean isSimple = false;  //TODO
 750  
 
 751  
             /**
 752  
              * Make:  V.class
 753  
              */
 754  
             private JCExpression makeResultClass() {
 755  50
                 return makeElementClassObject(diagPos, resultElementType);
 756  
             }
 757  
 
 758  
             /**
 759  
              * Make a method parameter
 760  
              */
 761  
             private JCVariableDecl makeParam(Type type, Name name) {
 762  56
                 return make.at(diagPos).VarDef(
 763  
                         make.Modifiers(Flags.PARAMETER | Flags.FINAL),
 764  
                         name,
 765  
                         makeExpression(type),
 766  
                         null);
 767  
 
 768  
             }
 769  
 
 770  
             /**
 771  
              * Starting with the body of the comprehension...
 772  
              * Wrap in a singleton sequence, if not a sequence.
 773  
              * Wrap in a conditional if there are where-clauses:   whereClause? body : []
 774  
              */
 775  
             private JCExpression makeCore() {
 776  26
                 JCExpression body = translate(tree.getBodyExpression());
 777  26
                 if (!types.isSequence(tree.getBodyExpression().type)) {
 778  21
                     List<JCExpression> args = List.of(makeResultClass(), body);
 779  21
                     body = runtime(diagPos, cBoundSequences, "singleton", args);
 780  
                 }
 781  26
                 JCExpression whereTest = null;
 782  26
                 for (JFXForExpressionInClause clause : tree.getForExpressionInClauses()) {
 783  28
                     JCExpression where = translate(clause.getWhereExpression());
 784  28
                     if (where != null) {
 785  8
                         if (whereTest == null) {
 786  8
                             whereTest = where;
 787  
                         } else {
 788  0
                             whereTest = runtime(diagPos, cBoundOperators, "and_bb", List.of(whereTest, where));
 789  
                         }
 790  
                     }
 791  28
                 }
 792  26
                 if (whereTest != null) {
 793  8
                     body = makeBoundConditional(diagPos,
 794  
                             tree.type,
 795  
                             body,
 796  
                             runtime(diagPos, cBoundSequences, "empty", List.of(makeElementClassObject(diagPos, resultElementType))),
 797  
                             whereTest);
 798  
                 }
 799  26
                 return body;
 800  
             }
 801  
 
 802  
             /**
 803  
              *  protected SequenceLocation<V> computeElements$(final ObjectLocation<T> IVAR_NAME, final IntLocation INDEXOF_IVAR_NAME) {
 804  
              *     return ...
 805  
              *  }
 806  
              */
 807  
             private JCTree makeComputeElementsMethod(JFXForExpressionInClause clause, JCExpression inner, TypeMorphInfo tmiInduction) {
 808  
                 Type iVarType;
 809  
                 Type idxVarType;
 810  
                 Name computeName;
 811  
                 if  (isSimple) {
 812  
                    iVarType = tmiInduction.getRealFXType();
 813  
                    idxVarType = syms.intType;
 814  
                    computeName = computeElementsName;
 815  
                 } else {
 816  28
                    iVarType = tmiInduction.getLocationType();
 817  28
                    idxVarType = typeMorpher.locationType(TYPE_KIND_INT);
 818  28
                    computeName = computeElementsName;
 819  
                 }
 820  28
                 ListBuffer<JCStatement> stmts = ListBuffer.lb();
 821  28
                 Name ivarName = clause.getVar().name;
 822  28
                 stmts.append(m().Return( inner ));
 823  28
                 List<JCVariableDecl> params = List.of(
 824  
                         makeParam(iVarType, ivarName),
 825  
                         makeParam(idxVarType, indexVarName(clause) )
 826  
                         );
 827  28
                 return m().MethodDef(
 828  
                         m().Modifiers(Flags.PROTECTED),
 829  
                         computeName,
 830  
                         makeExpression( resultSequenceLocationType ),
 831  
                         List.<JCTypeParameter>nil(),
 832  
                         params,
 833  
                         List.<JCExpression>nil(),
 834  
                         m().Block(0L, stmts.toList()),
 835  
                         null);
 836  
             }
 837  
 
 838  
             /**
 839  
              * new BoundComprehension<T,V>(V.class, IN_SEQUENCE, USE_INDEX) { ... }
 840  
              */
 841  
             private JCExpression makeBoundComprehension(JFXForExpressionInClause clause, JCExpression inner) {
 842  28
                 JCExpression seq = clause.getSequenceExpression();
 843  28
                 TypeMorphInfo tmiSeq = typeMorpher.typeMorphInfo(seq.type);
 844  28
                 TypeMorphInfo tmiInduction = typeMorpher.typeMorphInfo(clause.getVar().type);
 845  28
                 Type elementType = tmiSeq.getElementType();
 846  28
                 JCClassDecl classDecl = m().AnonymousClassDef(
 847  
                         m().Modifiers(0L),
 848  
                         List.<JCTree>of(makeComputeElementsMethod(clause, inner, tmiInduction)));
 849  28
                 List<JCExpression> typeArgs = List.nil();
 850  28
                 boolean useIndex = clause.getIndexUsed();
 851  28
                 JCExpression transSeq = translate( seq );
 852  28
                 if (!tmiSeq.isSequence()) {
 853  1
                     transSeq = runtime(diagPos, cBoundSequences, "singleton", List.of(makeResultClass(), transSeq));
 854  
                 }
 855  28
                 List<JCExpression> constructorArgs = List.of(
 856  
                         makeResultClass(),
 857  
                         transSeq,
 858  
                         m().Literal(TypeTags.BOOLEAN, useIndex? 1 : 0) );
 859  
                 //JCExpression clazz = makeQualifiedTree(diagPos, "com.sun.javafx.runtime.sequence.BoundComprehension");
 860  28
                 int typeKind = tmiInduction.getTypeKind();
 861  28
                 Type bcType = typeMorpher.boundComprehensionNCT[typeKind].type;
 862  28
                 JCExpression clazz = makeExpression(types.erasure(bcType));  // type params added below, so erase formals
 863  28
                 ListBuffer<JCExpression> typeParams = ListBuffer.lb();
 864  28
                 if (typeKind == TYPE_KIND_OBJECT) {
 865  5
                     typeParams.append( makeExpression(elementType) );
 866  
                 }
 867  28
                 typeParams.append( makeExpression(resultElementType) );
 868  28
                 clazz = m().TypeApply(clazz, typeParams.toList());
 869  28
                 return m().NewClass(null,
 870  
                         typeArgs,
 871  
                         clazz,
 872  
                         constructorArgs,
 873  
                         classDecl);
 874  
             }
 875  
 
 876  
             /**
 877  
              * Put everything together, handle multiple in clauses -- wrap from the inner-most first
 878  
              */
 879  
             public JCExpression doit() {
 880  26
                 List<JFXForExpressionInClause> clauses = tree.getForExpressionInClauses();
 881  
                 if (!isSimple) {
 882  
                     // mark the params as morphed before any ranslation occurs
 883  26
                     for (JFXForExpressionInClause clause : clauses) {
 884  28
                         toJava.setLocallyBound(clause.getVar().sym);
 885  
                     }
 886  
                 }
 887  
                 // make the body of loop
 888  26
                 JCExpression expr = makeCore();
 889  
                 // then wrap it in the looping constructs
 890  54
                 for (int inx = clauses.size() - 1; inx >= 0; --inx) {
 891  28
                     JFXForExpressionInClause clause = clauses.get(inx);
 892  28
                     expr = makeBoundComprehension(clause, expr);
 893  
                 }
 894  26
                 return expr;
 895  
             }
 896  
         }).doit();
 897  26
     }
 898  
 
 899  
     public void visitIndexof(JFXIndexof tree) {
 900  6
         assert tree.clause.getIndexUsed() : "assert that index used is set correctly";
 901  6
         JCExpression transIndex = make.at(tree.pos()).Ident(indexVarName(tree.clause));
 902  6
         VarSymbol vsym = (VarSymbol)tree.clause.getVar().sym;
 903  6
         if (!toJava.shouldMorph(vsym)) {
 904  
             // it came from outside of the bind, make it into a Location
 905  0
             result = makeConstantLocation(tree.pos(), targetType(tree.type), transIndex);
 906  
         } else {
 907  
             // from inside the bind, already a Location
 908  6
             result = convert(tree.type, transIndex);
 909  
         }
 910  6
     }
 911  
 
 912  
     /**
 913  
      * Build a tree for a conditional.
 914  
      * @param diagPos
 915  
      * @param resultType
 916  
      * @param trueExpr then branch, already translated
 917  
      * @param falseExpr else  branch, already translated
 918  
      * @param condExpr conditional expression  branch, already translated
 919  
      * @return
 920  
      */
 921  
     private JCExpression makeBoundConditional(final DiagnosticPosition diagPos,
 922  
             final Type resultType,
 923  
             final JCExpression trueExpr,
 924  
             final JCExpression falseExpr,
 925  
             final JCExpression condExpr) {
 926  26
         TypeMorphInfo tmi = (tmiTarget != null) ? tmiTarget : typeMorpher.typeMorphInfo(resultType);
 927  26
         List<JCExpression> args = List.of(
 928  
                 makeLaziness(diagPos),
 929  
                 condExpr,
 930  
                 makeFunction0(resultType, trueExpr),
 931  
                 makeFunction0(resultType, falseExpr));
 932  26
         if (tmi.isSequence()) {
 933  
             // prepend "Foo.class, "
 934  9
             args = args.prepend(makeElementClassObject(diagPos, tmi.getElementType()));
 935  
         }
 936  26
         return runtime(diagPos, cBoundOperators, "makeBoundIf", args);
 937  
     }
 938  
 
 939  
     private JCExpression makeFunction0(
 940  
             final Type resultType,
 941  
             final JCExpression bodyExpr) {
 942  52
         return (new ClosureTranslator(bodyExpr.pos(), resultType) {
 943  
 
 944  
             protected List<JCTree> makeBody() {
 945  52
                 return List.<JCTree>of(
 946  
                         makeClosureMethod("invoke", bodyExpr, null, tmiResult.getLocationType(), Flags.PUBLIC));
 947  
             }
 948  
 
 949  
             protected JCExpression makeBaseClass() {
 950  52
                 JCExpression objFactory = makeQualifiedTree(diagPos, cFunction0);
 951  52
                 Type clazzType = tmiResult.getLocationType();
 952  52
                 JCExpression clazz = makeExpression(clazzType);
 953  52
                 return m().TypeApply(objFactory, List.of(clazz));
 954  
             }
 955  
 
 956  
             protected List<JCExpression> makeConstructorArgs() {
 957  52
                 return List.<JCExpression>nil();
 958  
             }
 959  
         }).doit();
 960  
     }
 961  
 
 962  
     @Override
 963  
     public void visitConditional(final JCConditional tree) {
 964  18
         Type targetType = targetType(tree.type);
 965  18
         result = makeBoundConditional(tree.pos(),
 966  
                 targetType,
 967  
                 translate(tree.getTrueExpression(), targetType),
 968  
                 translate(tree.getFalseExpression(), targetType),
 969  
                 translate(tree.getCondition()) );
 970  18
     }
 971  
 
 972  
     @Override
 973  
     public void visitParens(JCParens tree) { //done
 974  0
         JCExpression expr = translate(tree.expr);
 975  0
         result = make.at(tree.pos).Parens(expr);
 976  0
     }
 977  
 
 978  
     @Override
 979  
     public void visitTypeTest(final JCInstanceOf tree) {
 980  5
         result = new BindingExpressionClosureTranslator(tree.pos(), tree.type) {
 981  
 
 982  
             protected JCExpression resultValue() {
 983  5
                 return m().TypeTest(
 984  
                         buildArgField(translate(tree.expr), tree.expr.type, "toTest"),
 985  
                         makeExpression(tree.clazz.type) );
 986  
             }
 987  
         }.doit();
 988  5
     }
 989  
 
 990  
     @Override
 991  
     public void visitTypeCast(final JCTypeCast tree) {
 992  6
         result = new BindingExpressionClosureTranslator(tree.pos(), tree.type) {
 993  
 
 994  
            protected JCExpression resultValue() {
 995  6
                 return new TypeCastTranslator(tree, toJava) {
 996  
 
 997  
                     protected JCExpression translatedExpr() {
 998  6
                         return buildArgField(translate(tree.expr), tree.expr.type, "toBeCast");
 999  
                     }
 1000  
                 }.doit();
 1001  
             }
 1002  
         }.doit();
 1003  6
     }
 1004  
 
 1005  
     @Override
 1006  
     public void visitLiteral(JCLiteral tree) {
 1007  209
         final DiagnosticPosition diagPos = tree.pos();
 1008  209
         if (tree.typetag == TypeTags.BOT && types.isSequence(tree.type)) {
 1009  0
             Type elemType = types.elementType(targetType(tree.type));
 1010  0
             result = runtime(diagPos, cBoundSequences, "empty", List.of(makeElementClassObject(diagPos, elemType)));
 1011  0
         } else {
 1012  209
             JCExpression unbound = make.at(diagPos).Literal(tree.typetag, tree.value);
 1013  209
             result = makeConstantLocation(diagPos, targetType(tree.type), unbound);
 1014  
         }
 1015  209
     }
 1016  
 
 1017  
     /**
 1018  
      * Translator for Java method and non-bound JavaFX functions.
 1019  
      */
 1020  0
     abstract class BindingExpressionClosureTranslator extends ClosureTranslator {
 1021  
 
 1022  153
         BindingExpressionClosureTranslator(DiagnosticPosition diagPos, Type resultType) {
 1023  153
             super(diagPos, resultType);
 1024  153
         }
 1025  
 
 1026  
         protected abstract JCExpression resultValue();
 1027  
 
 1028  
         protected void buildFields() {
 1029  
             // by default do this dynamically
 1030  89
         }
 1031  
 
 1032  
         protected List<JCTree> makeBody() {
 1033  153
             buildFields();
 1034  153
             JCExpression resultVal = resultValue(); // build first since this may add dependencies
 1035  
 
 1036  
             // create a getStaticDependents method to set the args as static dependents
 1037  153
             Type locationType = typeMorpher.baseLocation.type;
 1038  153
             JCExpression depsArray = make.NewArray(makeExpression(locationType), List.<JCExpression>nil(), dependents.toList());
 1039  153
             Type depsReturnType = new Type.ArrayType(locationType, syms.arrayClass);
 1040  153
             members.append(makeClosureMethod("getStaticDependents", depsArray, null, depsReturnType, Flags.PROTECTED));
 1041  
 
 1042  153
             members.append(makeClosureMethod("computeValue", resultVal, null, tmiResult.getRealFXType(), Flags.PUBLIC));
 1043  153
             return completeMembers();
 1044  
         }
 1045  
 
 1046  
         protected JCExpression makeBaseClass() {
 1047  153
             Type clazzType = typeMorpher.bindingExpressionType(typeKindResult);
 1048  153
             return makeBaseClass(clazzType, null);
 1049  
         }
 1050  
 
 1051  
         protected List<JCExpression> makeConstructorArgs() {
 1052  153
             return List.<JCExpression>nil();
 1053  
         }
 1054  
 
 1055  
         @Override
 1056  
         protected JCExpression doit() {
 1057  153
             return makeLocationLocalVariable(tmiResult, diagPos, List.of(makeLaziness(diagPos), buildClosure()));
 1058  
         }
 1059  
     }
 1060  
 
 1061  
     @Override
 1062  
     public void visitApply(final JCMethodInvocation tree) {
 1063  98
         result = (new FunctionCallTranslator(tree, toJava) {
 1064  
 
 1065  98
             final List<JCExpression> typeArgs = toJava.translate(tree.typeargs); //TODO: should, I think, be nil list
 1066  98
             final List<JCExpression> targs = translate(tree.args, meth.type, superToStatic, usesVarArgs);
 1067  
 
 1068  
             public JCExpression doit() {
 1069  98
                 if (callBound) {
 1070  34
                     if (selectorMutable) {
 1071  26
                         return makeBoundSelect(diagPos,
 1072  
                                 tree.type,
 1073  
                                 translate(selector),
 1074  26
                                 new Function1ClosureTranslator(diagPos, tree.type, selector.type) {
 1075  
 
 1076  
                                     protected JCExpression makeInvokeMethodBody() {
 1077  
                                         // create a field in the closure for each argument
 1078  26
                                         buildArgFields(targs, true);
 1079  
 
 1080  
                                         // translate the method name -- e.g., foo  to foo$bound
 1081  26
                                         Name name = functionName(msym, false, callBound);
 1082  
 
 1083  
                                         // selectors are always Objects
 1084  26
                                         JCExpression transSelect = makeGet(translate(selector), TYPE_KIND_OBJECT);
 1085  26
                                         JCExpression expr = m().Apply(typeArgs,
 1086  
                                                 m().Select(transSelect, name),
 1087  
                                                 callArgs.toList());
 1088  26
                                         return convert(tree.type, expr); // convert type, if needed
 1089  
                                     }
 1090  
                                 });
 1091  
                     } else {
 1092  8
                         return convert(tree.type, m().Apply(typeArgs, transMeth(), targs));
 1093  
                     }
 1094  
                 } else {
 1095  
                     // call to Java method or unbound JavaFX function
 1096  
                     //TODO: varargs
 1097  64
                     if (selectorMutable) {
 1098  11
                         return (new BindingExpressionClosureTranslator(diagPos, tree.type) {
 1099  
 
 1100  11
                             private TypeMorphInfo tmiSelector = typeMorpher.typeMorphInfo(selector.type);
 1101  11
                             private Name selectorName = getSyntheticName("selector");
 1102  
 
 1103  
                             protected JCExpression resultValue() {
 1104  
                                 // access the selector field for the method call-- selector$.get()
 1105  
                                 // selectors are always Objects
 1106  11
                                 JCExpression transSelector = makeGetField(selectorName, TYPE_KIND_OBJECT);
 1107  
 
 1108  
                                 // construct the actuall method invocation
 1109  11
                                 Name methName = ((JCFieldAccess) tree.meth).name;
 1110  11
                                 JCExpression callMeth = m().Select(transSelector, methName);
 1111  11
                                 JCExpression call = m().Apply(typeArgs, callMeth, callArgs.toList());
 1112  
 
 1113  11
                                 if (tmiSelector.getTypeKind() == TYPE_KIND_OBJECT) {
 1114  
                                     // create another access to the selector field for the null test (below)
 1115  5
                                     JCExpression toTest = makeGetField(selectorName, TYPE_KIND_OBJECT);
 1116  
                                     // test the selector for null before attempting to invoke the method
 1117  
                                     // if it would dereference null, then instead give the default value
 1118  5
                                     JCExpression cond = m().Binary(JCTree.NE, toTest, make.Literal(TypeTags.BOT, null));
 1119  5
                                     JCExpression defaultExpr = makeDefaultValue(diagPos, tmiResult);
 1120  5
                                     return m().Conditional(cond, call, defaultExpr);
 1121  
                                 } else {
 1122  6
                                     return call;
 1123  
                                 }
 1124  
                             }
 1125  
 
 1126  
                             @Override
 1127  
                             protected void buildFields() {
 1128  
                                 // create a field in the BindingExpression for each argument
 1129  11
                                 buildArgFields(targs, false);
 1130  
 
 1131  
                                 // translate the method selector into a Location field of the BindingExpression
 1132  
                                 // XxxLocation selector$ = ...;
 1133  11
                                 buildArgField(translate(selector), selector.type, selectorName.toString());
 1134  11
                             }
 1135  
                         }).doit();
 1136  
                     } else {
 1137  53
                         return (new BindingExpressionClosureTranslator(diagPos, tree.type) {
 1138  
 
 1139  
                             // construct the actual value computing method (with the method call)
 1140  
                             protected JCExpression resultValue() {
 1141  53
                                 return m().Apply(toJava.translate(tree.typeargs), transMeth(), callArgs.toList());
 1142  
                             }
 1143  
 
 1144  
                             @Override
 1145  
                             protected void buildFields() {
 1146  
                                 // create a field in the BindingExpression for each argument
 1147  53
                                 buildArgFields(targs, false);
 1148  53
                             }
 1149  
                         }).doit();
 1150  
                     }
 1151  
                 }
 1152  
             }
 1153  
 
 1154  
             public JCExpression transMeth() {
 1155  
                 JCExpression transMeth;
 1156  61
                 if (renameToSuper) {
 1157  0
                     transMeth = make.at(selector).Select(make.Select(makeTypeTree( selector,attrEnv.enclClass.sym.type, false), names._super), msym);
 1158  
                 } else {
 1159  61
                     transMeth = toJava.translate(meth);
 1160  
                 }
 1161  
 
 1162  
                 // translate the method name -- e.g., foo  to foo$bound or foo$impl
 1163  
                 //TODO: this is a paranoid cloning of the below -- integrate this
 1164  61
                 if (superToStatic) {
 1165  2
                     Name name = functionName(msym, superToStatic, callBound);
 1166  2
                     if (transMeth.getTag() == JavafxTag.IDENT) {
 1167  0
                         transMeth = m().Ident(name);
 1168  2
                     } else if (transMeth.getTag() == JavafxTag.SELECT) {
 1169  2
                         transMeth = m().Select(makeTypeTree(diagPos, msym.owner.type, false), name);
 1170  
                     }
 1171  2
                 } else 
 1172  59
                 if (callBound && ! renameToSuper) {
 1173  6
                     Name name = functionName(msym, superToStatic, callBound);
 1174  6
                     if (transMeth.getTag() == JavafxTag.IDENT) {
 1175  0
                         transMeth = m().Ident(name);
 1176  6
                     } else if (transMeth.getTag() == JavafxTag.SELECT) {
 1177  6
                         JCFieldAccess faccess = (JCFieldAccess) transMeth;
 1178  6
                         transMeth = m().Select(faccess.getExpression(), name);
 1179  
                     }
 1180  
                 }
 1181  61
                 if (useInvoke) {
 1182  0
                     transMeth = make.Select(transMeth, defs.invokeName);
 1183  
                 }
 1184  61
                 return transMeth;
 1185  
             }
 1186  
         }).doit();
 1187  98
     }
 1188  
 
 1189  
     @Override
 1190  
     public void visitBinary(final JCBinary tree) {
 1191  100
         DiagnosticPosition diagPos = tree.pos();
 1192  100
         final JCExpression l = tree.lhs;
 1193  100
         final JCExpression r = tree.rhs;
 1194  100
         final JCExpression lhs = translate(l);
 1195  100
         final JCExpression rhs = translate(r);
 1196  100
         final String typeCode = typeCode(l.type) + typeCode(r.type);
 1197  
         JCExpression res;
 1198  
 
 1199  100
         switch (tree.getTag()) {
 1200  
             case JavafxTag.PLUS:
 1201  18
                 res = runtime(diagPos, cBoundOperators, "plus_" + typeCode, List.of(lhs, rhs));
 1202  18
                 break;
 1203  
             case JavafxTag.MINUS:
 1204  10
                 res = runtime(diagPos, cBoundOperators, "minus_" + typeCode, List.of(lhs, rhs));
 1205  10
                 break;
 1206  
             case JavafxTag.DIV:
 1207  17
                 res = runtime(diagPos, cBoundOperators, "divide_" + typeCode, List.of(lhs, rhs));
 1208  17
                 break;
 1209  
             case JavafxTag.MUL:
 1210  30
                 res = runtime(diagPos, cBoundOperators, "times_" + typeCode, List.of(lhs, rhs));
 1211  30
                 break;
 1212  
             case JavafxTag.MOD:
 1213  7
                 res = runtime(diagPos, cBoundOperators, "modulo_" + typeCode, List.of(lhs, rhs));
 1214  7
                 break;
 1215  
             case JavafxTag.EQ:
 1216  9
                 res = runtime(diagPos, cBoundOperators, "eq_" + typeCode, List.of(lhs, rhs));
 1217  9
                 break;
 1218  
             case JavafxTag.NE:
 1219  3
                 res = runtime(diagPos, cBoundOperators, "ne_" + typeCode, List.of(lhs, rhs));
 1220  3
                 break;
 1221  
             case JavafxTag.LT:
 1222  5
                 res = runtime(diagPos, cBoundOperators, "lt_" + typeCode, List.of(lhs, rhs));
 1223  5
                 break;
 1224  
             case JavafxTag.LE:
 1225  0
                 res = runtime(diagPos, cBoundOperators, "le_" + typeCode, List.of(lhs, rhs));
 1226  0
                 break;
 1227  
             case JavafxTag.GT:
 1228  0
                 res = runtime(diagPos, cBoundOperators, "gt_" + typeCode, List.of(lhs, rhs));
 1229  0
                 break;
 1230  
             case JavafxTag.GE:
 1231  0
                 res = runtime(diagPos, cBoundOperators, "ge_" + typeCode, List.of(lhs, rhs));
 1232  0
                 break;
 1233  
             case JavafxTag.AND:
 1234  1
                 res = runtime(diagPos, cBoundOperators, "and_" + typeCode, List.of(lhs, rhs));
 1235  1
                 break;
 1236  
             case JavafxTag.OR:
 1237  0
                 res = runtime(diagPos, cBoundOperators, "or_" + typeCode, List.of(lhs, rhs));
 1238  0
                 break;
 1239  
             default:
 1240  0
                 assert false : "unhandled binary operator";
 1241  0
                 res = lhs;
 1242  
                 break;
 1243  
         }
 1244  100
         result = convert(tree.type, res);
 1245  100
     }
 1246  
 
 1247  
     @Override
 1248  
     public void visitUnary(final JCUnary tree) {
 1249  4
         DiagnosticPosition diagPos = tree.pos();
 1250  4
         JCExpression expr = tree.getExpression();
 1251  4
         JCExpression transExpr = translate(expr);
 1252  4
         String typeCode = typeCode(expr.type);
 1253  
         JCExpression res;
 1254  
 
 1255  4
         switch (tree.getTag()) {
 1256  
             case JavafxTag.SIZEOF:
 1257  0
                 res = runtime(diagPos, cBoundSequences, "sizeof", List.of(transExpr) );
 1258  0
                 break;
 1259  
             case JavafxTag.REVERSE:
 1260  0
                 res = runtime(diagPos, cBoundSequences, "reverse", List.of(transExpr) );
 1261  0
                 break;
 1262  
             case JCTree.NOT:
 1263  2
                 res = runtime(diagPos, cBoundOperators, "not_"+typeCode, List.of(transExpr) );
 1264  2
                 break;
 1265  
             case JCTree.NEG:
 1266  2
                 if (types.isSameType(tree.type, syms.javafx_DurationType)) {   //TODO
 1267  0
                     res = make.at(diagPos).Apply(null,
 1268  
                             make.at(diagPos).Select(translate(tree.arg), Name.fromString(names, "negate")), List.<JCExpression>nil());
 1269  
                 } else {
 1270  2
                     res = runtime(diagPos, cBoundOperators, "negate_"+typeCode, List.of(transExpr));
 1271  
                 }
 1272  2
                 break;
 1273  
             case JCTree.PREINC:
 1274  0
                 log.error(tree.pos(), MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, "++");
 1275  0
                 res = transExpr;
 1276  0
                 break;
 1277  
             case JCTree.PREDEC:
 1278  0
                 log.error(tree.pos(), MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, "--");
 1279  0
                 res = transExpr;
 1280  0
                 break;
 1281  
             case JCTree.POSTINC:
 1282  0
                 log.error(tree.pos(), MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, "++");
 1283  0
                 res = transExpr;
 1284  0
                 break;
 1285  
             case JCTree.POSTDEC:
 1286  0
                 log.error(tree.pos(), MsgSym.MESSAGE_JAVAFX_NOT_ALLOWED_IN_BIND_CONTEXT, "--");
 1287  0
                 res = transExpr;
 1288  0
                 break;
 1289  
             default:
 1290  0
                 assert false : "unhandled unary operator";
 1291  0
                 res = transExpr;
 1292  
                 break;
 1293  
         }
 1294  4
         result = convert(tree.type, res);
 1295  4
     }
 1296  
 
 1297  
     public void visitTimeLiteral(JFXTimeLiteral tree) {
 1298  
         // convert time literal to a javafx.lang.Duration object literal
 1299  1
         JCFieldAccess clsname = (JCFieldAccess) makeQualifiedTree(tree.pos(), syms.javafx_DurationType.tsym.toString());
 1300  1
         clsname.type = syms.javafx_DurationType;
 1301  1
         clsname.sym = syms.javafx_DurationType.tsym;
 1302  1
         Name attribute = names.fromString("millis");
 1303  1
         Symbol symMillis = clsname.sym.members().lookup(attribute).sym;
 1304  1
         JFXObjectLiteralPart objLiteral = fxmake.at(tree.pos()).ObjectLiteralPart(attribute, tree.value, JavafxBindStatus.UNBOUND);
 1305  1
         objLiteral.sym = symMillis;
 1306  1
         JFXInstanciate inst = fxmake.at(tree.pos).Instanciate(clsname, null, List.of((JCTree)objLiteral));
 1307  1
         inst.type = clsname.type;
 1308  
 
 1309  
         // now convert that object literal to Java
 1310  1
         visitInstanciate(inst); // sets result
 1311  1
     }
 1312  
 
 1313  
     /**
 1314  
      * The component parts are bound even in the normal case, so translate as normal.
 1315  
      * But return a Location.
 1316  
      */
 1317  
     public void visitInterpolateValue(JFXInterpolateValue tree) {
 1318  1
         result = toJava.translate(tree, Wrapped.InLocation);
 1319  1
     }
 1320  
 
 1321  
     /***********************************************************************
 1322  
      *
 1323  
      * Utilities
 1324  
      *
 1325  
      */
 1326  
 
 1327  
 
 1328  
     private String typeCode(Type type) {
 1329  204
         Symbol tsym = type.tsym;
 1330  204
                 if (type.isPrimitive()) {
 1331  196
                     if (tsym == syms.doubleType.tsym
 1332  
                             || tsym == syms.floatType.tsym) {
 1333  74
                         return "d";
 1334  122
                     } else if (tsym == syms.intType.tsym
 1335  
                             || tsym == syms.byteType.tsym
 1336  
                             || tsym == syms.charType.tsym
 1337  
                             || tsym == syms.longType.tsym
 1338  
                             || tsym == syms.shortType.tsym) {
 1339  118
                         return "i";
 1340  4
                     } else if (tsym == syms.booleanType.tsym) {
 1341  4
                         return "b";
 1342  
                     } else {
 1343  0
                         assert false : "should not reach here";
 1344  0
                         return "X";
 1345  
                     }
 1346  
                 } else {
 1347  8
                     if (types.isSequence(type) ) {
 1348  0
                         return "s";  //TODO: ?
 1349  8
                     } else if (tsym == this.booleanObjectTypeSymbol) {
 1350  0
                         return "B";
 1351  8
                     } else if (tsym == this.doubleObjectTypeSymbol) {
 1352  0
                         return "D";
 1353  8
                     } else if (tsym == this.intObjectTypeSymbol) {
 1354  0
                         return "I";
 1355  
                     } else {
 1356  8
                         return "o";
 1357  
                     }
 1358  
                 }
 1359  
     }
 1360  
 
 1361  
     protected String getSyntheticPrefix() {
 1362  12
         return "bfx$";
 1363  
     }
 1364  
     
 1365  
     /***********************************************************************
 1366  
      *
 1367  
      * Moot visitors
 1368  
      *
 1369  
      */
 1370  
 
 1371  
     public void visitInterpolate(JFXInterpolate tree) {
 1372  0
         assert false : "not yet implemented";
 1373  0
     }
 1374  
 
 1375  
     @Override
 1376  
     public void visitForExpressionInClause(JFXForExpressionInClause that) {
 1377  0
         assert false : "should be processed by parent tree";
 1378  0
     }
 1379  
 
 1380  
     @Override
 1381  
     public void visitModifiers(JCModifiers tree) {
 1382  0
         assert false : "should not be processed as part of a binding";
 1383  0
     }
 1384  
 
 1385  
     @Override
 1386  
     public void visitNewArray(JCNewArray tree) {
 1387  0
         assert false : "should not be in JavaFX AST";
 1388  0
     }
 1389  
 
 1390  
     @Override
 1391  
     public void visitNewClass(JCNewClass tree) {
 1392  0
         assert false : "should not be in JavaFX AST";
 1393  0
     }
 1394  
 
 1395  
     @Override
 1396  
     public void visitSkip(JCSkip tree) {
 1397  0
         assert false : "should not be processed as part of a binding";
 1398  0
     }
 1399  
 
 1400  
     @Override
 1401  
     public void visitSwitch(JCSwitch tree) {
 1402  0
         assert false : "should not be in JavaFX AST";
 1403  0
     }
 1404  
 
 1405  
     @Override
 1406  
     public void visitSynchronized(JCSynchronized tree) {
 1407  0
         assert false : "should not be in JavaFX AST";
 1408  0
     }
 1409  
 
 1410  
     @Override
 1411  
     public void visitThrow(JCThrow tree) {
 1412  0
         assert false : "should not be processed as part of a binding";
 1413  0
     }
 1414  
 
 1415  
     @Override
 1416  
     public void visitTry(JCTry tree) {
 1417  0
         assert false : "should not be processed as part of a binding";
 1418  0
     }
 1419  
 
 1420  
     @Override
 1421  
     public void visitVarDef(JCVariableDecl tree) {
 1422  0
         assert false : "should not be in JavaFX AST";
 1423  0
     }
 1424  
 
 1425  
     @Override
 1426  
     public void visitWhileLoop(JCWhileLoop tree) {
 1427  0
         assert false : "should not be processed as part of a binding";
 1428  0
     }
 1429  
 
 1430  
     @Override
 1431  
     public void visitLetExpr(LetExpr tree) {
 1432  0
         assert false : "should not be in JavaFX AST";
 1433  0
     }
 1434  
 
 1435  
     @Override
 1436  
     public void visitTree(JCTree tree) {
 1437  0
         assert false : "should not be in JavaFX AST";
 1438  0
     }
 1439  
 
 1440  
     @Override
 1441  
     public void visitOverrideAttribute(JFXOverrideAttribute tree) {
 1442  0
         assert false : "should not be processed as part of a binding";
 1443  0
     }
 1444  
 
 1445  
     @Override
 1446  
     public void visitOnReplace(JFXOnReplace tree) {
 1447  0
         assert false : "should not be processed as part of a binding";
 1448  0
     }
 1449  
 
 1450  
 
 1451  
     @Override
 1452  
     public void visitTopLevel(JCCompilationUnit tree) {
 1453  0
         assert false : "should not be processed as part of a binding";
 1454  0
    }
 1455  
 
 1456  
     @Override
 1457  
     public void visitClassDeclaration(JFXClassDeclaration tree) {
 1458  0
         assert false : "should not be processed as part of a binding";
 1459  0
     }
 1460  
 
 1461  
     @Override
 1462  
     public void visitInitDefinition(JFXInitDefinition tree) {
 1463  0
         assert false : "should not be processed as part of a binding";
 1464  0
     }
 1465  
 
 1466  
     public void visitPostInitDefinition(JFXPostInitDefinition tree) {
 1467  0
         assert false : "should not be processed as part of a binding";
 1468  0
     }
 1469  
 
 1470  
    @Override
 1471  
     public void visitFunctionDefinition(JFXFunctionDefinition tree) {
 1472  0
         assert false : "should not be processed as part of a binding";
 1473  0
     }
 1474  
 
 1475  
     public void visitBindExpression(JFXBindExpression tree) {
 1476  0
         assert false : "should not be processed as part of a binding";
 1477  0
     }
 1478  
 
 1479  
     @Override
 1480  
     public void visitBlock(JCBlock tree) {
 1481  0
         assert false : "should not be processed as part of a binding";
 1482  0
     }
 1483  
 
 1484  
     @Override
 1485  
     public void visitSequenceInsert(JFXSequenceInsert tree) {
 1486  0
         assert false : "should not be processed as part of a binding";
 1487  0
     }
 1488  
 
 1489  
     @Override
 1490  
     public void visitSequenceDelete(JFXSequenceDelete tree) {
 1491  0
         assert false : "should not be processed as part of a binding";
 1492  0
     }
 1493  
 
 1494  
     @Override
 1495  
     public void visitContinue(JCContinue tree) {
 1496  0
         assert false : "should not be processed as part of a binding";
 1497  0
     }
 1498  
 
 1499  
     @Override
 1500  
     public void visitDoLoop(JCDoWhileLoop tree) {
 1501  0
         assert false : "should not be in JavaFX AST";
 1502  0
     }
 1503  
 
 1504  
     @Override
 1505  
     public void visitReturn(JCReturn tree) {
 1506  0
         assert false : "should not be processed as part of a binding";
 1507  0
     }
 1508  
 
 1509  
     @Override
 1510  
     public void visitExec(JCExpressionStatement tree) {
 1511  0
         assert false : "should not be processed as part of a binding";
 1512  0
     }
 1513  
 
 1514  
     @Override
 1515  
     public void visitForeachLoop(JCEnhancedForLoop tree) {
 1516  0
         assert false : "should not be in JavaFX AST";
 1517  0
     }
 1518  
 
 1519  
     @Override
 1520  
     public void visitForLoop(JCForLoop tree) {
 1521  0
         assert false : "should not be in JavaFX AST";
 1522  0
     }
 1523  
 
 1524  
     @Override
 1525  
     public void visitIf(JCIf tree) {
 1526  0
         assert false : "should not be in JavaFX AST";
 1527  0
     }
 1528  
 
 1529  
     @Override
 1530  
     public void visitImport(JCImport tree) {
 1531  0
         assert false : "should not be processed as part of a binding";
 1532  0
     }
 1533  
 
 1534  
     @Override
 1535  
     public void visitIndexed(JCArrayAccess tree) {
 1536  0
         assert false : "should not be in JavaFX AST";
 1537  0
     }
 1538  
 
 1539  
     @Override
 1540  
     public void visitTypeArray(JCArrayTypeTree tree) {
 1541  0
         assert false : "should not be in JavaFX AST";
 1542  0
     }
 1543  
 
 1544  
     @Override
 1545  
     public void visitTypeBoundKind(TypeBoundKind tree) {
 1546  0
         assert false : "should not be in JavaFX AST";
 1547  0
     }
 1548  
 
 1549  
     @Override
 1550  
     public void visitLabelled(JCLabeledStatement tree) {
 1551  0
         assert false : "should not be in JavaFX AST";
 1552  0
     }
 1553  
 
 1554  
     @Override
 1555  
     public void visitMethodDef(JCMethodDecl tree) {
 1556  0
          assert false : "should not be in JavaFX AST";
 1557  0
     }
 1558  
 
 1559  
     @Override
 1560  
     public void visitTypeApply(JCTypeApply tree) {
 1561  0
         assert false : "should not be processed as part of a binding";
 1562  0
     }
 1563  
 
 1564  
     @Override
 1565  
     public void visitTypeIdent(JCPrimitiveTypeTree tree) {
 1566  0
         assert false : "should not be processed as part of a binding";
 1567  0
     }
 1568  
 
 1569  
     @Override
 1570  
     public void visitTypeParameter(JCTypeParameter tree) {
 1571  0
         assert false : "should not be processed as part of a binding";
 1572  0
     }
 1573  
 
 1574  
     @Override
 1575  
     public void visitAnnotation(JCAnnotation tree) {
 1576  0
         assert false : "should not be processed as part of a binding";
 1577  0
     }
 1578  
 
 1579  
     @Override
 1580  
     public void visitAssert(JCAssert tree) {
 1581  0
         assert false : "should not be processed as part of a binding";
 1582  0
     }
 1583  
 
 1584  
     @Override
 1585  
     public void visitBreak(JCBreak tree) {
 1586  0
         assert false : "should not be processed as part of a binding";
 1587  0
     }
 1588  
 
 1589  
     @Override
 1590  
    public void visitCase(JCCase tree) {
 1591  0
         assert false : "should not be in JavaFX AST";
 1592  0
     }
 1593  
 
 1594  
     @Override
 1595  
     public void visitCatch(JCCatch tree) {
 1596  0
         assert false : "should not be processed as part of a binding";
 1597  0
     }
 1598  
 
 1599  
     @Override
 1600  
     public void visitClassDef(JCClassDecl tree) {
 1601  0
         assert false : "should not be in JavaFX AST";
 1602  0
     }
 1603  
 
 1604  
     @Override
 1605  
     public void visitWildcard(JCWildcard tree) {
 1606  0
         assert false : "should not be processed as part of a binding";
 1607  0
     }
 1608  
 
 1609  
     @Override
 1610  
     public void visitSetAttributeToObjectBeingInitialized(JFXSetAttributeToObjectBeingInitialized that) {
 1611  0
         assert false : "not yet implemented";
 1612  0
     }
 1613  
 
 1614  
     @Override
 1615  
     public void visitTypeAny(JFXTypeAny that) {
 1616  0
         assert false : "should not be processed as part of a binding";
 1617  0
     }
 1618  
 
 1619  
     @Override
 1620  
     public void visitTypeClass(JFXTypeClass that) {
 1621  0
         assert false : "should not be processed as part of a binding";
 1622  0
     }
 1623  
 
 1624  
     @Override
 1625  
     public void visitTypeFunctional(JFXTypeFunctional that) {
 1626  0
         assert false : "should not be processed as part of a binding";
 1627  0
     }
 1628  
 
 1629  
     @Override
 1630  
     public void visitTypeUnknown(JFXTypeUnknown that) {
 1631  0
         assert false : "should not be processed as part of a binding";
 1632  0
     }
 1633  
 
 1634  
     @Override
 1635  
     public void visitObjectLiteralPart(JFXObjectLiteralPart that) {
 1636  0
         assert false : "should not be processed as part of a binding";
 1637  0
     }
 1638  
 
 1639  
     @Override
 1640  
     public void visitVar(JFXVar tree) {
 1641  
         // this is handled in translarVar
 1642  0
         assert false : "should not be processed as part of a binding";
 1643  0
     }
 1644  
 
 1645  
     @Override
 1646  
     public void visitKeyFrameLiteral(JFXKeyFrameLiteral tree) {
 1647  0
         assert false : "should not be processed as part of a binding";
 1648  0
     }
 1649  
 
 1650  
     @Override
 1651  
     public void visitErroneous(JCErroneous tree) {
 1652  0
         assert false : "erroneous nodes shouldn't have gotten this far";
 1653  0
     }
 1654  
 }