forked from robertkrimen/otto
-
Notifications
You must be signed in to change notification settings - Fork 0
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
UPdating OTTO #2
Draft
alongir
wants to merge
26
commits into
master
Choose a base branch
from
updated-ver
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
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
runtime.newErrorObject is used to implement the Error constructor, and as such it takes input from JavaScript via calls like `new Error('xxx')`. The actual underlying error information is stored in an ottoError object, which is constructed using newError. newError takes a couple of mandatory arguments, then treats the remaining parameters (collected as `in ...interface{}`) as a printf-style format string and parameter list, which it uses to populate the message field of the returned ottoError object. newErrorObject was passing the message parameter from the Error function exposed to JavaScript directly through to newError as the first optional parameter, which led to it being treated as a format string, which resulted in any code like `throw new Error('%s')` behaving incorrectly, with the resultant error having a message like "%!s(MISSING)". This change fixes this behaviour in the least intrusive way I could find, and adds some tests to make sure it doesn't come back. The logic for newErrorObject and newErrorObjectError are very similar, so it was tempting to try to merge them, but it appears they're used in somewhat fragile ways with very little test coverage so I'll leave that as a problem for another day.
Ignore errors when converting a property name to the key type for goMapObject during a getOwnProperty operation, as a property which fails conversion to the target's key type could not possibly be a member of it. fixes robertkrimen#488
Fix lint failures introduced by new 1.53 linters * Remove naked returns * Accept times using local time where intended * Allow unused parameter for now on call method * Disable depguard which just seems to be noise Also: * Correct typo so we use the specified golangci-lint version in CI.
Fix IfStatement Idx0 to point to the right place. I was pointing to the right parenthesis after the test expression.
Fix Idx0 of ForStatement and ForInStatement to point to the right place which were previously not set.
Fix Idx1 of ObjectLiteral so that it points to the character immediately after the right brace. Fix Idx1 of ArrayLiteral so that it points to the character immediately after the right bracket.
Fix Idx1 of ConditionalExpression so that it points to the next character after alternate expression. Fix Idx1 of SequenceExpression to return Idx1 of the last sequence element, not first. Fix Idx0 of unary expression to point to the start of operand in case of a postfix operator. Fix Idx1 of VariableExpression so that it points to the character right after the name literal if the expression does not have an initializer.
Fix the positions of various statements: * Fix Idx1 of BranchStatement so that it points to the character after the label if Label exists, or the one after Token if Label does not exist. * Fix Idx1 of LabelledStatement so that it points to the character after the statement. * Fix Idx1 of ReturnStatement so that it points to the character after the argument if Argument exists, or the one after return keyword if Argument does not exist. * Set Idx0 of SwitchStatement and fix Idx1 of SwitchStatement so that it points to the character after the right brace. * Fix Idx0 of ThrowStatement to point to the start of throw keyword and fix Idx1 of ThrowStatement so that it points to the next character after Argument. * Fix Idx1 of TryStatement to point to the character after Finally if Finally exists, or after Catch if Finally does not exist. * Set Idx0 of WithStatement which was not previously set. * Set WhileStatement.While so that Idx0 points to the right place. * Set Idx0 of DoWhileStatement and fix Idx1 to point to the next character after the right parenthesis.
Fix Begin of Comment to point to the position of the opening slash.
Adds startsWith method to the String builtins.
Update go, golangci-lint and action versions. Address new lint failures flagged by updated golangci-lint version.
Adds support for `Object.values()`
Add support for trailing comma after the last argument of a method call.
Fix the checks for ID_Start & ID_Continue to match the definitions in https://www.unicode.org/reports/tr31/
In the specific corner case where a regex contains a flag but is not followed by any symbols, the ast.RegExpLiteral.Literal value would drop (part of) that flag. This happens because the p.next() call during the parsing of the flag wouldn't actually advance the p.chrOffset, and thus endOffset would be erroneously adjusted. The fix is just to use the current p.chrOffset and then call p.next() afterwards.
Update underscore to 1.13.7
Update to the oldest supported release of go v1.22 at this time. Update golangci-lint to 1.61.0 and address all issues. Update actions to the latest versions.
Fix string slice and replace so they work correctly with utf8 characters. Fixes robertkrimen#534
Update goreleaser args to use the new non-deprecated --clean.
Clean up readme apply fixes flagged by markdown linter and updating URLs.
avoid panic-ing when the error type isn't recognized
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.
No description provided.