1
0
Fork 0
Commit Graph

1097 Commits (textend)

Author SHA1 Message Date
Mike Gerwitz e67c14e8c3
Added support for static proxy methods
When the static keyword is provided, the proxy will use the static accessor
method to look up the requested member.
2012-05-03 14:13:47 -04:00
Mike Gerwitz d84b86b21b
Added `proxy' keyword support
The concept of proxy methods will become an important, core concept in ease.js
that will provide strong benefits for creating decorators and proxies, removing
boilerplate code and providing useful metadata to the system. Consider the
following example:

  Class( 'Foo',
  {
      // ...

      'public performOperation': function( bar )
      {
          this._doSomethingWith( bar );
          return this;
      },
  } );

  Class( 'FooDecorator',
  {
      'private _foo': null,

      // ...

      'public performOperation': function( bar )
      {
          return this._foo.performOperation( bar );
      },
  } );

In the above example, `FooDecorator` is a decorator for `Foo`. Assume that the
`getValueOf()` method is undecorated and simply needs to be proxied to its
component --- an instance of `Foo`. (It is not uncommon that a decorator, proxy,
or related class will alter certain functionality while leaving much of it
unchanged.) In order to do so, we can use this generic, boilerplate code

  return this.obj.func.apply( this.obj, arguments );

which would need to be repeated again and again for *each method that needs to
be proxied*. We also have another problem --- `Foo.getValueOf()` returns
*itself*, which `FooDecorator` *also* returns.  This breaks encapsulation, so we
instead need to return ourself:

  'public performOperation': function( bar )
  {
      this._foo.performOperation( bar );
      return this;
  },

Our boilerplate code then becomes:

  var ret = this.obj.func.apply( this.obj, arguments );
  return ( ret === this.obj )
      ? this
      : ret;

Alternatively, we could use the `proxy' keyword:

  Class( 'FooDecorator2',
  {
      'private _foo': null,

      // ...

      'public proxy performOperation': '_foo',
  } );

`FooDecorator2.getValueOf()` and `FooDecorator.getValueOf()` both perform the
exact same task --- proxy the entire call to another object and return its
result, unless the result is the component, in which case the decorator itself
is returned.

Proxies, as of this commit, accomplish the following:
  - All arguments are forwarded to the destination
  - The return value is forwarded to the caller
    - If the destination returns a reference to itself, it will be replaced with
      a reference to the caller's context (`this`).
  - If the call is expected to fail, either because the destination is not an
    object or because the requested method is not a function, a useful error
    will be immediately thrown (rather than the potentially cryptic one that
    would otherwise result, requiring analysis of the stack trace).

N.B. As of this commit, static proxies do not yet function properly.
2012-05-03 09:49:22 -04:00
Mike Gerwitz bd0158928c
Added signchk tool
This tool can help to ensure that commits have not been falsely authored. For
example, if you receive an ease.js repository from a friend, there is no way to
verify that a commit from "Mike Gerwitz" is actually a commit from myself unless
it has been signed using my private key. This additional check will help to
ensure the integrity of the repository.

Please note that automated systems should *not* invoke this utility directly
from this repository, unless it is invoked using a previously trusted commit.
Otherwise, an attacker need only alter the script to competely evade the check.
2012-04-18 23:46:50 -04:00
Mike Gerwitz 1b17900294 Resolved version test error caused by verset commit 2012-04-06 00:21:05 -04:00
Mike Gerwitz bc44bfd8e9 Set version to 0.2.0-dev 2012-03-05 22:55:14 -05:00
Mike Gerwitz 3740e0c9e0 manual.texi now looking for version.texi 2012-03-05 22:55:08 -05:00
Mike Gerwitz 2adcf8bb0e Added verset
After dealing with autoconf, I may decide not to implement it. The build process
is fairly simple as it is and I do not want to over-complicate it. verset solves
one of the issues that autconf would have aided in addressing - setting a
version number.
2012-03-05 22:54:12 -05:00
Mike Gerwitz 22005e396e Added missing closing parenthesis in Visibility Object Implementation section of manual 2012-01-19 23:25:47 -05:00
Mike Gerwitz 0ceffe2146 Visibility Object Implementation doc correction 2012-01-19 23:24:56 -05:00
Mike Gerwitz fa9dbcbf2e [Fix #37] constructor property now properly set on instances 2012-01-19 23:21:04 -05:00
Mike Gerwitz 9dbd0d1fb3 Added constructor property to reserved members list 2012-01-17 23:36:01 -05:00
Mike Gerwitz 958521f673 Created version module to provide additional version information 2011-12-23 18:31:11 -05:00
Mike Gerwitz 4627958247 Updated version in documentation and package.json to v0.1.0
- We are nearly there. Happy holidays and happy new year from ease.js ;)
2011-12-23 00:09:11 -05:00
Mike Gerwitz cdbcada4d2 Copyright year update 2011-12-23 00:09:11 -05:00
Mike Gerwitz f264c1bf63 Added version number to exports 2011-12-23 00:03:08 -05:00
Mike Gerwitz 0dca143bdd Added {Abstract,Final}Class to index test 2011-12-23 00:03:08 -05:00
Mike Gerwitz bc22a9be27 Added reduced license header for minified files and updated copyright 2011-12-22 23:49:53 -05:00
Mike Gerwitz 0739f983c7 Quoting keyword for consistency and to avoid potential minification issues 2011-12-22 23:40:39 -05:00
Mike Gerwitz 05ad90e7f7 Updated README.md to remove npm unavailibility mention
- I had added the project to npm to reserve the name. Besides, the release is soon enough.
2011-12-22 23:36:15 -05:00
Mike Gerwitz 17047b53e9 Getters/setters will now trigger warnings if attempting to override without super getter/setter 2011-12-22 23:36:15 -05:00
Mike Gerwitz bcb0bcbe80 Added static validations for getters/setters 2011-12-22 23:36:15 -05:00
Mike Gerwitz db84c6fc6e Added virtual and override restrictions to getters/setters 2011-12-22 23:36:12 -05:00
Mike Gerwitz 9942ac9743 const getters/setters are unsupported (simply omit the setter) 2011-12-22 22:48:17 -05:00
Mike Gerwitz 4ada84e3b7 Abstract getters/setters are not yet supported
- Perhaps in future versions. The implementation details will not be ironed out before v0.1.0 and we can easily add it in the future without breaking BC. Getters/setters have not had too much attention thusfar in ease.js due to testing with systems that must work across many environments, including pre-ES5.
2011-12-22 22:46:02 -05:00
Mike Gerwitz 6295b83ec7 util.clone() primitive fix (broken in recent commit)
- null is considered to be type "object" by instanceof
2011-12-22 09:37:34 -05:00
Mike Gerwitz 021b67bbff Whoops - abstract member param names may now contain underscores 2011-12-22 09:10:51 -05:00
Mike Gerwitz ac837107c5 Corrected terms in Abstract Members section of documentation
- "Parameters" instead of "arguments"
- "Declaration", not "definition"
2011-12-21 20:13:42 -05:00
Mike Gerwitz a10cf82a12 Abstract member declaration parameter name restrictions now apply to all abstract member declarations, not just interfaces 2011-12-21 20:12:05 -05:00
Mike Gerwitz 50904390da Interface members may now only contain arg names that are valid var names
- This should apply to all abstract definitions. This will be resolved in the next commit. I am tired.
2011-12-20 23:56:46 -05:00
Mike Gerwitz e9cf630d0b AbstractClass.implement().extend() will now properly preserve abstract flag on resulting class
- This is a bug fix. The resulting class was not declared abstract, which is a problem if the resulting class chose not to provide a concrete implementation for each of the abstract members.
2011-12-20 20:06:38 -05:00
Mike Gerwitz 2136ebedd5 Now properly handling extending from objects and properly throwing errors for scalars 2011-12-15 22:58:33 -05:00
Mike Gerwitz d5ef3eb221 Minor documentation correction (>= to >) 2011-12-15 21:21:46 -05:00
Mike Gerwitz 4479ea84af Ignoring webroot
- May be left over from switching branches
2011-12-15 19:20:56 -05:00
Mike Gerwitz 9117b2e4cf Updated package.json to remove deps and correct license
Growing much closer to releasing. Hopefully in the next couple of days; I just
don't want to rush it. Though, at the same time, I've been noticing projects
popping up with very similar / exact names to this one. A project named "ease"
was added to the npm repository and another "ease.js" is on GitHub, although
it's made no progress. As such, I want to ensure I reserve the name in npm.

I've been testing the new library and work and noticed only a couple minor
issues, primiarly due to misuse of the library. Looking good.
2011-12-13 22:03:55 -05:00
Mike Gerwitz e24784529e Resolved majority of Closure Compiler warnings (VERBOSE)
- Ignored warnings from tests for now
- VERBOSE flag removed from Makefile for now until I can figure out how to
  resolve certain warnings
2011-12-13 21:19:14 -05:00
Mike Gerwitz 3922d6874e Added mkexterns for internal externs (see comments within file for information as to why this is necessary) 2011-12-10 16:46:14 -05:00
Mike Gerwitz d1b1d2691a Fixed initial warnings provided by Closure Compiler
Getting ready for release means that we need to rest assured that everything is
operating as it should. Tests do an excellent job at aiding in this, but they
cannot cover everything. For example, a simple missing comma in a variable
declaration list could have terrible, global consequences.
2011-12-10 11:18:41 -05:00
Mike Gerwitz 45f3d62727 Removing toString() call on failAssertion(); string may be passed 2011-12-07 23:14:15 -05:00
Mike Gerwitz e0254f6441 Removed invalid @package tags
Not a valid tag in jsdoc
2011-12-06 20:19:31 -05:00
Mike Gerwitz 66fd2ece83 Switched to Closure Compiler
This is nothing against uglify. Rather, here's the story on this:

Commit e4cd1e fixed an error that was causing minified files to break in IE.
This was due to how IE interprets things, not how UglifyJS was minifying them.
Indeed, Closure Compiler had the exact same problem.

The decision to move to Closure Compiler was due to a variety of factors, which
came down to primarily feature set and tests. Closure Compiler is well tested
and maintained. It also includes a number of additional, beneficial features.
UglifyJS is an excellent project and I would recommend it to anyone, but it is
not tested (no unit tests; it's tested by ensuring common libraries like jQuery
run after minification). It is, however, significantly faster.

It's likely that, in the future, once I add autoconf for the build process to
configure certain settings, that I will add UglifyJS as an option. I'm sure many
people would prefer that, especially those who dislike Java and do not wish to
have it installed. Hopefully those that do decide to install Java will go with
openjdk, not Oracle's proprietary implementation.
2011-12-06 18:28:58 -05:00
Mike Gerwitz 58f2e3afc4 Made necessary changes to tests to prevent Closure Compiler from optimizing them away, causing test failures 2011-12-06 18:28:16 -05:00
Mike Gerwitz a18dedbddb Added missing client-side "fail" assertion 2011-12-06 18:27:41 -05:00
Mike Gerwitz e385a9c8fb MemberBuilderValidator tests now properly wrap certain functions (they were working, but let's be safe) 2011-12-06 18:27:20 -05:00
Mike Gerwitz e4cd1eabe5 Fixed issue with minified files in IE
Ah - you have to love those "ah-ha!" moments. The issue here is that both
uglify-js and closure compiler mangled the names in such a way that the var and
the function name had different values. In the case of closure compiler, the
function name was used to instantiate the constructor if the 'new' keyword was
omitted. This worked fine in all other tested browsers, but IE handles it
differently.
2011-12-06 18:20:43 -05:00
Mike Gerwitz 74dd239de0 Corrected errors/warnings as indicated by Google Closure compiler 2011-12-04 19:26:53 -05:00
Mike Gerwitz f39fc05ae2 test/inc-*.js files will now be recognized by make to rebuild combined file 2011-12-04 19:13:51 -05:00
Mike Gerwitz e86ed63fd8 Fixed trailing comma issue in test
- Caused problems in IE6
- Comma stripping script did not catch it due to trailing comments
2011-12-04 13:06:28 -05:00
Mike Gerwitz 1a3b5f2893 Now using vm module in node instead of process.binding.Script (deprecated in newer versions of node) 2011-12-04 12:55:00 -05:00
Mike Gerwitz 27eea93d6f Now setting mocked console in warn module for tests
- Replacing console broken in newer versions of node/v8
- Replacing console.warn/log works fine, but is a poor choice for testing
2011-12-04 12:54:56 -05:00
Mike Gerwitz 0f4ce6acc1 Warning test workaround for FF
- Note that warnings do work properly in practice in FF
2011-12-04 11:38:24 -05:00