Class Expression

    • Field Detail

      • bindingStatement

        public transient Statement bindingStatement
      • nestedBinding

        public transient boolean nestedBinding
      • replacedByStatement

        public transient Statement replacedByStatement
      • inactive

        public transient boolean inactive
        Set this to true on an expression to disable it - it won't resolve itself during start
      • UnknownReferredType

        public static final java.lang.String UnknownReferredType
        See Also:
        Constant Field Values
    • Constructor Detail

      • Expression

        public Expression()
    • Method Detail

      • parse

        public static Expression parse​(java.lang.String expressionStr)
      • createFromValue

        public static Expression createFromValue​(java.lang.Object literalValue,
                                                 boolean isInitializer)
      • evalLong

        public long evalLong​(java.lang.Class expectedType,
                             ExecutionContext ctx)
      • evalDouble

        public double evalDouble​(java.lang.Class expectedType,
                                 ExecutionContext ctx)
      • setAssignment

        public void setAssignment​(boolean assign)
        Only needed for expressions that are the left hand side of the equals sign
      • needsSetMethod

        public boolean needsSetMethod()
      • convertToSetMethod

        public void convertToSetMethod​(Expression arg)
        Only needed for expressions that are the left hand side of the equals sign
      • setValue

        public void setValue​(java.lang.Object value,
                             ExecutionContext ctx)
      • getRuntimeClass

        public java.lang.Class getRuntimeClass()
      • setBindingInfo

        public void setBindingInfo​(BindingDirection dir,
                                   Statement dest,
                                   boolean nested)
        BindingDirection only set if this is a top-level binding
      • applyJSConversion

        public Expression applyJSConversion​(java.lang.Object paramType)
      • producesHtml

        public boolean producesHtml()
      • evalBinding

        public java.lang.Object evalBinding​(java.lang.Class expectedType,
                                            ExecutionContext ctx)
      • initBinding

        public java.lang.Object initBinding​(java.lang.Class expectedType,
                                            ExecutionContext ctx)
      • evalBindingArgs

        public void evalBindingArgs​(java.util.List<java.lang.Object> bindArgs,
                                    boolean isStatic,
                                    java.lang.Class expectedType,
                                    ExecutionContext ctx)
      • getBindingTypeName

        public java.lang.String getBindingTypeName()
        Subclasses override this to return the class name to use for the binding expression
      • transformBinding

        public void transformBinding​(ILanguageModel.RuntimeType runtime)
        From "a.b.c" to: Bind.bind(<enclosingObject or class>, boundFieldName,
      • createBindingParameters

        public Expression createBindingParameters​(boolean includesProps,
                                                  Expression... bindingParams)
        When we are transforming a nested expression, this method takes the set of chained expressions and produces an expression to use as the IBinding[] boundParams argument to create the binding.
      • evalBindingParametersWithThis

        public IBinding[] evalBindingParametersWithThis​(java.lang.Object thisObj,
                                                        java.lang.Class expectedType,
                                                        ExecutionContext ctx,
                                                        Expression... bindingParams)
      • transformBindingArgs

        public void transformBindingArgs​(SemanticNodeList<Expression> bindArgs,
      • isConstant

        public boolean isConstant()
      • isDeclaredConstant

        public boolean isDeclaredConstant()
        This is like isConstant but does not "start" anything so you can use it during initialization
      • isReferenceInitializer

        public boolean isReferenceInitializer()
      • isSimpleReference

        public boolean isSimpleReference()
      • inNamedPropertyMethod

        protected boolean inNamedPropertyMethod​(java.lang.String identifier)
      • inPropertyMethodForDef

        protected boolean inPropertyMethodForDef​(java.lang.Object def)
      • inObjectGetMethod

        protected boolean inObjectGetMethod​(java.lang.Object newType)
        Returns true this expression is defined in a method which makes up a getX method for an object of the type being newed. Because we do not generate classes for simple inner types, the newType passed has to be the runtime class used in the new expression for this objects type.
      • getAbsoluteGenericTypeName

        public java.lang.String getAbsoluteGenericTypeName​(java.lang.Object resultType,
                                                           boolean includeDims)
        Specified by:
        getAbsoluteGenericTypeName in interface ITypedObject
      • getGenericTypeName

        public java.lang.String getGenericTypeName​(java.lang.Object resultType,
                                                   boolean includeDims)
        Specified by:
        getGenericTypeName in interface ITypedObject
      • getGenericType

        public java.lang.Object getGenericType()
      • getGenericArgumentType

        public java.lang.Object getGenericArgumentType()
      • getParentReferenceType

        public java.lang.Object getParentReferenceType()
        Only implemented for subclasses that can return needsSetMethod=true. For "a.b.c" returns the type of "a.b"
      • getReferencePropertyName

        public java.lang.String getReferencePropertyName()
        Only implemented for subclasses that can return needsSetMethod=true. For "a.b.c" returns "c"
      • getParentReferenceTypeExpression

        public Expression getParentReferenceTypeExpression()
        Only implemented for subclasses that can return needsSetMethod=true. For "a.b.c" returns an expr for "a.b"
      • toString

        public java.lang.String toString()
        toString in class java.lang.Object
      • getLHSAssignmentTyped

        public boolean getLHSAssignmentTyped()
      • isStaticTarget

        public abstract boolean isStaticTarget()
      • canMakeBindable

        public boolean canMakeBindable()
      • changeToRHS

        public void changeToRHS()
        Called when we are moving an expression from the left to the right hand side.
      • needsParenWrapper

        public boolean needsParenWrapper()
        Does this expression need a paren wrapper to be combined with an artithmetic operation
      • addChildBodyStatements

        public void addChildBodyStatements​(java.util.List<java.lang.Object> res)
        addChildBodyStatements in class Statement
      • deepCopy

        public Expression deepCopy​(int options,
                                   java.util.IdentityHashMap<java.lang.Object,​java.lang.Object> oldNewMap)
        Description copied from interface: ISemanticNode
        Performs a deep copy of the semantic node tree. Subclasses should do their own copy implementation to decide what else to copy. Uses the copy options flags above. The default, with 0, just copies the semantic node information so you get a new tree like's it parsed but without parse node info. Use that mode only if you want to throw away the original source and regenerate it all from scratch. Otherwise, you can copy the parse tree as well. If you want to copy the semantic node's initial resolved state - including it's init/start, etc. and whatever the subclass adds to that copy, use CopyState or CopyNormal - for both parse nodes and state.
        Specified by:
        deepCopy in interface ISemanticNode
        deepCopy in class Statement
      • formatExprToJS

        public java.lang.CharSequence formatExprToJS()
      • isInferredFinal

        public boolean isInferredFinal()
      • setInferredType

        public boolean setInferredType​(java.lang.Object type,
                                       boolean finalType)
        Called once for each parent-child expression relationship during the start process to propagate the parent's inferredType to the child as we walk up the expression tree so that, for example, we know the initial information in the parameter type so we can find the right method, so the method's parameter types further refine types of the args. The last time we call it, finalType is set to true. When an error occurs and the type becomes "unknown" - we call this with type = UnknownReferredType and finalType =true
      • propagatesInferredType

        public boolean propagatesInferredType​(Expression child)
      • hasInferredType

        public boolean hasInferredType()
      • getMethodTypeArguments

        public java.util.List<JavaType> getMethodTypeArguments()
      • clearInferredType

        public void clearInferredType()
      • isInferredSet

        public boolean isInferredSet()
      • isVoidType

        public boolean isVoidType()
      • createImportedIdentExpr

        public IdentifierExpression createImportedIdentExpr​(java.lang.String typeName,
                                                            java.lang.String methName)
        Provide full type name and method name - returns an IdentifierExpression to use for a method call but where you need to fill in the arguments later. If possible, an existing import is used to shorten the generated code.
      • isSettableExpr

        public boolean isSettableExpr()
      • getUnwrappedExpr

        public Expression getUnwrappedExpr()