Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed / Implemented debug messages for "normal" methods. #149

Merged
merged 13 commits into from
Aug 21, 2016

Conversation

Kanaye
Copy link
Collaborator

@Kanaye Kanaye commented Aug 20, 2016

This is a huge PR because I had to fix some jsdoc and internal usage of functions, so that they don't throw errors.

Please take a look at the messages and diffs of the commits and not the whole diff.
The (imho) interesting commits are:
7f337f7
fbb8831
6667249

The other commits are mostly fixes of jsdoc params and internal usage of the methods that differ from the docs.

This enables debug messages for normal methods (on param misuse, I'll implement custom errors from methods after this is merged).
I've tested it against the tests (only tests that misuse the API are throwing messages) and the shopping-example. In the shopping example only one observable that is initialized without a parameter throws a message (is this a bug in the shopping-example or should all params of the obervable be optional ?).

I also updated jscore to astoilkov/jscore#5.

Btw. I should have time to work a bit on js(blocks|core|value) in the next few weeks 😄 so expect so more PRs.

Edit: If there is a repository for jsdebug (because it looks kinda "built") please point me to it and I'll backport the changes.

Joscha Rohmann added 13 commits August 15, 2016 22:45
Images are deprecated on most browsers console.
lib/blocks/core: updated to commit ff19ee08e3107367f5584b745bd2a7a3aa8ce281

build/taks/debug: Re-added code generation for debug-messages.
	Inserting statement to enable blocks.debug after the rest of the
	framework initialized (jsdeug requires functions that aren't
	initialized when jsdebug is first called.)
	Added statement to not insert jsdebug argument checks in functions
	that don't have parameter docs.

lib/blocks/jsdebug:
	Fixed type of observables (in @param jsdoc observables are called
	"blocks.observable" not "blocks.observable()" as the code
	expected).
	Changed "enabled" to default to false (will be set to true after
	framework initialization).
…ap th

not finished observable in "blocks.extend" while blocks.extend is copying
the base methods, etc. to the observable.

Will be fixed as soon as I have a better plan.
But also added "if (var)" wraps to some internal calls and added some
default values to prevent jsblocks from throwing debug errors internally.
Now optional arguments get skipped when there are less arguments than
possible params.

Example of the previous behaviour:

Imagine a signature like that: testFunction([bool1: bool], bool2: bool,
someString: String);

And a call like this: ``testFunction(true, "test");``

We would have printed: "Arguments mismatch: testFunction([bool1], bool2,
someString) - String specified where bool expected ..."
with bool2 marked red.

Now we're skipping the first argument and print nothing.
…nting

params double if a param has been specified.
"blocks.debug.resume()" and used it at some methods.
This is mostly a fix for observables because blocks.debug.chackArgs unwraps observables that
aren't ready (e.g. in initialisation or when there context get bound to a
view).
That's the default in most languages/libraries and that's also how (most=
of our methods work.
@astoilkov
Copy link
Owner

This is really nice.

Regarding jsdebug: Nope. There isn't another repository. If you feel the code for jsdebug being in lib folder strange you could move it somewhere else. I just don't see any other more appropriate place.

@astoilkov astoilkov merged commit 29b4ac2 into astoilkov:master Aug 21, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants