-
-
Notifications
You must be signed in to change notification settings - Fork 103
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
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
This is really nice. Regarding jsdebug: Nope. There isn't another repository. If you feel the code for jsdebug being in |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.