| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
|
|
|
| |
Don't throw a syntax error when encountering a destructuring
pattern.
Change-Id: I93250a2963d2d50ff61d725229e1b51be17689e9
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I3a8c15fe221bff04a3b9b21ed8c0b06c04770a3d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
| |
Fix destructuring targets that are complex lhs expressions.
There are still some failures remaining, but this fixes
another larger chunk of test cases.
Change-Id: Icf08f42d7c70d4e81be5d5d2e27ebe6249d25467
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
We need to iterator over elisions at the end, as those could
trigger side effects by calling iterator.next()
Change-Id: Ieb5fa3562b6e60fdf179fa228510b2eeaaf9da30
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Fix parsing of
var { x = function(){} } = ...
Change-Id: I524e39c7a556c392a5359eafc445b59020ccadf2
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
If the anonymous function is bound to an identifier, set the
name to the identifier.
Change-Id: Idbb3170210e6f91cca3c9bd36b2b6ddcb3a50c7b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
This got changed in ES8, but let's already take this in now,
as there are quite a few tests checking this behavior.
Change-Id: I73f86b8fd8a681881bcc9cc3132bef1589d5194f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Fix the grammar to be compliant with the spec in this case.
Change-Id: I5740c9427db6f5c6c2551d4e23f1f14070e497fb
Reviewed-by: Robin Burchell <robin.burchell@crimson.no>
|
|
|
|
|
|
| |
Task-number: QTBUG-67476
Change-Id: Ia8c6863ad35c8a92298e5dffd750d17628200573
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I70ca83b0ce933d64dad4984a236e48592e989742
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
Create a Block scope per iteration as defined in the ES spec. So
closures created inside the loop will remember the iteration variable
at that loop iteration.
Add support for destructuring of the left hand side expression or
declaration.
Change-Id: Id06ef94e2a4b93646827da4f6ce922eb436e5a31
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
This saves quite some duplicated code, but requires a bit of care
when iterating over the AST.
Change-Id: Ic530de4be8b36b4079c9d544b4b77982c3b8be60
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Ib60b56ac6a7111446e01235564a4cf92ad8ad025
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The support is basically at the same level as for for-in
at the moment.
Currently unimplemented:
* Destructuring
* Proper lexical scoping
* calling iterator.throw()/return() when required
Change-Id: If193ce0b054c4315fc16b7e174334a31b2730dcf
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add support for ES6 generators. Those are currently
always executed in the interpreter (we never JIT them),
to simplify the initial implementation.
Most functionality, except for 'yield *' expressions
are supported. 'yield *' will have to wait until we
support for(... of ...)
Change-Id: I7c059d1e3b301cbcb79e3746b4bec346738fd426
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Idbd34a8c87a52ec78d5680bfab0a75d1430bb0b0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
yield is an expression and as such does not have to be followed
by a semicolon, so don't require one.
This triggered another bug, where we had a conflict between the empty
StatementListOpt rule and all other rules that had an
ExpressionStatementLookahead (which is also an empty rule).
Change-Id: I37a94e534e5b4b6629155ddb4344d6daa2b864ec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
It has a non-default copy ctor.
This is in fact a false positive, since the copy ctor just explicitly
copies all the members...
Detected by GCC8.
qqmljsparser.cpp: In member function ‘void QmlJS::Parser::reallocateStack()’:
qqmljsparser.cpp:68:104: warning: ‘void* realloc(void*, size_t)’ moving an object of non-trivially copyable type ‘class QStringRef’; use ‘new’ and ‘delete’ instead [-Wclass-memaccess]
Change-Id: Ica88740006374d83f25e20a3af58de524b552ce9
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
|
|
|
| |
The parser was throwing a syntax error on 'function* X() {}' because
of a shift-reduce conflict that wasn't properly reported by qlalr.
Change-Id: Ifa55a569178e347346d49acd08c702f692e327dd
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Adding the grammar back to OTHER_FILES after it was removed with commit
1ea05eb7755e9e39f79ab982afa5c652f755d3e2.
Change-Id: Ic291ac70c6d3ba7b68f4167ff993cdfed2c3ef69
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
|
|
|
|
|
| |
Change-Id: I89973ef22fc0eeb67dd3f8219e7b4d6fa02ddaf0
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I0b7979db7aa6c39ff08b7b6cc08dfa635e97846d
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I2ff1d238998e752c75e9136c1d392b407ea57fec
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I64b49ae77ecd81eafb320cda04a1a7bf4b2dc90c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
In ES6, anonymous functions assigned to a variable/property with
a known name, inherit the name of that variable/property.
Change-Id: I79479b9358b24d610e3e696eb19fe0ec4aee15d1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Not everything works yet, but basic destructuring
assignments do.
Change-Id: I5f74691fd6458092ecfde9d1a8a802f99fc57b9e
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Ia7f894fb61cfa760e253963ab4815d98103cfd9b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Required to get proper destructuring working.
Change-Id: I99fc20a9f1bace1fe3981d88ce5466f9c8d98245
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Array/ObjectLiterals and destructuring expressions are
syntactically very similar. In some cases (when using
a destructuring expression as the lhs of an assigment),
the parser needs to convert the literal into a destructuring
expression.
To support these, use the same data structures for both in
the AST. Those Patterns can be converted with little
additional work from a Literal to an AssignmentPattern and
be used in all places where we need destructuring in addition
to literals.
Change-Id: I177599b46eab0f6e8cb2a40c3b3b11ed00a07d6a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
| |
To get a consistent representation in the AST, we need to unify
the AST that is generated by theObjectLiterals, ObjectBindingPattern
and ObjectAssignmentPattern rules in the grammar. Like this we
can avoid having to reparse part of the source code, and instead
replace this with consistency checks once we know which of the
three grammars are supposed to apply.
Change-Id: Ib90f521f9595db6bcad446e40de9b912bab3da7c
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Idf8ea5263fc4b013f4aafa40fef9bc622c1a5a91
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I2a9e8fb847dfa45ca77ee43e14f39f2b2def5792
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
Some smaller changes to the codegen are included as well to ensure
that we catch all uses of generators and properly throw an unimplemented
error on them for now.
Change-Id: Ib915a0e862e128644ff00dfe989507783c912c66
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
The VariableDeclaration constructor shouldn't specify the scope
of the declared variable.
Change-Id: I1368cec7c5cb8535e169c0fc20d3be4e69368b47
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
No support in the codegen yet.
Change-Id: I9998d7abae086660fc0457c65b6d9050933a428f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
The codegen still throws a syntax error for now.
Change-Id: I8134b27d6153f6d6df81a9bafc7ae9d573085b73
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I82cb787f068dbcc1e5410432f462eceaa3273457
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
In some valid cases, the lexer would add an automatic semicolon
before the ++/-- operators even if it shouldn't.
Change-Id: I2935259fd98a4c7f3f929cc1cecea85f7dde8016
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: I58a21e70fdd040175b52465d6ba52e7fceaf6398
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Codegen will still throw a Syntax error on it though.
Change-Id: I292dd166ad8cb4a62f2bcfa9637bdc76cf95bb51
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
{ foo(args) {} } now works correctly.
Change-Id: Ibd271fe957a5259863af793ad74380473690f4ab
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
Computed property names currently work in object literals
and destructuring arguments.
Change-Id: I9dc5bc61b45139ef1836072695ea2fe1ce4994ae
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
"var x = 20; var o = {x}" works now.
Change-Id: I8dd64bea0bc6191590592c80883716810052773f
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
| |
According to ES6, the length property is the number of
required arguments, ie. the number of arguments until the
first arg that has adefault parameter.
Also fix a crash when parsing a parameterlist with a trailing comma.
Change-Id: I4f6b2be4feae7b513388be66b43b160bb3cc77f1
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
| |
Correctly iterate over the content of FormalParameterLists.
Change-Id: Ia1c9cb94d161fb0aa5b9dfa347a00499c907e77b
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Arrow parameter lists are tricky and require some reparsing
by the standard to avoid conflicts in the parser with
expression statements.
Add an IsArrowFunction flag to the CompiledData::Function. This
information is required in the runtime, when creating Function
objects, as it does influence their behaviour in subtle ways.
Change-Id: I298801b091f98e30a9269d3c77d9ff94e519dabc
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
| |
This requires some interaction between parser and
lexer as static is only recognized as a keyword
directly in the class declaration.
Change-Id: Ib64157ae6ad542706a5eee8ff4ec7f9cb79a62c3
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
| |
Change-Id: Ib228925db9285e61acebc79f881acfbc2de9ff16
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This basically updates all grammar rules in the
qqmljs.g file to be in line with the ES7 specification.
Some special handling for the lookahead rules appearing
in the spec was needed and is implemented through empty
lookahead rules in the grammar, that might push an
additional token into the token stream.
Renamed some classes in the AST to be in line with
the names used in ES7, and removed some other ones
(SourceElements) that are no longer used.
The ES7 grammar rules contain lots of variations of
the base rules (with In/Return/Yield/Default suffixes).
With the exception of the In and Default rules, these
are implemented through state tracking in the parser
and lexer.
Change-Id: I4017d97cd050ed816c1dad11833e882cba30801a
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|
|
|
|
|
|
|
|
| |
To bring the naming in line with the naming used in the
ES7 grammar specification.
Change-Id: Ie996bba5fb7d08e0790a8e55d3de62961a7257a8
Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
|