1
0
forked from Mirror/wren
Commit Graph

25 Commits

Author SHA1 Message Date
8980d34ee5 Only close an upvalue for a local if there actually is one for it. 2015-10-08 08:06:29 -07:00
24cbb7f399 Fix closures in methods.
A local name inside a method should always resolve to a self send even
if there is a local variable with that name outside of the method.
2015-10-05 07:44:51 -07:00
8ef4ea6186 Allow super calls in static methods. 2015-09-19 15:19:41 -07:00
58e4d26648 "IO" -> "System".
Get rid of the separate opt-in IO class and replace it with a core
System class.

- Remove wren_io.c, wren_io.h, and io.wren.
- Remove the flags that disable it.
- Remove the overloads for print() with different arity. (It was an
  experiment, but I don't think it's that useful.)
- Remove IO.read(). That will reappear using libuv in the CLI at some
  point.
- Remove IO.time. Doesn't seem to have been used.
- Update all of the tests, docs, etc.

I'm sorry for all the breakage this causes, but I think "System" is a
better name for this class (it makes it natural to add things like
"System.gc()") and frees up "IO" for referring to the CLI's IO module.
2015-09-15 07:46:09 -07:00
1a27593993 Error if a class tries to inherit from null.
Fix #246.
2015-09-12 10:14:04 -07:00
bda9ad880a Flesh out string byte handling a bit:
- Get rid of public byteAt(_) method on strings. It's redundant and
  longer than .bytes[_].
- Implement bytes.count natively so it's O(1).
2015-09-10 23:52:18 -07:00
2e83f056c1 No more default constructors.
Fixes #296.
2015-09-01 08:16:04 -07:00
2b044666ee Reorganize trailing comma code a bit.
- Split out syntax error tests.
- Avoid redundant handling of empty literals.
2015-08-31 07:23:36 -07:00
d7eed08774 Add some tests with invalid trailing commas 2015-08-31 06:41:09 -07:00
b20c9a1b38 Allow trailing comma in list literal 2015-08-31 06:41:09 -07:00
e1d3596643 Allow trailing comma in map literal 2015-08-31 06:41:09 -07:00
7be1fb543b Fix test name. 2015-08-20 22:04:42 -07:00
0c539af6ac added scientific notation 2015-08-16 11:50:45 +02:00
48bdbc7745 First pass at implementing foreign classes.
Most of the pieces are there:

- You can declare a foreign class.
- It will call your C function to provide an allocator function.
- Whenever a foreign object is created, it calls the allocator.
- Foreign methods can access the foreign bytes of an object.
- Most of the runtime checking is in place for things like subclassing
  foreign classes.

There is still some loose ends to tie up:

- Finalizers are not called.
- Some of the error-handling could be better.
- The GC doesn't track how much memory a marked foreign object uses.
2015-08-15 12:07:53 -07:00
71ab3ca887 Use "construct" instead of "this" to define constructors. 2015-07-21 07:24:53 -07:00
5fb6186d7d Make constructors just methods.
* Eliminate "new" reserved word.
* Allow "this" before a method definition to define a constructor.
* Only create a default constructor for classes that don't define one.
2015-07-10 09:18:22 -07:00
fa8ac84a8b Fix broken test runner (!).
If a test expected an error and found at least one, it would not fail
on any other expected errors that didn't occur.

Also, some tests were expecting a compile time error message even though
the test script doesn't validate those (yet).

The test function was getting monolithic, so I went ahead and split it
into a separate little class.
2015-07-09 08:06:33 -07:00
8834dcfe1d Add (failing) tests. 2015-05-19 06:47:42 -07:00
a907c143c8 Test referring to lowercase class name inside class.
Fix #251.
2015-04-25 10:47:55 -07:00
92a054f76a Don't make locals in scope in their own initializer. 2015-04-01 07:05:40 -07:00
72c38a59ce More stuff for working with strings and bytes!
- "\x" escape sequence to put byte values in strings: "\x34"
- String.byteAt(index) gets value of byte in string.
- String.bytes returns a raw sequence of bytes for a string.
- String.codePointAt(index) gets the code point at an offset as a raw number.
2015-03-27 20:44:07 -07:00
322eea1af5 Generate a runtime error if a foreign method was not found. 2015-03-26 07:17:09 -07:00
89ebffb582 Rearrange a bit. 2015-03-23 06:48:08 -07:00
91c69ccbf0 If module name does not specify a file try to load it as a module package instead. 2015-03-21 16:05:02 -07:00
64eccdd9be Reorganize tests and benchmark scripts.
Mainly to get rid of one top level directory. But this will
also be useful when there are tests of the embedding API.
2015-03-14 12:45:56 -07:00