< prev index next >

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

Print this page
rev 1494 : 8134731: Function.prototype.apply interacts incorrectly with arguments
Reviewed-by: attila, hannesw


1060     }
1061 
1062     /**
1063      * Checks if this function is split into several smaller fragments.
1064      *
1065      * @return true if this function is split into several smaller fragments.
1066      */
1067     public boolean isSplit() {
1068         return getFlag(IS_SPLIT);
1069     }
1070 
1071     /**
1072      * Get the parameters to this function
1073      * @return a list of IdentNodes which represent the function parameters, in order
1074      */
1075     public List<IdentNode> getParameters() {
1076         return Collections.unmodifiableList(parameters);
1077     }
1078 
1079     /**








1080      * Returns the identifier for a named parameter at the specified position in this function's parameter list.
1081      * @param index the parameter's position.
1082      * @return the identifier for the requested named parameter.
1083      * @throws IndexOutOfBoundsException if the index is invalid.
1084      */
1085     public IdentNode getParameter(final int index) {
1086         return parameters.get(index);
1087     }
1088 
1089     /**
1090      * Reset the compile unit used to compile this function
1091      * @see Compiler
1092      * @param  lc lexical context
1093      * @param  parameters the compile unit
1094      * @return function node or a new one if state was changed
1095      */
1096     public FunctionNode setParameters(final LexicalContext lc, final List<IdentNode> parameters) {
1097         if (this.parameters == parameters) {
1098             return this;
1099         }




1060     }
1061 
1062     /**
1063      * Checks if this function is split into several smaller fragments.
1064      *
1065      * @return true if this function is split into several smaller fragments.
1066      */
1067     public boolean isSplit() {
1068         return getFlag(IS_SPLIT);
1069     }
1070 
1071     /**
1072      * Get the parameters to this function
1073      * @return a list of IdentNodes which represent the function parameters, in order
1074      */
1075     public List<IdentNode> getParameters() {
1076         return Collections.unmodifiableList(parameters);
1077     }
1078 
1079     /**
1080      * Return the number of parameters to this function
1081      * @return the number of parameters
1082      */
1083     public int getNumOfParams() {
1084         return parameters.size();
1085     }
1086 
1087     /**
1088      * Returns the identifier for a named parameter at the specified position in this function's parameter list.
1089      * @param index the parameter's position.
1090      * @return the identifier for the requested named parameter.
1091      * @throws IndexOutOfBoundsException if the index is invalid.
1092      */
1093     public IdentNode getParameter(final int index) {
1094         return parameters.get(index);
1095     }
1096 
1097     /**
1098      * Reset the compile unit used to compile this function
1099      * @see Compiler
1100      * @param  lc lexical context
1101      * @param  parameters the compile unit
1102      * @return function node or a new one if state was changed
1103      */
1104     public FunctionNode setParameters(final LexicalContext lc, final List<IdentNode> parameters) {
1105         if (this.parameters == parameters) {
1106             return this;
1107         }


< prev index next >