nit.git
9 years agolib/ropes_debug: Adapted new leaves for to_dot operation.
Lucas Bajolet [Mon, 23 Jun 2014 15:38:08 +0000 (11:38 -0400)]
lib/ropes_debug: Adapted new leaves for to_dot operation.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/standard/ropes: Added to_leaf method on RopeNode.
Lucas Bajolet [Mon, 23 Jun 2014 15:12:35 +0000 (11:12 -0400)]
lib/standard/ropes: Added to_leaf method on RopeNode.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/standard/ropes: Concat nodes cannot be constructed without children anymore.
Lucas Bajolet [Thu, 19 Jun 2014 17:19:07 +0000 (13:19 -0400)]
lib/standard/ropes: Concat nodes cannot be constructed without children anymore.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agolib/standard/ropes: API change, Leaves are now abstract for future flexibility.
Lucas Bajolet [Thu, 19 Jun 2014 16:13:49 +0000 (12:13 -0400)]
lib/standard/ropes: API change, Leaves are now abstract for future flexibility.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Pep8analysis Web Version
Jean Privat [Wed, 18 Jun 2014 12:47:49 +0000 (08:47 -0400)]
Merge: Pep8analysis Web Version

Compiles pep8analysis to JavaScript using emscripten and expose a nice interface using Bootstrap, codemirror and viz.js.

Resulting Web app published at: http://xymus.net/pep8/

Pull-Request: #508
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Use more intern methods and add intern factories for NativeString and NativeArray
Jean Privat [Wed, 18 Jun 2014 01:58:58 +0000 (21:58 -0400)]
Merge: Use more intern methods and add intern factories for NativeString and NativeArray

The first commits enhance the parser to accept top-level intern methods (needed for `exit`) and intern `new` factories (analogous to extern `new` factories). Thus fix #493

The rest of the series implements two intern `new` factories, one for NativeString and one for NativeArray.
However, because the compiler in c_src cannot obviously parse the new syntax yet, the standard library is not updated.
So consider the file `test_new_native.nit` as a technology preview.

Pull-Request: #498
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: SharedPreferences: Nit API wrapping android SharedPreferences class
Jean Privat [Wed, 18 Jun 2014 00:42:51 +0000 (20:42 -0400)]
Merge: SharedPreferences: Nit API wrapping android SharedPreferences class

A module wrapping 'android.content.SharedPreferences' allowing to load/save data to internal storage for the android platform. Some tests have been added to the mnit_simple example.

The compiler has been slightly modified to ignore '
' in java extern types.

As asked by @privat and @xymus to store persistant game data.
Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

Pull-Request: #495
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>

9 years agoMerge: Include extra Java files in a project
Jean Privat [Tue, 17 Jun 2014 20:03:06 +0000 (16:03 -0400)]
Merge: Include extra Java files in a project

Will be used to declare implement new Activities and sub classes like Listeners.

Pull-Request: #496
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Frédéric Vachon <fredvac@gmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agopep8analysis: add copyright and doc to the pep8analysis_web module
Alexis Laferrière [Tue, 17 Jun 2014 18:52:21 +0000 (14:52 -0400)]
pep8analysis: add copyright and doc to the pep8analysis_web module

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: add copyright info for viz.js
Alexis Laferrière [Tue, 17 Jun 2014 18:46:03 +0000 (14:46 -0400)]
pep8analysis: add copyright info for viz.js

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agotests: adds sav file for pep8analysis_web
Alexis Laferrière [Tue, 17 Jun 2014 18:28:55 +0000 (14:28 -0400)]
tests: adds sav file for pep8analysis_web

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: improve initial loading speed
Alexis Laferrière [Mon, 16 Jun 2014 17:48:52 +0000 (13:48 -0400)]
pep8analysis: improve initial loading speed

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: show annotated CFG in web interface
Alexis Laferrière [Mon, 16 Jun 2014 16:06:14 +0000 (12:06 -0400)]
pep8analysis: show annotated CFG in web interface

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: add doc to web interface
Alexis Laferrière [Sun, 15 Jun 2014 18:00:17 +0000 (14:00 -0400)]
pep8analysis: add doc to web interface

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: intro the web interface
Alexis Laferrière [Sun, 15 Jun 2014 13:54:37 +0000 (09:54 -0400)]
pep8analysis: intro the web interface

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: intro a variant main program for a web interface
Alexis Laferrière [Sun, 15 Jun 2014 13:16:51 +0000 (09:16 -0400)]
pep8analysis: intro a variant main program for a web interface

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: intro a feature to clear the list of errors/notes
Alexis Laferrière [Sun, 15 Jun 2014 13:29:54 +0000 (09:29 -0400)]
pep8analysis: intro a feature to clear the list of errors/notes

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: print CFG as dot graph to OStream
Alexis Laferrière [Sun, 15 Jun 2014 13:28:40 +0000 (09:28 -0400)]
pep8analysis: print CFG as dot graph to OStream

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: enable analyzing from stream
Alexis Laferrière [Sun, 15 Jun 2014 13:27:21 +0000 (09:27 -0400)]
pep8analysis: enable analyzing from stream

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agopep8analysis: fix format and encoding of some sample/test programs
Alexis Laferrière [Sun, 15 Jun 2014 13:21:07 +0000 (09:21 -0400)]
pep8analysis: fix format and encoding of some sample/test programs

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agolib: implement `close` in StringOStream
Alexis Laferrière [Mon, 16 Jun 2014 16:03:48 +0000 (12:03 -0400)]
lib: implement `close` in StringOStream

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agotests: add a test for the extra_java_files phase
Alexis Laferrière [Thu, 12 Jun 2014 13:14:12 +0000 (09:14 -0400)]
tests: add a test for the extra_java_files phase

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoJava FFI: javac is always called on local files
Alexis Laferrière [Wed, 11 Jun 2014 20:11:56 +0000 (16:11 -0400)]
Java FFI: javac is always called on local files

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoJava FFI: enable inserting additionnal Java files to a project
Alexis Laferrière [Wed, 11 Jun 2014 16:46:47 +0000 (12:46 -0400)]
Java FFI: enable inserting additionnal Java files to a project

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoMerge: Compilation to JavaScript using the Emscripten SDK
Jean Privat [Tue, 17 Jun 2014 02:17:34 +0000 (22:17 -0400)]
Merge: Compilation to JavaScript using the Emscripten SDK

Published for review but still needs some doc and examples. Works with most small examples but not yet with the naive_interpreter (but it's not clear why).

Usage:

    apt-get emscripten
    nitg -m emscripten examples/hello_world.nit
    nodejs hello_wold.js

Pull-Request: #506
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoemscipten_platform: do not use `append` on String
Jean Privat [Tue, 17 Jun 2014 15:09:40 +0000 (11:09 -0400)]
emscipten_platform: do not use `append` on String

It have not the right expected behavior.
Also it brings in Ropes and a lot of other crazy dependencies.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Give top-level methods some rules
Jean Privat [Tue, 17 Jun 2014 01:14:04 +0000 (21:14 -0400)]
Merge: Give top-level methods some rules

1. explicit `self` is forbidden in top-level method
2. top-level methods can only be called without a explicit receiver

In the code, there is workarounds for 3 hard-coded special cases:
* `sys` and `exit`: because, for an unknown reason, intern method cannot be top-level. #493
* `args` because it is currently both in Sys and Object thus has a crazy status. #461

These rules are only enforced as it in `typing` but does not change the model, tools, or engines.

Note: the first commits fix a bug in the `for` where the implicit `iterator` method was resolved with the `recv_is_self` flag always set to true.

Pull-Request: #494
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: Subtyping test with perfect hashing in the Nit vm
Jean Privat [Mon, 16 Jun 2014 17:30:16 +0000 (13:30 -0400)]
Merge: Subtyping test with perfect hashing in the Nit vm

This pull request contains the first files for the Nit virtual machine.

In this PR, the vm constructs runtime structures for each MClass of the model. These structures represent virtual tables for classes. When constructed, the virtual tables only reserve memory for method pointer but the method call is made with the naive_interpreter mechanisms.

The virtual machine can now performs subtyping test with the perfect hashing approach.

In the perfect_hashing module, numbering of items now start at 1 instead of 0.

Pull-Request: #497
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agotests: add tests for nitvm
Jean Privat [Fri, 13 Jun 2014 19:49:31 +0000 (15:49 -0400)]
tests: add tests for nitvm

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: No duplicated mclassdefs
Jean Privat [Mon, 16 Jun 2014 22:42:43 +0000 (18:42 -0400)]
Merge: No duplicated mclassdefs

This series avoid the creation of multiple mclassdefs for a same class in a same module.

It appended for implicit classes: Object for top-level methods and Sys for top-level main.

The series was more complex than expected because it breaks the symmetry between AClassdef and MClassDef. However, thanks to the separation of the AST and the model, it was sill feasible.

Pull-Request: #503
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoemscripten: add general features to lib
Alexis Laferrière [Sat, 14 Jun 2014 11:27:48 +0000 (07:27 -0400)]
emscripten: add general features to lib

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoexamples: intro a README file to emscripten examples
Alexis Laferrière [Sat, 14 Jun 2014 11:28:23 +0000 (07:28 -0400)]
examples: intro a README file to emscripten examples

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoexample: intro an emscripten wrapper around fibonacci
Alexis Laferrière [Sat, 14 Jun 2014 11:18:41 +0000 (07:18 -0400)]
example: intro an emscripten wrapper around fibonacci

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoexample: intro an emscripten wrapper around hello world
Alexis Laferrière [Sat, 14 Jun 2014 10:00:19 +0000 (06:00 -0400)]
example: intro an emscripten wrapper around hello world

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agotests: support testing the emscripten module
Alexis Laferrière [Fri, 13 Jun 2014 22:20:04 +0000 (18:20 -0400)]
tests: support testing the emscripten module

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoemscripten: intro the emscripten platform to generate to JS
Alexis Laferrière [Fri, 13 Jun 2014 22:13:03 +0000 (18:13 -0400)]
emscripten: intro the emscripten platform to generate to JS

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agonitg: extracts default_outname from default toolchain
Alexis Laferrière [Fri, 13 Jun 2014 22:12:24 +0000 (18:12 -0400)]
nitg: extracts default_outname from default toolchain

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agonitg: extracts makefile_name from default toolchain
Alexis Laferrière [Fri, 13 Jun 2014 22:12:13 +0000 (18:12 -0400)]
nitg: extracts makefile_name from default toolchain

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agonitg: use libgc only if platform supports it
Alexis Laferrière [Fri, 13 Jun 2014 22:09:32 +0000 (18:09 -0400)]
nitg: use libgc only if platform supports it

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agolib/stream: fix for clang/llvm/emscripten
Alexis Laferrière [Fri, 13 Jun 2014 20:49:42 +0000 (16:49 -0400)]
lib/stream: fix for clang/llvm/emscripten

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agotests: add error_toplevel.nit
Jean Privat [Wed, 11 Jun 2014 02:04:17 +0000 (22:04 -0400)]
tests: add error_toplevel.nit

and fix sav/error_expr_not_ok_alt4.res

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotyping: check correct usage of top-level methods
Jean Privat [Wed, 11 Jun 2014 02:00:17 +0000 (22:00 -0400)]
typing: check correct usage of top-level methods

First, the body of top-level methods has two constraints:
 * no explicit self
 * implicit self can only call other top-level methods

Second, only self can invoke top-level methods.
Eg. no `6.print("hello")`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Mnit fps
Jean Privat [Mon, 16 Jun 2014 15:52:22 +0000 (11:52 -0400)]
Merge: Mnit fps

Factorize the frame-rate control of mnit applications in a dedicated module in lib.

Pull-Request: #505
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Romain Chanoir <chanoir.romain@courrier.uqam.ca>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agomnit_fps: add current_fps
Jean Privat [Fri, 13 Jun 2014 16:59:26 +0000 (12:59 -0400)]
mnit_fps: add current_fps

Always useful.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomnit: update examples to use maximim_fps
Jean Privat [Fri, 13 Jun 2014 14:55:35 +0000 (10:55 -0400)]
mnit: update examples to use maximim_fps

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib/mnit: introduce mnit_fps so each app does not need to play with clocks
Jean Privat [Mon, 16 Jun 2014 15:42:11 +0000 (11:42 -0400)]
lib/mnit: introduce mnit_fps so each app does not need to play with clocks

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agojava-ffi: Ignore '\n' in extern types
Frédéric Vachon [Fri, 13 Jun 2014 17:43:23 +0000 (13:43 -0400)]
java-ffi: Ignore '\n' in extern types

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib/android: Added tests to mnit_simple
Frédéric Vachon [Fri, 13 Jun 2014 17:40:24 +0000 (13:40 -0400)]
lib/android: Added tests to mnit_simple

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agolib/android: Intro API wrapping android SharedPreferences
Frédéric Vachon [Fri, 13 Jun 2014 17:39:23 +0000 (13:39 -0400)]
lib/android: Intro API wrapping android SharedPreferences

Signed-off-by: Frédéric Vachon <fredvac@gmail.com>

9 years agoMerge: grammar: support spaces and doc with the `in "Lang"` syntax
Jean Privat [Fri, 13 Jun 2014 17:08:47 +0000 (13:08 -0400)]
Merge: grammar: support spaces and doc with the `in "Lang"` syntax

Enables:
~~~~
extern class A in "Java"
    `{ MyJavaClass `}

# ...
end
~~~~

Still needs work for `
` after imports...

Pull-Request: #504
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agogrammar: support spaces and doc with the `in "Java"` syntax
Alexis Laferrière [Fri, 13 Jun 2014 14:25:50 +0000 (10:25 -0400)]
grammar: support spaces and doc with the `in "Java"` syntax

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoModification of the numbering in perfect_hashing.
Julien Pagès [Wed, 11 Jun 2014 22:00:44 +0000 (00:00 +0200)]
Modification of the numbering in perfect_hashing.

The numbering now start at 1 instead of 0.

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

9 years agoFirst files for the Nit virtual machine
Julien Pagès [Wed, 11 Jun 2014 21:57:49 +0000 (23:57 +0200)]
First files for the Nit virtual machine

A virtual table is now constructed for each MClass
The virtual table is constructed according to the specifications.

The perfect hashtable is at negative offsets.
It contains pointer to blocks of (id, methods) which
are at positive offsets of the virtual table.

Signed-off-by: Julien Pagès <julien.projet@gmail.com>

9 years agoMerge: Fix shoot
Jean Privat [Fri, 13 Jun 2014 13:21:03 +0000 (09:21 -0400)]
Merge: Fix shoot

shoot: fix usage of the new App framework …
#479 did the job poorly

Pull-Request: #500
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agoshoot: use `app_name` and `app_version`
Jean Privat [Thu, 12 Jun 2014 16:07:14 +0000 (12:07 -0400)]
shoot: use `app_name` and `app_version`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoshoot: fix usage of the new App framework
Jean Privat [Thu, 12 Jun 2014 16:06:17 +0000 (12:06 -0400)]
shoot: fix usage of the new App framework

#479 did the job poorly

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agolib/app: make App::setup public
Jean Privat [Fri, 13 Jun 2014 00:55:59 +0000 (20:55 -0400)]
lib/app: make App::setup public

So clients can call it if they do not want to rely on the default main
method

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Search `README.md` to document groups
Jean Privat [Thu, 12 Jun 2014 23:11:20 +0000 (19:11 -0400)]
Merge: Search `README.md` to document groups

Pull-Request: #501
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agoMerge: PNaCl : Added threading to pnacl.nit
Jean Privat [Thu, 12 Jun 2014 21:56:12 +0000 (17:56 -0400)]
Merge: PNaCl : Added threading to pnacl.nit

Added threading to pnacl.nit in order to launch Nit on a new thread and still be capable of handling messages.

Pull-Request: #492
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agoUpdated the example with 'run' method
Djomanix [Thu, 12 Jun 2014 19:47:44 +0000 (15:47 -0400)]
Updated the example with 'run' method

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoAdded the 'run' method who is in charge of the infinite loop
Djomanix [Thu, 12 Jun 2014 19:46:23 +0000 (15:46 -0400)]
Added the 'run' method who is in charge of the infinite loop

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agotests: update model-related tools because there is less mclassdef
Jean Privat [Thu, 12 Jun 2014 19:33:58 +0000 (15:33 -0400)]
tests: update model-related tools because there is less mclassdef

Since multiple nclassdef can share a single mclassdef

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: check that double definitions in distinct AClassdef are detected
Jean Privat [Thu, 12 Jun 2014 19:32:46 +0000 (15:32 -0400)]
tests: check that double definitions in distinct AClassdef are detected

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: `check_redef_keyword` and `build_property` rely on mclassdef
Jean Privat [Thu, 12 Jun 2014 19:31:47 +0000 (15:31 -0400)]
modelbuilder: `check_redef_keyword` and `build_property` rely on mclassdef

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoUpdated the example, to show how to handle an 'exit' message in JS.
Djomanix [Thu, 12 Jun 2014 17:58:03 +0000 (13:58 -0400)]
Updated the example, to show how to handle an 'exit' message in JS.

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoEdited 'exit' function for pnacl in order to avoid crashes.
Djomanix [Thu, 12 Jun 2014 17:57:15 +0000 (13:57 -0400)]
Edited 'exit' function for pnacl in order to avoid crashes.

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoDeleted useless 'while' and inlined write method
Djomanix [Thu, 12 Jun 2014 15:16:52 +0000 (11:16 -0400)]
Deleted useless 'while' and inlined write method

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoSuppression of the '-Werror' flag to avoid failing compilations and threading usage...
Djomanix [Thu, 12 Jun 2014 14:54:07 +0000 (10:54 -0400)]
Suppression of the '-Werror' flag to avoid failing compilations and threading usage for complation

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoUpdated the example for pnacl, to make it work with the threading update
Djomanix [Tue, 10 Jun 2014 19:53:34 +0000 (15:53 -0400)]
Updated the example for pnacl, to make it work with the threading update

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agoExecution of the nit code on another thread, and redefinition of basic input and...
Djomanix [Tue, 10 Jun 2014 19:52:47 +0000 (15:52 -0400)]
Execution of the nit code on another thread, and redefinition of basic input and output methods

Signed-off-by: Djomanix <johan.kayser@viacesi.fr>

9 years agomodelbuilder: `build_properties` process `all_defs` at once
Jean Privat [Thu, 12 Jun 2014 19:29:47 +0000 (15:29 -0400)]
modelbuilder: `build_properties` process `all_defs` at once

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: add `AClassdef::all_defs` to retrieve all sibling definitions
Jean Privat [Thu, 12 Jun 2014 19:28:13 +0000 (15:28 -0400)]
modelbuilder: add `AClassdef::all_defs` to retrieve all sibling definitions

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: android: do not move down all inputs by 32 px
Jean Privat [Thu, 12 Jun 2014 17:57:51 +0000 (13:57 -0400)]
Merge: android: do not move down all inputs by 32 px

This hack has outlived its purpose.

As noted by @privat in Chainz of Friendz.

Pull-Request: #502
Reviewed-by: Lucas Bajolet <r4pass@hotmail.com>
Reviewed-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: modeling of top-level methods use `parent`
Jean Privat [Thu, 12 Jun 2014 17:39:14 +0000 (13:39 -0400)]
modelbuilder: modeling of top-level methods use `parent`

Because nclassdef is the first one, not the local one

This gives more information

9 years agoandroid: do not move down all inputs by 32 px
Alexis Laferrière [Thu, 12 Jun 2014 17:26:04 +0000 (13:26 -0400)]
android: do not move down all inputs by 32 px

This hack has outlived its purpose.

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agomodelbuilder: `build_a_mclassdef` reuse existing mclassdefs
Jean Privat [Thu, 12 Jun 2014 17:18:25 +0000 (13:18 -0400)]
modelbuilder: `build_a_mclassdef` reuse existing mclassdefs

In a module, a second AClassdef of a given class, that is valid for
implicit Object and implicit Sys, is now attached a single MClassDef.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: mclass2nclassdef registers the first occurrence of a class
Jean Privat [Thu, 12 Jun 2014 17:07:29 +0000 (13:07 -0400)]
modelbuilder: mclass2nclassdef registers the first occurrence of a class

The first one is the good one.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: simplify the call of `add_in_hierarchy`
Jean Privat [Thu, 12 Jun 2014 17:06:06 +0000 (13:06 -0400)]
modelbuilder: simplify the call of `add_in_hierarchy`

We have all the needed model information, moreover, it is more
robust than using the AST

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelbuilder: document group in the base directory (the one before src)
Jean Privat [Thu, 12 Jun 2014 16:40:26 +0000 (12:40 -0400)]
modelbuilder: document group in the base directory (the one before src)

Search also `README.md` that is already used in some programs in contrib.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: add test_new_native.nit
Jean Privat [Thu, 12 Jun 2014 14:22:42 +0000 (10:22 -0400)]
tests: add test_new_native.nit

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoniti: implements intern `init` for NativeString and NativeArray
Jean Privat [Thu, 12 Jun 2014 14:18:41 +0000 (10:18 -0400)]
niti: implements intern `init` for NativeString and NativeArray

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: implement intern `init` on NativeString
Jean Privat [Thu, 12 Jun 2014 14:17:39 +0000 (10:17 -0400)]
compiler: implement intern `init` on NativeString

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: Accepts `new` constructor on non pointer-based class (eg. NativeString)
Jean Privat [Thu, 12 Jun 2014 14:16:57 +0000 (10:16 -0400)]
compiler: Accepts `new` constructor on non pointer-based class (eg. NativeString)

Just use with a placebo receiver like in other cases.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agojava FFI: display a clean error when java module is not imported
Alexis Laferrière [Wed, 11 Jun 2014 16:11:14 +0000 (12:11 -0400)]
java FFI: display a clean error when java module is not imported

Signed-off-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agocompiler: accept intern `new` constructors (factories)
Jean Privat [Thu, 12 Jun 2014 13:01:38 +0000 (09:01 -0400)]
compiler: accept intern `new` constructors (factories)

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agocompiler: special handling of `new NativeArray`
Jean Privat [Thu, 12 Jun 2014 12:58:17 +0000 (08:58 -0400)]
compiler: special handling of `new NativeArray`

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoparser: regenerate file for improved intern methods
Jean Privat [Thu, 12 Jun 2014 12:56:54 +0000 (08:56 -0400)]
parser: regenerate file for improved intern methods

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoparser: introduce intern `new` constructors (factories)
Jean Privat [Thu, 12 Jun 2014 12:56:45 +0000 (08:56 -0400)]
parser: introduce intern `new` constructors (factories)

They are correctly modeled and typed but engines does not how to deal with them.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoparser: accept intern methods at top-level
Jean Privat [Thu, 12 Jun 2014 12:53:05 +0000 (08:53 -0400)]
parser: accept intern methods at top-level

This modification does not need a special handling in the model or engines.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoerasure_compiler: remove redefinition of `array_instance`
Jean Privat [Thu, 12 Jun 2014 12:51:28 +0000 (08:51 -0400)]
erasure_compiler: remove redefinition of `array_instance`

the inherited implementation from the separate compiler is
enough now that `native_array_instance` is correctly implemented.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoabstract_compiler: generalize `native_array_instance`
Jean Privat [Thu, 12 Jun 2014 12:48:59 +0000 (08:48 -0400)]
abstract_compiler: generalize `native_array_instance`

offers the service `native_array_instance` in all compilation engines

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: Distinguish top-level methods
Jean Privat [Wed, 11 Jun 2014 14:51:01 +0000 (10:51 -0400)]
Merge: Distinguish top-level methods

The point of the PR is the commit that adds `MMethod::is_toplevel` to distinguish methods defined at the top-level of a module, with those defined in an explicit refinement of Object.

Such an information could be used by documentation tool to filter methods.

A following commit use the information to enforce that top-level methods redefine and are redefined only by top-level methods (by refinement). However, the rules in the model remains unchanged and there is no other use of the `is_toplevel` information in tools or execution engines.

The bunch of first commits are used to clean and improve the check of redefinitions used latter.

Pull-Request: #489
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>
Reviewed-by: Alexis Laferrière <alexis.laf@xymus.net>

9 years agotests: update error messages related to `iterator` in for,
Jean Privat [Wed, 11 Jun 2014 01:58:37 +0000 (21:58 -0400)]
tests: update error messages related to `iterator` in for,

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotyping: `interator` in for is correclty set on self
Jean Privat [Wed, 11 Jun 2014 01:52:46 +0000 (21:52 -0400)]
typing: `interator` in for is correclty set on self

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agoMerge: lib/math: Added gcd method on Int.
Jean Privat [Wed, 11 Jun 2014 00:16:16 +0000 (20:16 -0400)]
Merge: lib/math: Added gcd method on Int.

Added GCD method using Stein's algorithm on Int.

Pull-Request: #490
Reviewed-by: Jean Privat <jean@pryen.org>
Reviewed-by: Alexandre Terrasa <alexandre@moz-code.org>

9 years agolib/math: Added gcd method on Int.
Lucas Bajolet [Tue, 10 Jun 2014 19:41:51 +0000 (15:41 -0400)]
lib/math: Added gcd method on Int.

Signed-off-by: Lucas Bajolet <r4pass@hotmail.com>

9 years agotests: add tests for top-level redefinitions
Jean Privat [Tue, 10 Jun 2014 18:56:48 +0000 (14:56 -0400)]
tests: add tests for top-level redefinitions

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodelize_property: top_level methods can only redefine and be redefined by top_level...
Jean Privat [Tue, 10 Jun 2014 18:54:57 +0000 (14:54 -0400)]
modelize_property: top_level methods can only redefine and be redefined by top_level methods

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agomodel: add `MMethod::is_toplevel`
Jean Privat [Tue, 10 Jun 2014 18:53:12 +0000 (14:53 -0400)]
model: add `MMethod::is_toplevel`

Documentation will like to have such an information easily available.

Signed-off-by: Jean Privat <jean@pryen.org>

9 years agotests: update for new error message on already defined property
Jean Privat [Tue, 10 Jun 2014 18:52:05 +0000 (14:52 -0400)]
tests: update for new error message on already defined property

Signed-off-by: Jean Privat <jean@pryen.org>