Skip to content
This repository was archived by the owner on Jul 30, 2024. It is now read-only.

[refactoring] Constructor cleanup #273

Merged
merged 3 commits into from
Jun 10, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/nodejs-v14/src/main/scala/io/scalajs/nodejs/Error.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import scala.scalajs.js.annotation.JSGlobal
*/
@js.native
@JSGlobal
class Error(message0: String) extends js.Object {
def this() = this(???)
class Error() extends js.Object {
def this(message0: String) = this()

/**
* The `error.code` property is a string label that identifies the kind of error.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import scala.scalajs.js.|
*/
@js.native
@JSImport("string_decoder", "StringDecoder")
class StringDecoder(encoding: String) extends IEventEmitter {
def this() = this(???)
class StringDecoder() extends IEventEmitter {
def this(encoding: String) = this()

/**
* Returns any trailing bytes that were left in the buffer.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.scalajs.js.|
*/
@js.native
@JSImport("buffer", "Buffer")
class Buffer private[this] () extends Uint8Array( /* dummy to trick constructor */ -1) {
class Buffer protected () extends Uint8Array( /* dummy to trick constructor */ -1) {

/**
* The index operator `[index]` can be used to get and set the octet at position `index` in `buf`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import scala.scalajs.js.annotation.JSImport
*/
@js.native
@JSImport("dgram", "Socket")
class Socket private[this] () extends IEventEmitter {
class Socket protected () extends IEventEmitter {

/**
* Tells the kernel to join a multicast group at the given multicastAddress and multicastInterface using the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import scala.scalajs.js.annotation.JSImport
*/
@js.native
@JSImport("http", "Agent")
class Agent(options: AgentOptions) extends IEventEmitter {
def this() = this(???)
class Agent() extends IEventEmitter {
def this(options: AgentOptions) = this()

/////////////////////////////////////////////////////////////////////////////////
// Properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ import scala.scalajs.js.annotation.JSImport
*/
@js.native
@JSImport("https", "Agent")
class Agent(options: AgentOptions) extends nodejs.http.Agent {
def this() = this(???)
class Agent() extends nodejs.http.Agent {
def this(options: AgentOptions) = this()
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ import scala.scalajs.js.|
*/
@js.native
@JSImport("net", "Server")
class Server(options: ServerOptions, connectionListener: js.Function) extends IEventEmitter {
def this() = this(???, ???)
def this(options: ServerOptions) = this(???, ???)
def this(connectionListener: js.Function) = this(???, ???)
class Server() extends IEventEmitter {
def this(options: ServerOptions, connectionListener: js.Function) = this()
def this(options: ServerOptions) = this()
def this(connectionListener: js.Function) = this()

/**
* A Boolean indicating whether or not the server is listening for connections.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import scala.scalajs.js.annotation.JSImport
*/
@js.native
@JSImport("net", "Socket")
class Socket(options: SocketOptions) extends stream.Duplex with HasHandle {
def this() = this(???)
class Socket() extends stream.Duplex with HasHandle {
def this(options: SocketOptions) = this()

/**
* net.Socket has the property that socket.write() always works. This is to help users get up and running quickly.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ package object net {
*
* See also: the return values of socket.write()
* @param callback the callback
* @example socket.on("drain", function(???) { ... })
* @example socket.on("drain", function() { ... })
*/
@inline def onDrain(callback: () => Any): T = socket.on("drain", callback)

Expand All @@ -120,7 +120,7 @@ package object net {
* side allowing the user to write arbitrary amounts of data, with the caveat that the user is required to end()
* their side now.
* @param callback the callback
* @example socket.on("end", function(???) { ... })
* @example socket.on("end", function() { ... })
*/
@inline def onEnd(callback: () => Any): T = socket.on("end", callback)

Expand All @@ -147,7 +147,7 @@ package object net {
*
* See also: socket.setTimeout()
* @param callback the callback
* @example socket.on("timeout", function(???) { ... })
* @example socket.on("timeout", function() { ... })
*/
@inline def onTimeout(callback: js.Function): T = socket.on("timeout", callback)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ object Stream extends js.Object {
*/
@js.native
@JSImport("stream", "Readable")
class Readable(options: ReadableOptions) extends IReadable {
def this() = this(???)
class Readable() extends IReadable {
def this(options: ReadableOptions) = this()
}

@js.native
Expand All @@ -71,8 +71,8 @@ object Readable extends js.Object {
*/
@js.native
@JSImport("stream", "Writable")
class Writable(options: WritableOptions) extends IWritable {
def this() = this(???)
class Writable() extends IWritable {
def this(options: WritableOptions) = this()
}

/**
Expand All @@ -88,8 +88,8 @@ class Writable(options: WritableOptions) extends IWritable {
*/
@js.native
@JSImport("stream", "Duplex")
class Duplex(options: DuplexOptions) extends IDuplex {
def this() = this(???)
class Duplex() extends IDuplex {
def this(options: DuplexOptions) = this()
}

/**
Expand All @@ -98,8 +98,8 @@ class Duplex(options: DuplexOptions) extends IDuplex {
*/
@js.native
@JSImport("stream", "Transform")
class Transform(options: TransformOptions) extends ITransform {
def this() = this(???)
class Transform() extends ITransform {
def this(options: TransformOptions) = this()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,12 @@ import scala.scalajs.js.|
* and all required TLS negotiation.
*
* Instances of tls.TLSSocket implement the duplex Stream interface.
* @param socket An instance of [[net.Socket]]
* @param options the optional settings
*/
@js.native
@JSImport("tls", "TLSSocket")
class TLSSocket(socket: stream.IDuplex, options: TLSSocketOptions) extends net.Socket {
def this(socket: stream.IDuplex) = this(???, ???)
class TLSSocket protected () extends net.Socket {
def this(socket: stream.IDuplex, options: TLSSocketOptions) = this()
def this(socket: stream.IDuplex) = this()

def authorizationError: js.UndefOr[Boolean] = js.native

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import scala.scalajs.js.|
*/
@js.native
@JSImport("vm", "Script")
class Script private[this] () extends js.Object {
class Script protected () extends js.Object {
def this(code: String, options: ScriptOptions) = this()
def this(code: String, filename: String) = this()
def this(code: String) = this()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import scala.scalajs.js.annotation.JSImport

@js.native
@JSImport("worker_threads", "Worker")
class Worker(filename: String, workerOptions: WorkerOptions) extends js.Object with MessagePoster {
def this(filename: String) = this(???, ???)
class Worker protected () extends js.Object with MessagePoster {
def this(filename: String, workerOptions: WorkerOptions) = this()
def this(filename: String) = this()

def ref(): Unit = js.native
def unref(): Unit = js.native
Expand Down