aboutsummaryrefslogtreecommitdiffstats
path: root/src
Commit message (Collapse)AuthorAgeFilesLines
* Change Objects vtable methods to take a StringOrSymbolLars Knoll2018-05-0220-85/+181
| | | | | | | This is needed for symbol support. Change-Id: I83db21f232168710d18999fd97d912016e86d630 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove String dependency from InternalClassLars Knoll2018-05-0211-80/+62
| | | | | | | | This is required, so we can also use Symbols in the internal classes. Change-Id: I630e7aa7b8b16d5a94041f8d18515fd582f94264 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Smaller cleanupLars Knoll2018-05-021-13/+12
| | | | | | | get rid of some defineProperty usages Change-Id: I683b35b3042a0ba7f1b68235acaa6325c6acf2f1 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Unify MemberData::Index and ArrayData::IndexLars Knoll2018-05-027-44/+33
| | | | | | | | Both classes basically did the same thing. Unify them in a new PropertyIndex class. Change-Id: Ieb6fb670e4d204bf20ee4c0b70b4381c95c6268e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add a StringOrSymbol intermediate class between Managed and StringLars Knoll2018-05-026-6/+30
| | | | | | | | | This introduces a common base class for Strings and Symbols giving us a unified approach to handling object properties for both. Change-Id: Ic9e5a18b084c8b730e134db990f101d47af224e3 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use Identifier by value and don't new them anymoreLars Knoll2018-05-0217-108/+113
| | | | | Change-Id: Ib25c08027013217657beb2675dafa9a8c85cbaf9 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Turn Identifier into a simple integerLars Knoll2018-05-027-26/+60
| | | | | | | | | | Add a reverse mapping table to the IdentifierHash to avoid having to store a hash value inside the identifier. This makes it possible to then use the identifiers value based and not new them on the heap anymore. Change-Id: If1f177588ea104565c6e3add49c70534a6c7dcb8 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Avoid excessive creation of contextsLars Knoll2018-05-022-1/+6
| | | | | | | | Variables do not escape if they are being used from an inner block in the same function. Change-Id: I494861edf9d8a492930797928a3137362082d084 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Cleanup handling of with() statementsLars Knoll2018-05-0210-62/+61
| | | | | | | | | | | Add a CompilerContext for with, whose only purpose it is to trigger variable lookup by name. This avoids looking up variables declared inside the with() {} block by name and we do not lookup variables outside the with block by name neither anymore. Change-Id: I52e9fb2daa9601f9e5102714c002dc506ad5ed23 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rework catch context handlingLars Knoll2018-05-0223-123/+100
| | | | | | | | | | | | Remove the need for a specialized catch context, instead use a regular block context, that also captures the catched variable. This also removes the need to do lookups by name inside a catch expression. Change-Id: I8b037add7f423922e2a76b4c0da646ca7e25813a Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for proper lexical scopingLars Knoll2018-05-0223-114/+398
| | | | | | | | | | | | | This is still to some extend work in progress as lexically scoped for loops won't yet do the right thing. let and const variables are still accessible before they are declared, and the global scope doesn't yet have a proper context for lexically declared variables. Change-Id: Ie39f74a8fccdaead437fbf07f9fc228a444c26ed Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Make sure we call Codegen::defineFunction with proper argumentsLars Knoll2018-05-023-19/+22
| | | | | | | | | | | | | | | So far, when instantiating QML bindings, the node parameter could be the same or a child of the body. This will break badly when we introduce lexical scopeing as that node could be an AST::Block that opens it's own context. Changing this requires some smaller adjustments to our autotests, as error locations will now be slightly different (pointing to the beginning of the binding, not the beginning of the RHS of the binding). Change-Id: I2c536a4fe6d8b549a138cc7967ef034eb2523f3b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove unused methodLars Knoll2018-05-021-7/+0
| | | | | Change-Id: If22845b19c72362249347083edef591f7032f468 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* The length of array like objects can in some cases be 2^53 -1 in ES7Lars Knoll2018-05-026-24/+47
| | | | | | | | | Add a Value::getLength(), that converts a Value to a length bound between 0 and 2^53-1 as per ES7 spec. Use the extended range in Array.prototype.splice and map to fix hanging test cases. Change-Id: If9280d501423cfc10a60abd4e8aa30521d2a7bca Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix classname for Error objects to be in line with ES6 expectationsLars Knoll2018-05-021-1/+1
| | | | | Change-Id: I8c437f7bc642e600358d88849330dcf64bc32ad4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Split out the generation of indices for locals and registersLars Knoll2018-05-025-32/+51
| | | | | Change-Id: I0e98ccba9ae3026cd8bfdc4cae100f280b5aa22c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Refactor variable resolvingLars Knoll2018-05-026-176/+245
| | | | | | | | | | Move variable resolving into the context, and avoid creating ExecutionContext's whereever we can. This prepares things for block scoping, where this becomes rather important to be able to achieve decent performance. Change-Id: Idf3d3c12cf348a2c3da01989c26c8529ceb36c12 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Remove the QString member from IdentifierLars Knoll2018-05-027-33/+26
| | | | | | | First step to turning identifier into a simple int. Change-Id: I4988587aa61f1f02ed80426ccbf00b685f38c829 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rename the CompilationMode enum to ContextTypeLars Knoll2018-05-0215-51/+53
| | | | | | | | | And make it an enum class. The new name fits better, as it's mainly used to determine the type of the context when parsing. Also already added the 'Block' value that will be needed. Change-Id: I70d963b6a0b22db1a3c607cce6bdd2054b29e000 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Fix destructuring of arrow function parametersLars Knoll2018-05-023-31/+54
| | | | | Change-Id: I64b49ae77ecd81eafb320cda04a1a7bf4b2dc90c Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Properly set names of most anonymous functionsLars Knoll2018-05-024-4/+67
| | | | | | | | 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>
* Fix crashes when parsing functions with no parametersSimon Hausmann2018-05-024-8/+8
| | | | | | | | | | Commit da5fffbd34d8be68f8ee4c649881dbb673c9c0a5 introduced deferencing of the formals parameter list that can be a null pointer if the declared function has no parameters. Change-Id: Id7dce0f78b16266e672f0ae430ee4f979de5734d Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Internally document the VME abbreviationMitch Curtis2018-04-271-0/+4
| | | | | | | This makes reading the code less confusing. Change-Id: Id49de8ff6645d5e1d66eb07d36c3b322dbb60c68 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Support destructuring assignmentsLars Knoll2018-04-275-38/+266
| | | | | | | | Not everything works yet, but basic destructuring assignments do. Change-Id: I5f74691fd6458092ecfde9d1a8a802f99fc57b9e Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for destructuring variable declarationsLars Knoll2018-04-273-34/+44
| | | | | Change-Id: Ia7f894fb61cfa760e253963ab4815d98103cfd9b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Use a PatternElement for VariableDeclarationsLars Knoll2018-04-2710-100/+67
| | | | | | | Required to get proper destructuring working. Change-Id: I99fc20a9f1bace1fe3981d88ce5466f9c8d98245 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Rework the AST for Literals and destructuring expressionsLars Knoll2018-04-2710-639/+408
| | | | | | | | | | | | | | | | | 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>
* Rename Array/ObjectLiteral to Array/ObjectPattern in the ASTLars Knoll2018-04-279-40/+40
| | | | | | | | | | | | 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>
* Fix a small bug in the grammarLars Knoll2018-04-271-3/+2
| | | | | Change-Id: Idf8ea5263fc4b013f4aafa40fef9bc622c1a5a91 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for 'class' to the ASTLars Knoll2018-04-277-14/+180
| | | | | Change-Id: I2a9e8fb847dfa45ca77ee43e14f39f2b2def5792 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Added support for generator functions and yield expressions to the ASTLars Knoll2018-04-2713-18/+167
| | | | | | | | | 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>
* smaller cleanupLars Knoll2018-04-272-8/+8
| | | | | | | | The VariableDeclaration constructor shouldn't specify the scope of the declared variable. Change-Id: I1368cec7c5cb8535e169c0fc20d3be4e69368b47 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for '...' in arguments lists to the ASTLars Knoll2018-04-273-3/+22
| | | | | | | No support in the codegen yet. Change-Id: I9998d7abae086660fc0457c65b6d9050933a428f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Add support for ... in ArrayLiterals to the ASTLars Knoll2018-04-273-1/+25
| | | | | | | The codegen still throws a syntax error for now. Change-Id: I8134b27d6153f6d6df81a9bafc7ae9d573085b73 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Properly mark catch statement with destructuring as unimplementedLars Knoll2018-04-271-0/+2
| | | | | Change-Id: I82cb787f068dbcc1e5410432f462eceaa3273457 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* Don't fail on pre increment operator after a newlineLars Knoll2018-04-271-2/+2
| | | | | | | | 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>
* Merge remote-tracking branch 'origin/5.11' into devQt Forward Merge Bot2018-04-2723-161/+279
|\ | | | | | | Change-Id: I280d42b8926c0cada1f35d322b80aaf2b0ef0a73
| * Fix crash when using drag with Drag.AutomaticFriedemann Kleint2018-04-262-3/+12
| | | | | | | | | | | | | | | | | | | | QQuickPointerTouchEvent::m_event is 0 when calling QQuickPointerTouchEvent::isPressEvent(). Add a convenience function with a check returning the Qt::TouchPointStates. Task-number: QTBUG-44976 Change-Id: I2433ec3c56adeda2de190ca46aed8413a1357c55 Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
| * Clarify ownership around QQmlEngine::setNAMFMårten Nordheim2018-04-261-0/+2
| | | | | | | | | | | | | | | | | | | | | | We were leaking an instance of MyNetworkAccessManagerFactory in the "NetworkAccessManagerFactory"-example. To add to this the documentation around QQmlEngine::setNetworkAccessManagerFactory did not specify whether or not it took ownership, causing confusion. Change-Id: Ic9eee2c45682c752bcb4aa98943fc0af2b630795 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
| * Fix JIT build on INTEGRITY ARM64Kimmo Ollila2018-04-266-132/+173
| | | | | | | | | | | | | | | | | | | | | | -typedef "Jump" may not be used in an elaborated type specifier -explicit specialization of function must precede its first use -"Value" is ambiguous Change-Id: Ic15c196f1b33211cd3f2f25a54ba478747336fe4 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Janne Koskinen <janne.p.koskinen@qt.io> Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
| * Enable JIT on INTEGRITY ARM64Kimmo Ollila2018-04-266-1/+36
| | | | | | | | | | | | | | | | This patch enables JIT on INTEGRITY s820Am and other ARM64 builds Change-Id: I2fa130f41a6c5bc6aa86bcfd5a01c2d431300561 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Nikola Velinov <nvelinov@ghs.com>
| * Add handling of device pixel ratio to animated spritesAllan Sandfeld Jensen2018-04-268-25/+56
| | | | | | | | | | | | | | Change-Id: I472f61241d1875daf0de0a597bf27c019314f48f Task-number: QTBUG-50119 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io> Reviewed-by: Morten Johan Sørvig <morten.sorvig@qt.io>
* | Implement support for the ** and **= operatorsLars Knoll2018-04-269-2/+66
| | | | | | | | | | Change-Id: I58a21e70fdd040175b52465d6ba52e7fceaf6398 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for 'super' and 'new.target' to the ASTLars Knoll2018-04-267-19/+90
| | | | | | | | | | | | | | Codegen will still throw a Syntax error on it though. Change-Id: I292dd166ad8cb4a62f2bcfa9637bdc76cf95bb51 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Implement support for function declarations in object literalsLars Knoll2018-04-261-1/+14
| | | | | | | | | | | | | | { foo(args) {} } now works correctly. Change-Id: Ibd271fe957a5259863af793ad74380473690f4ab Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add partial support for computed property namesLars Knoll2018-04-266-7/+74
| | | | | | | | | | | | | | | | Computed property names currently work in object literals and destructuring arguments. Change-Id: I9dc5bc61b45139ef1836072695ea2fe1ce4994ae Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Don't error on duplicate property names in object literalsLars Knoll2018-04-261-15/+3
| | | | | | | | | | | | | | | | | | | | | | | | This has been relaxed from ES5. In ES8 this is actually allowed even in strict mode. According to the spec we are to evaluate all rhs expressions, but assign the last one used in the object literal. The spec probably required this relaxation to be able to handle computed property names. Change-Id: Ia1b02010b7541946029951b36e5457a07fdee818 Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Add support for shorthand property names in object literalsLars Knoll2018-04-261-1/+12
| | | | | | | | | | | | | | "var x = 20; var o = {x}" works now. Change-Id: I8dd64bea0bc6191590592c80883716810052773f Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
* | Fix length property of Function objectsLars Knoll2018-04-266-4/+26
| | | | | | | | | | | | | | | | | | | | | | 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>
* | More correct iteration over the ASTLars Knoll2018-04-261-1/+7
| | | | | | | | | | | | | | Correctly iterate over the content of FormalParameterLists. Change-Id: Ia1c9cb94d161fb0aa5b9dfa347a00499c907e77b Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>