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

Commit 5334171

Browse files
authored
Merge pull request #273 from exoego/constructor-cleanup
[refactoring] Constructor cleanup
2 parents 0c6cd50 + d75562e commit 5334171

File tree

13 files changed

+34
-34
lines changed

13 files changed

+34
-34
lines changed

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/Error.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import scala.scalajs.js.annotation.JSGlobal
1515
*/
1616
@js.native
1717
@JSGlobal
18-
class Error(message0: String) extends js.Object {
19-
def this() = this(???)
18+
class Error() extends js.Object {
19+
def this(message0: String) = this()
2020

2121
/**
2222
* The `error.code` property is a string label that identifies the kind of error.

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/StringDecoder.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import scala.scalajs.js.|
1313
*/
1414
@js.native
1515
@JSImport("string_decoder", "StringDecoder")
16-
class StringDecoder(encoding: String) extends IEventEmitter {
17-
def this() = this(???)
16+
class StringDecoder() extends IEventEmitter {
17+
def this(encoding: String) = this()
1818

1919
/**
2020
* Returns any trailing bytes that were left in the buffer.

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/buffer/Buffer.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import scala.scalajs.js.|
1212
*/
1313
@js.native
1414
@JSImport("buffer", "Buffer")
15-
class Buffer private[this] () extends Uint8Array( /* dummy to trick constructor */ -1) {
15+
class Buffer protected () extends Uint8Array( /* dummy to trick constructor */ -1) {
1616

1717
/**
1818
* The index operator `[index]` can be used to get and set the octet at position `index` in `buf`.

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/dgram/Socket.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import scala.scalajs.js.annotation.JSImport
1717
*/
1818
@js.native
1919
@JSImport("dgram", "Socket")
20-
class Socket private[this] () extends IEventEmitter {
20+
class Socket protected () extends IEventEmitter {
2121

2222
/**
2323
* Tells the kernel to join a multicast group at the given multicastAddress and multicastInterface using the

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/http/Agent.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ import scala.scalajs.js.annotation.JSImport
1515
*/
1616
@js.native
1717
@JSImport("http", "Agent")
18-
class Agent(options: AgentOptions) extends IEventEmitter {
19-
def this() = this(???)
18+
class Agent() extends IEventEmitter {
19+
def this(options: AgentOptions) = this()
2020

2121
/////////////////////////////////////////////////////////////////////////////////
2222
// Properties

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/https/Agent.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,6 @@ import scala.scalajs.js.annotation.JSImport
1010
*/
1111
@js.native
1212
@JSImport("https", "Agent")
13-
class Agent(options: AgentOptions) extends nodejs.http.Agent {
14-
def this() = this(???)
13+
class Agent() extends nodejs.http.Agent {
14+
def this(options: AgentOptions) = this()
1515
}

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/net/Server.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ import scala.scalajs.js.|
1313
*/
1414
@js.native
1515
@JSImport("net", "Server")
16-
class Server(options: ServerOptions, connectionListener: js.Function) extends IEventEmitter {
17-
def this() = this(???, ???)
18-
def this(options: ServerOptions) = this(???, ???)
19-
def this(connectionListener: js.Function) = this(???, ???)
16+
class Server() extends IEventEmitter {
17+
def this(options: ServerOptions, connectionListener: js.Function) = this()
18+
def this(options: ServerOptions) = this()
19+
def this(connectionListener: js.Function) = this()
2020

2121
/**
2222
* A Boolean indicating whether or not the server is listening for connections.

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/net/Socket.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import scala.scalajs.js.annotation.JSImport
1313
*/
1414
@js.native
1515
@JSImport("net", "Socket")
16-
class Socket(options: SocketOptions) extends stream.Duplex with HasHandle {
17-
def this() = this(???)
16+
class Socket() extends stream.Duplex with HasHandle {
17+
def this(options: SocketOptions) = this()
1818

1919
/**
2020
* net.Socket has the property that socket.write() always works. This is to help users get up and running quickly.

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/net/package.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ package object net {
108108
*
109109
* See also: the return values of socket.write()
110110
* @param callback the callback
111-
* @example socket.on("drain", function(???) { ... })
111+
* @example socket.on("drain", function() { ... })
112112
*/
113113
@inline def onDrain(callback: () => Any): T = socket.on("drain", callback)
114114

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

@@ -147,7 +147,7 @@ package object net {
147147
*
148148
* See also: socket.setTimeout()
149149
* @param callback the callback
150-
* @example socket.on("timeout", function(???) { ... })
150+
* @example socket.on("timeout", function() { ... })
151151
*/
152152
@inline def onTimeout(callback: js.Function): T = socket.on("timeout", callback)
153153
}

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/stream/Stream.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ object Stream extends js.Object {
5050
*/
5151
@js.native
5252
@JSImport("stream", "Readable")
53-
class Readable(options: ReadableOptions) extends IReadable {
54-
def this() = this(???)
53+
class Readable() extends IReadable {
54+
def this(options: ReadableOptions) = this()
5555
}
5656

5757
@js.native
@@ -71,8 +71,8 @@ object Readable extends js.Object {
7171
*/
7272
@js.native
7373
@JSImport("stream", "Writable")
74-
class Writable(options: WritableOptions) extends IWritable {
75-
def this() = this(???)
74+
class Writable() extends IWritable {
75+
def this(options: WritableOptions) = this()
7676
}
7777

7878
/**
@@ -88,8 +88,8 @@ class Writable(options: WritableOptions) extends IWritable {
8888
*/
8989
@js.native
9090
@JSImport("stream", "Duplex")
91-
class Duplex(options: DuplexOptions) extends IDuplex {
92-
def this() = this(???)
91+
class Duplex() extends IDuplex {
92+
def this(options: DuplexOptions) = this()
9393
}
9494

9595
/**
@@ -98,8 +98,8 @@ class Duplex(options: DuplexOptions) extends IDuplex {
9898
*/
9999
@js.native
100100
@JSImport("stream", "Transform")
101-
class Transform(options: TransformOptions) extends ITransform {
102-
def this() = this(???)
101+
class Transform() extends ITransform {
102+
def this(options: TransformOptions) = this()
103103
}
104104

105105
/**

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/tls/TLSSocket.scala

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,12 @@ import scala.scalajs.js.|
1414
* and all required TLS negotiation.
1515
*
1616
* Instances of tls.TLSSocket implement the duplex Stream interface.
17-
* @param socket An instance of [[net.Socket]]
18-
* @param options the optional settings
1917
*/
2018
@js.native
2119
@JSImport("tls", "TLSSocket")
22-
class TLSSocket(socket: stream.IDuplex, options: TLSSocketOptions) extends net.Socket {
23-
def this(socket: stream.IDuplex) = this(???, ???)
20+
class TLSSocket protected () extends net.Socket {
21+
def this(socket: stream.IDuplex, options: TLSSocketOptions) = this()
22+
def this(socket: stream.IDuplex) = this()
2423

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

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/vm/Script.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import scala.scalajs.js.|
1212
*/
1313
@js.native
1414
@JSImport("vm", "Script")
15-
class Script private[this] () extends js.Object {
15+
class Script protected () extends js.Object {
1616
def this(code: String, options: ScriptOptions) = this()
1717
def this(code: String, filename: String) = this()
1818
def this(code: String) = this()

app/nodejs-v14/src/main/scala/io/scalajs/nodejs/worker_threads/Worker.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,9 @@ import scala.scalajs.js.annotation.JSImport
88

99
@js.native
1010
@JSImport("worker_threads", "Worker")
11-
class Worker(filename: String, workerOptions: WorkerOptions) extends js.Object with MessagePoster {
12-
def this(filename: String) = this(???, ???)
11+
class Worker protected () extends js.Object with MessagePoster {
12+
def this(filename: String, workerOptions: WorkerOptions) = this()
13+
def this(filename: String) = this()
1314

1415
def ref(): Unit = js.native
1516
def unref(): Unit = js.native

0 commit comments

Comments
 (0)