GetParamCount() protected abstract method

Get number of declared parameters.
Get number of declared parameters. It should be 0 for scripts.
protected abstract GetParamCount ( ) : int
return int
示例#1
0
		internal NativeCall(NativeFunction function, Scriptable scope, object[] args)
		{
			this.function = function;
			SetParentScope(scope);
			// leave prototype null
			this.originalArgs = (args == null) ? ScriptRuntime.emptyArgs : args;
			// initialize values of arguments
			int paramAndVarCount = function.GetParamAndVarCount();
			int paramCount = function.GetParamCount();
			if (paramAndVarCount != 0)
			{
				for (int i = 0; i < paramCount; ++i)
				{
					string name = function.GetParamOrVarName(i);
					object val = i < args.Length ? args[i] : Undefined.instance;
					DefineProperty(name, val, PERMANENT);
				}
			}
			// initialize "arguments" property but only if it was not overridden by
			// the parameter with the same name
			if (!base.Has("arguments", this))
			{
				DefineProperty("arguments", new Arguments(this), PERMANENT);
			}
			if (paramAndVarCount != 0)
			{
				for (int i = paramCount; i < paramAndVarCount; ++i)
				{
					string name = function.GetParamOrVarName(i);
					if (!base.Has(name, this))
					{
						if (function.GetParamOrVarConst(i))
						{
							DefineProperty(name, Undefined.instance, CONST);
						}
						else
						{
							DefineProperty(name, Undefined.instance, PERMANENT);
						}
					}
				}
			}
		}