nitpretty: fixes crash on attribute annotations
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 8 Jan 2015 11:14:52 +0000 (12:14 +0100)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 8 Jan 2015 11:14:52 +0000 (12:14 +0100)
Fixes #727

Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

src/pretty.nit
tests/sav/fixme/nitpretty_args21.res [deleted file]
tests/sav/fixme/nitpretty_args22.res [deleted file]
tests/sav/nitpretty_args21.res
tests/sav/nitpretty_args27.res
tests/test_pretty/test_annot1.nit

index 3b9f7ef..8d7a45a 100644 (file)
@@ -910,9 +910,9 @@ redef class AMethPropdef
                                        v.add "end"
                                end
                        end
+               v.finish_line
                end
 
-               v.finish_line
                v.addn
                assert v.indent == before
        end
diff --git a/tests/sav/fixme/nitpretty_args21.res b/tests/sav/fixme/nitpretty_args21.res
deleted file mode 100644 (file)
index f4a3324..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-# This file is part of NIT ( http://www.nitlanguage.org ).
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import end
-intrude import standard::kernel
-private import standard::string
-
-`{`}
-
-`{
-#ifdef truc
-       #undef truc
-#endif
-`}
-
-in "C headers" `{
-       #include <errno.h>
-`}
-
-fun err: Int is extern `{ return 1; `}
-
-fun errno: Int is extern `{
-       return errno;
-`}
-
-fun errnoooooooooooooooooooooooooooooooooooooooooooooooooooooooooo: Int is extern `{
-        return errno;
-`}
-
-private class A
-       var my_attr = 1234
-
-       fun baz(msg: String) import String.length, String.to_cstring, my_attr, my_attr= `{
-               char *c_msg;
-               int msg_len;
-
-               /* String_to_cstring isa a allback to msg.to_cstring */
-               c_msg = String_to_cstring( msg );
-
-               /* String_length is a callback to msg.length */
-               msg_len = String_length( msg );
-
-               printf( "received msg: %s, of length = %d\n", c_msg, msg_len );
-
-               /* A_my_attr is a callback to the getter of self.my_attr */
-               printf( "old attr %d\n", A_my_attr(recv) );
-
-               if(chose)
-                       truc;
-               else
-                       chose;
-
-               /* A_my_attr is a callback to the setter of self.my_attr= */
-               A_my_attr__assign( recv, msg_len );
-       `}
-end
-
-extern class TimeT `{time_t`}
-       new `{ return time(NULL); `}
-       new from_i(i: Int) `{ return i; `}
-       fun update `{ time(&recv); `}
-
-       fun ctime: String import NativeString.to_s_with_copy `{
-               return NativeString_to_s_with_copy( ctime(&recv) );
-       `}
-
-       # Difference in secondes from start (self if the end time)
-       fun difftime(start: TimeT): Float `{ return difftime(recv, start); `}
-
-       private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int is import
-               Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
-end
-
-fun address_is_null: Bool is extern "address_is_null"
-
-fun free `{ free(recv); `}
diff --git a/tests/sav/fixme/nitpretty_args22.res b/tests/sav/fixme/nitpretty_args22.res
deleted file mode 100644 (file)
index 4ad3dc3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-UNDEFINED
index 9b58418..325eddc 100644 (file)
@@ -78,10 +78,10 @@ extern class TimeT `{time_t`}
        # Difference in secondes from start (self if the end time)
        fun difftime(start: TimeT): Float `{ return difftime(recv, start); `}
 
-       private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int is extern import
-               Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
+       private fun intern_poll(in_fds: Array[Int], out_fds: Array[Int]): nullable Int is
+               extern import Array[Int].length, Array[Int].[], Int.as(nullable Int) `{`}
 end
 
 fun address_is_null: Bool is extern "address_is_null"
 
-fun free `{ free(recv); `}
+fun free `{ free(recv); `}
\ No newline at end of file
index 0406b29..d3ee895 100644 (file)
 module test_annot1 is platform("android")
 
 class A
+       fun goo is intern
+
+       # test
        fun foo is a, b
+
        fun bar is a, b do print "1"
 
        fun baz is
index 381cc4f..695020f 100644 (file)
@@ -15,6 +15,9 @@
 module test_annot1 is platform("android")
 
 class A
+       fun goo is intern
+
+       # test
        fun foo is a, b
        fun bar is a, b do print "1"
        fun baz is a, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb do print "2"