Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2331)

Side by Side Diff: pkg/analyzer/test/generated/all_the_rest.dart

Issue 681833003: Remove any unnecessary parens around expressions in interpolations. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 // This code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.all_the_rest_test; 8 library engine.all_the_rest_test;
9 9
10 import 'dart:collection'; 10 import 'dart:collection';
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 if (lexeme.startsWith("<?")) { 364 if (lexeme.startsWith("<?")) {
365 return ht.TokenType.DIRECTIVE; 365 return ht.TokenType.DIRECTIVE;
366 } 366 }
367 if (_isTag(lexeme)) { 367 if (_isTag(lexeme)) {
368 return ht.TokenType.TAG; 368 return ht.TokenType.TAG;
369 } 369 }
370 return ht.TokenType.TEXT; 370 return ht.TokenType.TEXT;
371 } 371 }
372 JUnitTestCase.fail( 372 JUnitTestCase.fail(
373 "Unknown expected token $count: ${(expected != null ? expected.runtimeTy pe : "null")}"); 373 "Unknown expected token $count: ${expected != null ? expected.runtimeTyp e : "null"}");
374 return null; 374 return null;
375 } 375 }
376 376
377 bool _isTag(String lexeme) { 377 bool _isTag(String lexeme) {
378 if (lexeme.length == 0 || !Character.isLetter(lexeme.codeUnitAt(0))) { 378 if (lexeme.length == 0 || !Character.isLetter(lexeme.codeUnitAt(0))) {
379 return false; 379 return false;
380 } 380 }
381 for (int index = 1; index < lexeme.length; index++) { 381 for (int index = 1; index < lexeme.length; index++) {
382 int ch = lexeme.codeUnitAt(index); 382 int ch = lexeme.codeUnitAt(index);
383 if (!Character.isLetterOrDigit(ch) && ch != 0x2D && ch != 0x5F) { 383 if (!Character.isLetterOrDigit(ch) && ch != 0x2D && ch != 0x5F) {
(...skipping 4114 matching lines...) Expand 10 before | Expand all | Expand 10 after
4498 JUnitTestCase.assertNotNull(result.value); 4498 JUnitTestCase.assertNotNull(result.value);
4499 DartObjectImpl value = result.value; 4499 DartObjectImpl value = result.value;
4500 JUnitTestCase.assertTrue(value.isUnknown); 4500 JUnitTestCase.assertTrue(value.isUnknown);
4501 } 4501 }
4502 4502
4503 void _checkInstanceCreationOptionalParams(bool isFieldFormal, bool isNamed, 4503 void _checkInstanceCreationOptionalParams(bool isFieldFormal, bool isNamed,
4504 bool hasDefault) { 4504 bool hasDefault) {
4505 String fieldName = "j"; 4505 String fieldName = "j";
4506 String paramName = isFieldFormal ? fieldName : "i"; 4506 String paramName = isFieldFormal ? fieldName : "i";
4507 String formalParam = 4507 String formalParam =
4508 "${(isFieldFormal ? "this." : "int ")}$paramName${(hasDefault ? " = 3" : "")}"; 4508 "${isFieldFormal ? "this." : "int "}$paramName${hasDefault ? " = 3" : "" }";
4509 CompilationUnit compilationUnit = resolveSource(""" 4509 CompilationUnit compilationUnit = resolveSource("""
4510 const x = const A(); 4510 const x = const A();
4511 const y = const A(${isNamed ? '$paramName: ' : ''}10); 4511 const y = const A(${isNamed ? '$paramName: ' : ''}10);
4512 class A { 4512 class A {
4513 const A(${isNamed ? "{$formalParam}" : "[$formalParam]"})${isFieldFormal ? "" : " : $fieldName = $paramName"}; 4513 const A(${isNamed ? "{$formalParam}" : "[$formalParam]"})${isFieldFormal ? "" : " : $fieldName = $paramName"};
4514 final int $fieldName; 4514 final int $fieldName;
4515 }"""); 4515 }""");
4516 EvaluationResultImpl x = 4516 EvaluationResultImpl x =
4517 _evaluateInstanceCreationExpression(compilationUnit, "x"); 4517 _evaluateInstanceCreationExpression(compilationUnit, "x");
4518 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A"); 4518 Map<String, DartObjectImpl> fieldsOfX = _assertType(x, "A");
(...skipping 6372 matching lines...) Expand 10 before | Expand all | Expand 10 after
10891 _errors.add( 10891 _errors.add(
10892 "Expected ${actual.runtimeType} to have parent of type XmlTagNode"); 10892 "Expected ${actual.runtimeType} to have parent of type XmlTagNode");
10893 } 10893 }
10894 String actualName = actual.name; 10894 String actualName = actual.name;
10895 String actualValue = actual.valueToken.lexeme; 10895 String actualValue = actual.valueToken.lexeme;
10896 if (_expectedAttributeIndex < _expectedAttributeKeyValuePairs.length) { 10896 if (_expectedAttributeIndex < _expectedAttributeKeyValuePairs.length) {
10897 String expectedName = 10897 String expectedName =
10898 _expectedAttributeKeyValuePairs[_expectedAttributeIndex]; 10898 _expectedAttributeKeyValuePairs[_expectedAttributeIndex];
10899 if (expectedName != actualName) { 10899 if (expectedName != actualName) {
10900 _errors.add( 10900 _errors.add(
10901 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have name: $expectedName but found: $actualName"); 10901 "Expected ${_expectedTagsIndex - 1} tag: ${_expectedTagsInOrderVisit ed[_expectedTagsIndex - 1]._tag} attribute ${_expectedAttributeIndex ~/ 2} to ha ve name: $expectedName but found: $actualName");
10902 } 10902 }
10903 String expectedValue = 10903 String expectedValue =
10904 _expectedAttributeKeyValuePairs[_expectedAttributeIndex + 1]; 10904 _expectedAttributeKeyValuePairs[_expectedAttributeIndex + 1];
10905 if (expectedValue != actualValue) { 10905 if (expectedValue != actualValue) {
10906 _errors.add( 10906 _errors.add(
10907 "Expected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} t o have value: $expectedValue but found: $actualValue"); 10907 "Expected ${_expectedTagsIndex - 1} tag: ${_expectedTagsInOrderVisit ed[_expectedTagsIndex - 1]._tag} attribute ${_expectedAttributeIndex ~/ 2} to ha ve value: $expectedValue but found: $actualValue");
10908 } 10908 }
10909 } else { 10909 } else {
10910 _errors.add( 10910 _errors.add(
10911 "Unexpected ${(_expectedTagsIndex - 1)} tag: ${_expectedTagsInOrderVis ited[_expectedTagsIndex - 1]._tag} attribute ${(_expectedAttributeIndex ~/ 2)} n ame: $actualName value: $actualValue"); 10911 "Unexpected ${_expectedTagsIndex - 1} tag: ${_expectedTagsInOrderVisit ed[_expectedTagsIndex - 1]._tag} attribute ${_expectedAttributeIndex ~/ 2} name: $actualName value: $actualValue");
10912 } 10912 }
10913 _expectedAttributeIndex += 2; 10913 _expectedAttributeIndex += 2;
10914 _validateNode(actual); 10914 _validateNode(actual);
10915 return super.visitXmlAttributeNode(actual); 10915 return super.visitXmlAttributeNode(actual);
10916 } 10916 }
10917 @override 10917 @override
10918 Object visitXmlTagNode(ht.XmlTagNode actual) { 10918 Object visitXmlTagNode(ht.XmlTagNode actual) {
10919 if (!(actual.parent is ht.HtmlUnit || actual.parent is ht.XmlTagNode)) { 10919 if (!(actual.parent is ht.HtmlUnit || actual.parent is ht.XmlTagNode)) {
10920 _errors.add( 10920 _errors.add(
10921 "Expected ${actual.runtimeType} to have parent of type HtmlUnit or Xml TagNode"); 10921 "Expected ${actual.runtimeType} to have parent of type HtmlUnit or Xml TagNode");
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
11080 void _validate(int scriptIndex, HtmlScriptElement script) { 11080 void _validate(int scriptIndex, HtmlScriptElement script) {
11081 if (_expectedLibrary != null) { 11081 if (_expectedLibrary != null) {
11082 _validateEmbedded(scriptIndex, script); 11082 _validateEmbedded(scriptIndex, script);
11083 } else { 11083 } else {
11084 _validateExternal(scriptIndex, script); 11084 _validateExternal(scriptIndex, script);
11085 } 11085 }
11086 } 11086 }
11087 void _validateEmbedded(int scriptIndex, HtmlScriptElement script) { 11087 void _validateEmbedded(int scriptIndex, HtmlScriptElement script) {
11088 if (script is! EmbeddedHtmlScriptElementImpl) { 11088 if (script is! EmbeddedHtmlScriptElementImpl) {
11089 JUnitTestCase.fail( 11089 JUnitTestCase.fail(
11090 "Expected script $scriptIndex to be embedded, but found ${(script != n ull ? script.runtimeType : "null")}"); 11090 "Expected script $scriptIndex to be embedded, but found ${script != nu ll ? script.runtimeType : "null"}");
11091 } 11091 }
11092 EmbeddedHtmlScriptElementImpl embeddedScript = 11092 EmbeddedHtmlScriptElementImpl embeddedScript =
11093 script as EmbeddedHtmlScriptElementImpl; 11093 script as EmbeddedHtmlScriptElementImpl;
11094 _expectedLibrary._validate(scriptIndex, embeddedScript); 11094 _expectedLibrary._validate(scriptIndex, embeddedScript);
11095 } 11095 }
11096 void _validateExternal(int scriptIndex, HtmlScriptElement script) { 11096 void _validateExternal(int scriptIndex, HtmlScriptElement script) {
11097 if (script is! ExternalHtmlScriptElementImpl) { 11097 if (script is! ExternalHtmlScriptElementImpl) {
11098 JUnitTestCase.fail( 11098 JUnitTestCase.fail(
11099 "Expected script $scriptIndex to be external with src=$_expectedExtern alScriptName but found ${(script != null ? script.runtimeType : "null")}"); 11099 "Expected script $scriptIndex to be external with src=$_expectedExtern alScriptName but found ${script != null ? script.runtimeType : "null"}");
11100 } 11100 }
11101 ExternalHtmlScriptElementImpl externalScript = 11101 ExternalHtmlScriptElementImpl externalScript =
11102 script as ExternalHtmlScriptElementImpl; 11102 script as ExternalHtmlScriptElementImpl;
11103 Source scriptSource = externalScript.scriptSource; 11103 Source scriptSource = externalScript.scriptSource;
11104 if (_expectedExternalScriptName == null) { 11104 if (_expectedExternalScriptName == null) {
11105 JUnitTestCase.assertNullMsg("script $scriptIndex", scriptSource); 11105 JUnitTestCase.assertNullMsg("script $scriptIndex", scriptSource);
11106 } else { 11106 } else {
11107 JUnitTestCase.assertNotNullMsg("script $scriptIndex", scriptSource); 11107 JUnitTestCase.assertNotNullMsg("script $scriptIndex", scriptSource);
11108 String actualExternalScriptName = scriptSource.shortName; 11108 String actualExternalScriptName = scriptSource.shortName;
11109 JUnitTestCase.assertEqualsMsg( 11109 JUnitTestCase.assertEqualsMsg(
11110 "script $scriptIndex", 11110 "script $scriptIndex",
11111 _expectedExternalScriptName, 11111 _expectedExternalScriptName,
11112 actualExternalScriptName); 11112 actualExternalScriptName);
11113 } 11113 }
11114 } 11114 }
11115 } 11115 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/engine.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698