Commit Graph

180 Commits

Author SHA1 Message Date
mpeterv
b66ba54ccb Add tests for __mode 2015-11-19 14:10:38 +03:00
mpeterv
b0b655d1c0 Add tests for __metatable 2015-11-19 13:59:19 +03:00
mpeterv
f331dc4248 Fix __gc tests
Tests for inherited __gc used to pass even without the feature being
implemented, most likely because objects from previous tests got
collected just in time.
2015-11-19 13:53:51 +03:00
mpeterv
beee81e36a Support inheriting __gc, __mode, __metatable
Do not directly set metatable of an instance dict to super's
instance dict so that special metamethods do not affect it.
2015-11-19 13:53:03 +03:00
mpeterv
0f9d5c8e61 Add tests for overriding metamethods 2015-11-19 13:13:04 +03:00
mpeterv
d9f00351b2 Implement inheritable metamethods without stubs
In __newindex metamethods of each Class detect if
a metamethod is assigned. In that case, propogate assignment
to all child classes that do not overwrite the metamethod.
Track set of metamethods each class defines itself.
On subclassing, copy all parent metamethods to child.

Benefits of this approach:

* Objects only have metamethods when they are, in fact, defined.
  Ignoring overhead, the problem with stubs is that other libraries,
  seeing a stub metamethod, could try to call it and get an error
  if it's missing in the class. E.g. various deep comparison functions
  often try to detect and use __eq.
* Non-function metafields such as __metatable can be used.
* Less overhead when using metamethods (but more when defining them).
2015-11-19 13:05:09 +03:00
kikito
e7d8bc00d6 add 3.1.0 rockspec 2015-11-02 17:40:47 +01:00
kikito
738c1968a5 add 3.1.0 rockspec 2015-11-02 17:39:06 +01:00
kikito
9fb0f72a74 bump version to 3.1.0 2015-11-02 17:37:30 +01:00
kikito
a5a334c775 splits 5.2 and 5.3 metamethods into separate files. Fixes 5.3 errors 2015-11-01 17:09:15 +01:00
kikito
cd8ce449e1 make lua < 5.3 not fret about new operators by using eval in 5.3 sections 2015-10-31 17:16:10 +01:00
kikito
1a9d1146cf add missing parenthesis to two function calls 2015-10-31 16:53:19 +01:00
kikito
4c1f15c055 adds failing lua 5.3 metamethods tests 2015-10-31 16:50:11 +01:00
kikito
d6b5f5c22d do not stub __metatable or __mode 2015-10-31 16:26:20 +01:00
kikito
d97a1bfbd4 do not stub the __gc metamethod 2015-10-31 15:56:17 +01:00
kikito
d830a07e77 first try at using hererocks for travis 2015-10-31 15:50:21 +01:00
kikito
0803eb192a make busted more verbose in travis 2015-10-13 00:02:32 +02:00
kikito
6dd3294b70 modify metamethod test to account for new initialization 2015-10-12 23:45:32 +02:00
kikito
2561f0b26b attempts to fix failing travis 2015-10-12 13:49:50 +02:00
kikito
512e6c2968 __gc metamethod for 5.3 2015-10-12 13:39:35 +02:00
Enrique García
8043c7214d Merge pull request #29 from kikito/static_index
Improve the static class lookup. Fixes #27
2015-10-12 12:51:07 +02:00
kikito
fd02469814 Improve the static class lookup. Fixes #27 2015-10-12 12:46:28 +02:00
kikito
417b042c8a first attempt at making travis work with lua 5.3 2015-10-04 21:52:46 +02:00
kikito
4b366410bd downgrades luarocks in travis 2015-09-30 23:34:28 +02:00
Enrique García
f670920820 Merge pull request #23 from kernelp4nic/patch-1
README syntax highlight
2014-04-12 17:10:51 +02:00
Sebastián Moreno
bff8fad299 README syntax highlight 2014-04-11 22:31:42 -03:00
Enrique García
a8a8298a4c Add _URL 2014-04-01 23:27:36 +02:00
Enrique García
9e0753dc04 Merge pull request #19 from neomantra/master
Fix typos and add some clarification to README.md
2014-01-17 01:44:18 -08:00
Evan
80cdff090e Fix typos and add some clarification to README.md 2014-01-16 09:38:44 -05:00
kikito
dff6af37a4 added rockspec for middleclass 3.0.0 2014-01-07 10:08:32 +01:00
kikito
e196695517 pushed 3.0.1 2013-12-06 22:04:31 +01:00
kikito
124c6d687e mention license in the README.md 2013-12-06 21:46:19 +01:00
kikito
118f4ab891 travis-ci now working with lua 5.1 and 5.2. Attempting to fix luajit 2013-12-06 21:40:49 +01:00
kikito
7a6efb3c10 another attempt at making travis work 2013-12-06 21:28:31 +01:00
kikito
26727a7417 another .travis.yml 2013-12-05 01:31:07 +01:00
kikito
bfa2a014ef another .travis.yml 2013-12-05 01:27:42 +01:00
kikito
b7b1b47980 skip 5.2 tests on 5.1 mode 2013-12-05 01:15:28 +01:00
kikito
ff1fee2a9c attempt to make travis really work with lua + 5.2+ jit 2013-12-05 01:15:08 +01:00
kenshin
b89bf82db4 supplement unit test for __len, __pairs, __ipairs 2013-12-04 18:09:54 +08:00
kenshin
151c5b2c71 new metamethod __len,__pairs,__ipairs in lua 5.2 2013-12-02 11:48:20 +08:00
Enrique García
f10637b23b Update README.md 2013-10-10 19:12:15 +02:00
kikito
1c9841b507 fix headers in README 2013-09-19 00:14:21 +02:00
kikito
0a6eb856e6 Merge branch '3.0' 2013-09-19 00:11:14 +02:00
kikito
73d3748d2d added updading from 2.0 section to readme 2013-09-19 00:10:56 +02:00
kikito
36379fd165 improved parameter error treatment 2013-09-18 23:47:07 +02:00
kikito
2208c84dae klass -> aClass 2013-09-18 23:43:53 +02:00
kikito
d15cc25194 added subclassOf, instanceOf and includes specs to object 2013-09-18 23:42:16 +02:00
kikito
f5f6bea420 updated changelog 2013-09-18 23:21:49 +02:00
kikito
1aab144c3f new README 2013-09-18 23:14:01 +02:00
kikito
08e66977d4 fixed perf tests 2013-09-18 23:13:41 +02:00