code: explicitly call init in some named constructors
authorJean Privat <jean@pryen.org>
Wed, 25 Nov 2015 16:54:06 +0000 (11:54 -0500)
committerJean Privat <jean@pryen.org>
Tue, 8 Dec 2015 19:33:43 +0000 (14:33 -0500)
Signed-off-by: Jean Privat <jean@pryen.org>

contrib/nitrpg/src/statistics.nit
contrib/refund/src/refund_base.nit
lib/android/assets_and_resources.nit
lib/csv/csv.nit
lib/github/api.nit
lib/github/events.nit
lib/html/bootstrap.nit
lib/html/html.nit
lib/markdown/markdown.nit

index 0bdb421..2827ae9 100644 (file)
@@ -166,6 +166,7 @@ class GameStats
 
        # Load `self` from saved data.
        init from_json(game: Game, period: String, owner: GameEntity, json: JsonObject) do
+               init(game, period, owner)
                var values = json.get_or_null("values")
                if not values isa JsonObject then return
                for k, v in values do self[k] = v.as(Int)
index ec1de5a..48e1833 100644 (file)
@@ -352,7 +352,7 @@ class UniqCare
        # * `max`: max amount refunded for this `Care` in a reclamation sheet.
        # * `month_max`: max amount refunded by month.
        init with_vals(id: Int, cover: Float, max, month_max: nullable Dollar) do
-               self.id = id
+               init(id)
                self.cover = cover
                self.max = max
                self.month_max = month_max
@@ -382,7 +382,7 @@ class RangeCare
        # * `max`: max amount refunded for this `Care` in a reclamation sheet.
        # * `month_max`: max amount refunded by month.
        init with_vals(id: Range[Int], cover: Float, max, month_max: nullable Dollar) do
-               self.id = id
+               init(id)
                self.cover = cover
                self.max = max
                self.month_max = month_max
index 624a03d..8bbc7da 100644 (file)
@@ -218,8 +218,7 @@ class ResourcesManager
 
        private init native(res: NativeResources, app_package: String)
        do
-               self.android_resources = res.new_global_ref
-               self.app_package = app_package
+               init(res.new_global_ref, app_package)
        end
 
        # Get a color from resources
index f76d41c..57590ad 100644 (file)
@@ -169,7 +169,7 @@ class CsvWriter
 
        # Create a new writer with the specified format.
        init with_format(ostream:Writer, format: CsvFormat) do
-               self.ostream = ostream
+               init(ostream)
                self.format = format
        end
 
@@ -260,7 +260,7 @@ class CsvReader
 
        # Create a new reader with the specified format.
        init with_format(istream:Reader, format: CsvFormat) do
-               self.istream = istream
+               init(istream)
                self.format = format
        end
 
index 18880ec..59917c5 100644 (file)
@@ -557,8 +557,7 @@ abstract class RepoEntity
 
        # Init `self` from a `json` object.
        init from_json(api: GithubAPI, repo: Repo, json: JsonObject) do
-               self.api = api
-               self.repo = repo
+               init(api, repo)
                self.json = json
        end
 end
@@ -1572,8 +1571,7 @@ class ContributorStats
 
        # Init `self` from a `json` object.
        init from_json(api: GithubAPI, json: JsonObject) do
-               self.api = api
-               self.json = json
+               init(api, json)
        end
 
        # User these statistics are about.
index 543a786..33c637f 100644 (file)
@@ -34,7 +34,7 @@ class GithubEvent
 
        # Init `self` from a `json` object.
        init from_json(api: GithubAPI, json: JsonObject) do
-               self.api = api
+               init(api)
                self.json = json
        end
 
index 66befa3..d7960e3 100644 (file)
@@ -70,8 +70,7 @@ class Link
 
        # Creates a link with a `title` attribute.
        init with_title(href: String, text: Writable, title: nullable String) do
-               self.href = href
-               self.text = text
+               init(href, text)
                self.title = title
        end
 
@@ -112,8 +111,7 @@ class Header
 
        # Creates a link with a `title` attribute.
        init with_subtext(level: Int, text: Writable, subtext: String) do
-               self.level = level
-               self.text = text
+               init(level, text)
                self.subtext = subtext
        end
 
index 6cb192b..b5f5529 100644 (file)
@@ -123,7 +123,7 @@ class HTMLTag
 
        # Create a HTML elements with the specifed type and attributes.
        init with_attrs(tag: String, attrs: Map[String, String]) do
-               self.tag = tag
+               init(tag)
                self.attrs = attrs
        end
 
index 7907409..ef247be 100644 (file)
@@ -634,7 +634,7 @@ class LinkRef
 
        # Create a link with a title.
        init with_title(link: String, title: nullable String) do
-               self.link = link
+               init(link)
                self.title = title
        end
 end