forked from qt-creator/qt-creator
		
	QmlJS reformatter: Fix object literals.
The comma token seems to be invalid. Change-Id: I859fa58ba0ba1e975e0cf1105c2b53aac848fb0d Reviewed-by: Leandro Melo <leandro.melo@nokia.com>
This commit is contained in:
		| @@ -667,7 +667,7 @@ protected: | ||||
|             out(": ", ast->colonToken); | ||||
|             accept(it->value); | ||||
|             if (it->next) { | ||||
|                 out(ast->commaToken); | ||||
|                 out(",", ast->commaToken); // always invalid? | ||||
|                 newLine(); | ||||
|             } | ||||
|         } | ||||
| @@ -1117,8 +1117,6 @@ protected: | ||||
|  | ||||
|     virtual bool visit(FunctionExpression *ast) | ||||
|     { | ||||
|         if (!firstOnLine()) | ||||
|             newLine(); | ||||
|         out("function ", ast->functionToken); | ||||
|         if (!ast->name.isNull()) | ||||
|             out(ast->identifierToken); | ||||
|   | ||||
| @@ -6,8 +6,7 @@ function foo(a, b) { | ||||
|     x += 4 | ||||
| } | ||||
|  | ||||
| var foo = | ||||
|         function (a, b) {} | ||||
| var foo = function (a, b) {} | ||||
|  | ||||
| while (true) { | ||||
|     for (var a = 1; a < 5; ++a) { | ||||
|   | ||||
							
								
								
									
										12
									
								
								tests/auto/qml/reformatter/objectliteral.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								tests/auto/qml/reformatter/objectliteral.js
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,12 @@ | ||||
| var x = { | ||||
|     x: 12, | ||||
|     y: { | ||||
|         x: 12, | ||||
|         y: "abc", | ||||
|         z: function (x) { | ||||
|                return a | ||||
|            }, | ||||
|         abc: 15 | ||||
|     }, | ||||
|     z: 12 | ||||
| } | ||||
| @@ -81,7 +81,7 @@ void tst_Reformatter::test() | ||||
| { | ||||
|     QFETCH(QString, path); | ||||
|  | ||||
|     Document::Ptr doc = Document::create(path, Document::guessLanguageFromSuffix(path)); | ||||
|     Document::MutablePtr doc = Document::create(path, Document::guessLanguageFromSuffix(path)); | ||||
|     QFile file(doc->fileName()); | ||||
|     file.open(QFile::ReadOnly | QFile::Text); | ||||
|     QString source = QString::fromUtf8(file.readAll()); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user