/// <summary> /// Dumps on the specified stream. /// </summary> /// <param name="function">The function.</param> /// <param name="stream">The stream.</param> /// <exception cref="System.ArgumentException"> /// function arg is not a function! /// or /// stream is readonly! /// or /// function arg has upvalues other than _ENV /// </exception> public void Dump(DynValue function, Stream stream) { this.CheckScriptOwnership(function); if (function.Type != DataType.Function) { throw new ArgumentException("function arg is not a function!"); } if (!stream.CanWrite) { throw new ArgumentException("stream is readonly!"); } Closure.UpvaluesType upvaluesType = function.Function.GetUpvaluesType(); if (upvaluesType == Closure.UpvaluesType.Closure) { throw new ArgumentException("function arg has upvalues other than _ENV"); } UndisposableStream outStream = new UndisposableStream(stream); m_MainProcessor.Dump(outStream, function.Function.EntryPointByteCodeLocation, upvaluesType == Closure.UpvaluesType.Environment); }
/// <summary> /// Dumps on the specified stream. /// </summary> /// <param name="function">The function.</param> /// <param name="stream">The stream.</param> /// <exception cref="System.ArgumentException"> /// function arg is not a function! /// or /// stream is readonly! /// or /// function arg has upvalues other than _ENV /// </exception> public void Dump(DynValue function, Stream stream) { if (!m_isAlive) { throw new InvalidOperationException(string.Format("Attempting to dump dead Script [{0}]", FriendlyName)); } this.CheckScriptOwnership(function); if (function.Type != DataType.Function) { throw new ArgumentException("function arg is not a function!"); } if (!stream.CanWrite) { throw new ArgumentException("stream is readonly!"); } Closure.UpvaluesType upvaluesType = function.Function.GetUpvaluesType(); if (upvaluesType == Closure.UpvaluesType.Closure) { throw new ArgumentException("function arg has upvalues other than _ENV"); } UndisposableStream outStream = new UndisposableStream(stream); m_MainProcessor.Dump(outStream, function.Function.EntryPointByteCodeLocation, upvaluesType == Closure.UpvaluesType.Environment); }