< prev index next >

src/jdk/nashorn/internal/ir/FunctionNode.java

Print this page
rev 1338 : 8066222: too strong assertion on function expression names
Reviewed-by: hannesw, lagergren


1124     }
1125 
1126     /**
1127      * Check if this function is anonymous
1128      * @return true if function is anonymous
1129      */
1130     public boolean isAnonymous() {
1131         return getFlag(IS_ANONYMOUS);
1132     }
1133 
1134     /**
1135      * Does this function use its self symbol - this is needed only for self-referencing named function expressions.
1136      * Self-referencing declared functions won't have this flag set, as they can access their own symbol through the
1137      * scope (since they're bound to the symbol with their name in their enclosing scope).
1138      * @return true if this function node is a named function expression that uses the symbol for itself.
1139      */
1140     public boolean usesSelfSymbol() {
1141         return getFlag(USES_SELF_SYMBOL);
1142     }
1143 









1144     @Override
1145     public Type getType() {
1146         return FUNCTION_TYPE;
1147     }
1148 
1149     @Override
1150     public Type getWidestOperationType() {
1151         return FUNCTION_TYPE;
1152     }
1153 
1154     /**
1155      * Get the return type for this function. Return types can be specialized
1156      * if the compiler knows them, but parameters cannot, as they need to go through
1157      * appropriate object conversion
1158      *
1159      * @return the return type
1160      */
1161     public Type getReturnType() {
1162         return returnType;
1163     }




1124     }
1125 
1126     /**
1127      * Check if this function is anonymous
1128      * @return true if function is anonymous
1129      */
1130     public boolean isAnonymous() {
1131         return getFlag(IS_ANONYMOUS);
1132     }
1133 
1134     /**
1135      * Does this function use its self symbol - this is needed only for self-referencing named function expressions.
1136      * Self-referencing declared functions won't have this flag set, as they can access their own symbol through the
1137      * scope (since they're bound to the symbol with their name in their enclosing scope).
1138      * @return true if this function node is a named function expression that uses the symbol for itself.
1139      */
1140     public boolean usesSelfSymbol() {
1141         return getFlag(USES_SELF_SYMBOL);
1142     }
1143 
1144     /**
1145      * Returns true if this is a named function expression (that is, it isn't a declared function, it isn't an
1146      * anonymous function expression, and it isn't a program).
1147      * @return true if this is a named function expression
1148      */
1149     public boolean isNamedFunctionExpression() {
1150         return !getFlag(IS_PROGRAM | IS_ANONYMOUS | IS_DECLARED);
1151     }
1152 
1153     @Override
1154     public Type getType() {
1155         return FUNCTION_TYPE;
1156     }
1157 
1158     @Override
1159     public Type getWidestOperationType() {
1160         return FUNCTION_TYPE;
1161     }
1162 
1163     /**
1164      * Get the return type for this function. Return types can be specialized
1165      * if the compiler knows them, but parameters cannot, as they need to go through
1166      * appropriate object conversion
1167      *
1168      * @return the return type
1169      */
1170     public Type getReturnType() {
1171         return returnType;
1172     }


< prev index next >