lib/sax: fixes useless type declaration
authorAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 Dec 2014 20:41:04 +0000 (15:41 -0500)
committerAlexandre Terrasa <alexandre@moz-code.org>
Fri, 12 Dec 2014 20:41:04 +0000 (15:41 -0500)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

lib/sax/helpers/attributes_impl.nit
lib/sax/helpers/test_attributes_impl.nit

index 97f16d8..f54ec0f 100644 (file)
@@ -91,7 +91,7 @@ class AttributesImpl
                                return data[index * 5 + 3]
                        end
                else if index isa String and "" != index then
-                       var i: Int = 0
+                       var i = 0
 
                        while i < data.length do
                                if data[i + 2] == index then
@@ -130,7 +130,7 @@ class AttributesImpl
                                return data[index * 5 + 4]
                        end
                else if index isa String and "" != index then
-                       var i: Int = 0
+                       var i = 0
 
                        while i < data.length do
                                if data[i + 2] == index then
@@ -158,7 +158,7 @@ class AttributesImpl
        # The index of the attribute, or -1 if it does not
        # appear in the list.
        redef fun index_ns(uri: String, local_name: String): Int do
-               var i: Int = 0
+               var i = 0
 
                if "" != local_name then
                        while i < data.length do
@@ -185,7 +185,7 @@ class AttributesImpl
        # The index of the attribute, or -1 if it does not
        # appear in the list.
        redef fun index_of(qname: String): Int do
-               var i: Int = 0
+               var i = 0
 
                if "" != qname then
                        while i < data.length do
@@ -219,7 +219,7 @@ class AttributesImpl
        # attribute is not in the list or if Namespace
        # processing is not being performed.
        redef fun type_ns(uri: String, local_name: String): nullable String do
-               var i: Int = 0
+               var i = 0
 
                if "" != local_name then
                        while i < data.length do
@@ -253,7 +253,7 @@ class AttributesImpl
        # attribute is not in the list or if Namespace
        # processing is not being performed.
        redef fun value_ns(uri: String, local_name: String): nullable String do
-               var i: Int = 0
+               var i = 0
 
                if "" != local_name then
                        while i < data.length do
@@ -281,7 +281,7 @@ class AttributesImpl
        #
        # * `atts`: attributes to copy.
        fun attributes=(atts: Attributes) do
-               var i: Int = 0
+               var i = 0
 
                clear
                length = atts.length
index dc7ecd2..27c98c4 100644 (file)
@@ -18,7 +18,7 @@ class TestAttributesImpl
        super TestSuite
 
        private fun sample: AttributesImpl do
-               var subject: AttributesImpl = new AttributesImpl
+               var subject = new AttributesImpl
 
                # The parser may include everything...
                subject.add("http://example.com/", "bar", "foo:bar", "CDATA", "baz")
@@ -33,7 +33,7 @@ class TestAttributesImpl
        end
 
        fun test_length do
-               var subject: AttributesImpl = new AttributesImpl
+               var subject = new AttributesImpl
 
                assert 0 == subject.length
                subject.add("http://example.com/", "bar", "foo:bar", "CDATA", "baz")
@@ -48,7 +48,7 @@ class TestAttributesImpl
        end
 
        fun test_uri do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "http://example.com/" == subject.uri(0)
                assert "urn:is:not:often:used" == subject.uri(1)
@@ -61,7 +61,7 @@ class TestAttributesImpl
        end
 
        fun test_local_name do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "bar" == subject.local_name(0)
                assert "i-am_ME" == subject.local_name(1)
@@ -74,7 +74,7 @@ class TestAttributesImpl
        end
 
        fun test_qname do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "foo:bar" == subject.qname(0)
                assert "" == subject.qname(1)
@@ -87,7 +87,7 @@ class TestAttributesImpl
        end
 
        fun test_type_of do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "CDATA" == subject.type_of(0)
                assert "ID" == subject.type_of(1)
@@ -100,7 +100,7 @@ class TestAttributesImpl
        end
 
        fun test_type_of_qname do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "CDATA" == subject.type_of("foo:bar")
                assert subject.type_of("") == null
@@ -112,7 +112,7 @@ class TestAttributesImpl
        end
 
        fun test_value_of do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "baz" == subject.value_of(0)
                assert "noop" == subject.value_of(1)
@@ -125,7 +125,7 @@ class TestAttributesImpl
        end
 
        fun test_value_of_qname do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "baz" == subject.value_of("foo:bar")
                assert subject.value_of("") == null
@@ -137,7 +137,7 @@ class TestAttributesImpl
        end
 
        fun test_index_ns do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert 0 == subject.index_ns("http://example.com/", "bar")
                assert 1 == subject.index_ns("urn:is:not:often:used", "i-am_ME")
@@ -149,7 +149,7 @@ class TestAttributesImpl
        end
 
        fun test_index_of do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert 0 == subject.index_of("foo:bar")
                assert -1 == subject.index_of("")
@@ -161,7 +161,7 @@ class TestAttributesImpl
        end
 
        fun test_type_ns do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "CDATA" == subject.type_ns("http://example.com/", "bar")
                assert "ID" == subject.type_ns("urn:is:not:often:used", "i-am_ME")
@@ -173,7 +173,7 @@ class TestAttributesImpl
        end
 
        fun test_value_ns do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                assert "baz" == subject.value_ns("http://example.com/", "bar")
                assert "noop" == subject.value_ns("urn:is:not:often:used", "i-am_ME")
@@ -185,8 +185,8 @@ class TestAttributesImpl
        end
 
        fun test_attributes_set do
-               var subject: AttributesImpl = sample
-               var subject2: AttributesImpl = new AttributesImpl
+               var subject = sample
+               var subject2 = new AttributesImpl
 
                subject.attributes = subject2
                assert subject.length == 0
@@ -196,7 +196,7 @@ class TestAttributesImpl
        end
 
        fun test_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.set(1, "urn:is:not:often:used", "i-am_ME", "i-am_ME", "ID",
                                "noop")
@@ -206,7 +206,7 @@ class TestAttributesImpl
        end
 
        fun test_remove_at do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.remove_at(1)
                assert 3 == subject.length
@@ -214,7 +214,7 @@ class TestAttributesImpl
        end
 
        fun test_uri_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.uri(0) = "https://example.org/serious"
                subject.uri(1) = "ftp://wat"
@@ -223,7 +223,7 @@ class TestAttributesImpl
        end
 
        fun test_local_name_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.local_name(0) = "trololol"
                subject.local_name(1) = "ImYou42"
@@ -232,7 +232,7 @@ class TestAttributesImpl
        end
 
        fun test_qname_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.qname(0) = "go-to:bar"
                subject.qname(1) = "yo:i-am_ME"
@@ -241,7 +241,7 @@ class TestAttributesImpl
        end
 
        fun test_type_of_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.type_of(0) = "NMTOKENS"
                subject.type_of(1) = "ENTITY"
@@ -250,7 +250,7 @@ class TestAttributesImpl
        end
 
        fun test_value_of_set do
-               var subject: AttributesImpl = sample
+               var subject = sample
 
                subject.value_of(0) = "buz"
                subject.value_of(1) = "bizzz"