typing: `interator` in for is correclty set on self

Signed-off-by: Jean Privat <jean@pryen.org>
tests: update error messages related to `iterator` in for,

Signed-off-by: Jean Privat <jean@pryen.org>
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>
modelbuilder: mclass2nclassdef registers the first occurrence of a class

The first one is the good one.

Signed-off-by: Jean Privat <jean@pryen.org>
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>
modelbuilder: modeling of top-level methods use `parent`

Because nclassdef is the first one, not the local one

This gives more information
modelbuilder: add `AClassdef::all_defs` to retrieve all sibling definitions

Signed-off-by: Jean Privat <jean@pryen.org>
modelbuilder: `build_properties` process `all_defs` at once

Signed-off-by: Jean Privat <jean@pryen.org>
modelbuilder: `check_redef_keyword` and `build_property` rely on mclassdef

Signed-off-by: Jean Privat <jean@pryen.org>
tests: check that double definitions in distinct AClassdef are detected

Signed-off-by: Jean Privat <jean@pryen.org>
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>
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>
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>
lib/mnit: introduce mnit_fps so each app does not need to play with clocks

Signed-off-by: Jean Privat <jean@pryen.org>
mnit: update examples to use maximim_fps

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

Always useful.

Signed-off-by: Jean Privat <jean@pryen.org>
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>
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>
tests: add error_toplevel.nit

and fix sav/error_expr_not_ok_alt4.res

Signed-off-by: Jean Privat <jean@pryen.org>
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>