Commit Graph

200 Commits

Author SHA1 Message Date
kikito
3527b5cab9 eliminates innecessary metatable setting 2015-12-31 18:52:39 +01:00
kikito
958cae6c1c restores :allocate and adds more documentation 2015-12-31 00:47:37 +01:00
kikito
4789a39d14 update changelog 2015-12-28 10:58:49 +01:00
kikito
7894eb7790 Refactor & remove class:allocate 2015-12-27 23:53:10 +01:00
kikito
fc61416c81 first green version using unified method/metamethod resolver 2015-12-27 15:42:49 +01:00
kikito
13173150de adds coveralls badge 2015-12-27 12:51:50 +01:00
kikito
8baac4b8f0 attempts to exclude files from luacov 2015-12-26 13:27:36 +01:00
kikito
2e069c5e5b separates before_install & install steps in travis 2015-12-26 13:11:58 +01:00
kikito
052840502b attempts to use luacov 2015-12-26 13:04:33 +01:00
kikito
0f20fc4288 removes default includes(mixin) method and __mixins attribute 2015-12-13 01:13:49 +01:00
kikito
d5776a20ed makes Object a mixin instead of a global variable 2015-12-13 01:06:23 +01:00
kikito
79a7e02954 Merge branch 'index-newindex' of https://github.com/mpeterv/middleclass into mpeterv-index-newindex 2015-12-10 09:25:13 +01:00
mpeterv
ab1699bb05 Do not wrap __newindex 2015-11-28 18:10:35 +03:00
mpeterv
7574380519 Add tests for custom __index and __newindex 2015-11-24 18:48:17 +03:00
mpeterv
227705b3ec Support __index and __newindex metamethods
Separate instance dictionary and instance metatable.
When defining a metamethod and it's __index or __newindex,
wrap it in a function, so that it's used only when the key
is missing in the whole dictionary chain.

class.__metamethods table is now redundant; raw access of instance
dictionary can be used to check if a metamethod is defined in a class.
2015-11-24 18:26:53 +03:00
kikito
0ffa9094c0 add 3.2.0 rockspec 2015-11-23 23:39:54 +01:00
kikito
28c745f99e bump version to 3.2.0 2015-11-23 23:37:54 +01:00
kikito
15f6c82c50 Refactoring and renaming 2015-11-23 23:20:20 +01:00
kikito
3de0dc2166 propogate -> propagate 2015-11-23 22:47:50 +01:00
mpeterv
524d0ddc8c Fix not inheriting metamethods from grandparent class 2015-11-23 15:42:49 +03:00
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