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

Unified Diff: pkg/analyzer/test/generated/all_the_rest_test.dart

Issue 1572073003: Don't log stack trace for a bad package URL in a source file. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/generated/all_the_rest_test.dart
diff --git a/pkg/analyzer/test/generated/all_the_rest_test.dart b/pkg/analyzer/test/generated/all_the_rest_test.dart
index bb6c95a4a4949f4090a4867cbb91cf6f27863232..7cd6a0382601f47f2a6fa456fcee1a67c50699bf 100644
--- a/pkg/analyzer/test/generated/all_the_rest_test.dart
+++ b/pkg/analyzer/test/generated/all_the_rest_test.dart
@@ -575,22 +575,19 @@ class ConstantFinderTest {
expect(_findConstants(), contains(field.element));
}
- void
- test_visitVariableDeclaration_static_const_inClassWithConstConstructor() {
+ void test_visitVariableDeclaration_static_const_inClassWithConstConstructor() {
skybrian 2016/01/09 08:19:54 Not sure what dartfmt is doing here; it seems to h
Brian Wilkerson 2016/01/09 16:02:39 I'm not sure either, but we always format, regardl
VariableDeclaration field = _setupFieldDeclaration('C', 'f', Keyword.CONST,
isStatic: true, hasConstConstructor: true);
expect(_findConstants(), contains(field.element));
}
- void
- test_visitVariableDeclaration_static_final_inClassWithConstConstructor() {
+ void test_visitVariableDeclaration_static_final_inClassWithConstConstructor() {
VariableDeclaration field = _setupFieldDeclaration('C', 'f', Keyword.FINAL,
isStatic: true, hasConstConstructor: true);
expect(_findConstants(), isNot(contains(field.element)));
}
- void
- test_visitVariableDeclaration_uninitialized_final_inClassWithConstConstructor() {
+ void test_visitVariableDeclaration_uninitialized_final_inClassWithConstConstructor() {
VariableDeclaration field = _setupFieldDeclaration('C', 'f', Keyword.FINAL,
isInitialized: false, hasConstConstructor: true);
expect(_findConstants(), isNot(contains(field.element)));
@@ -624,8 +621,8 @@ class ConstantFinderTest {
ConstructorElement _setupConstructorDeclaration(String name, bool isConst) {
Keyword constKeyword = isConst ? Keyword.CONST : null;
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
constKeyword,
null,
null,
@@ -666,8 +663,8 @@ class ConstantFinderTest {
classElement.fields = <FieldElement>[fieldElement];
classDeclaration.name.staticElement = classElement;
if (hasConstConstructor) {
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
Keyword.CONST,
null,
AstFactory.identifier3(className),
@@ -880,23 +877,27 @@ class C {
void test_computeValues_cycle() {
TestLogger logger = new TestLogger();
AnalysisEngine.instance.logger = logger;
- Source librarySource = addSource(r'''
-const int a = c;
-const int b = a;
-const int c = b;''');
- LibraryElement libraryElement = resolve2(librarySource);
- CompilationUnit unit =
- analysisContext.resolveCompilationUnit(librarySource, libraryElement);
- analysisContext.computeErrors(librarySource);
- expect(unit, isNotNull);
- ConstantValueComputer computer = _makeConstantValueComputer();
- computer.add(unit, librarySource, librarySource);
- computer.computeValues();
- NodeList<CompilationUnitMember> members = unit.declarations;
- expect(members, hasLength(3));
- _validate(false, (members[0] as TopLevelVariableDeclaration).variables);
- _validate(false, (members[1] as TopLevelVariableDeclaration).variables);
- _validate(false, (members[2] as TopLevelVariableDeclaration).variables);
+ try {
+ Source librarySource = addSource(r'''
+ const int a = c;
+ const int b = a;
+ const int c = b;''');
+ LibraryElement libraryElement = resolve2(librarySource);
+ CompilationUnit unit =
+ analysisContext.resolveCompilationUnit(librarySource, libraryElement);
+ analysisContext.computeErrors(librarySource);
+ expect(unit, isNotNull);
+ ConstantValueComputer computer = _makeConstantValueComputer();
+ computer.add(unit, librarySource, librarySource);
+ computer.computeValues();
+ NodeList<CompilationUnitMember> members = unit.declarations;
+ expect(members, hasLength(3));
+ _validate(false, (members[0] as TopLevelVariableDeclaration).variables);
+ _validate(false, (members[1] as TopLevelVariableDeclaration).variables);
+ _validate(false, (members[2] as TopLevelVariableDeclaration).variables);
+ } finally {
+ AnalysisEngine.instance.logger = Logger.NULL;
+ }
}
void test_computeValues_dependentVariables() {
@@ -1332,23 +1333,19 @@ class A {
_assertIntField(fields, "k", 13);
}
- void
- test_instanceCreationExpression_computedField_namedOptionalWithDefault() {
+ void test_instanceCreationExpression_computedField_namedOptionalWithDefault() {
_checkInstanceCreationOptionalParams(false, true, true);
}
- void
- test_instanceCreationExpression_computedField_namedOptionalWithoutDefault() {
+ void test_instanceCreationExpression_computedField_namedOptionalWithoutDefault() {
_checkInstanceCreationOptionalParams(false, true, false);
}
- void
- test_instanceCreationExpression_computedField_unnamedOptionalWithDefault() {
+ void test_instanceCreationExpression_computedField_unnamedOptionalWithDefault() {
_checkInstanceCreationOptionalParams(false, false, true);
}
- void
- test_instanceCreationExpression_computedField_unnamedOptionalWithoutDefault() {
+ void test_instanceCreationExpression_computedField_unnamedOptionalWithoutDefault() {
_checkInstanceCreationOptionalParams(false, false, false);
}
@@ -1441,23 +1438,19 @@ class A {
_assertIntField(fields, "x", 42);
}
- void
- test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefault() {
+ void test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithDefault() {
_checkInstanceCreationOptionalParams(true, true, true);
}
- void
- test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutDefault() {
+ void test_instanceCreationExpression_fieldFormalParameter_namedOptionalWithoutDefault() {
_checkInstanceCreationOptionalParams(true, true, false);
}
- void
- test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithDefault() {
+ void test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithDefault() {
_checkInstanceCreationOptionalParams(true, false, true);
}
- void
- test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithoutDefault() {
+ void test_instanceCreationExpression_fieldFormalParameter_unnamedOptionalWithoutDefault() {
_checkInstanceCreationOptionalParams(true, false, false);
}
@@ -4864,8 +4857,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
String className = "A";
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
null,
null,
AstFactory.identifier3(className),
@@ -4893,8 +4886,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
String className = "A";
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
null,
Keyword.FACTORY,
AstFactory.identifier3(className),
@@ -4920,8 +4913,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
String className = "A";
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
null,
null,
AstFactory.identifier3(className),
@@ -4953,8 +4946,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementBuilder builder = new ElementBuilder(holder);
String className = "A";
String constructorName = "c";
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
null,
null,
AstFactory.identifier3(className),
@@ -4982,8 +4975,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
String className = "A";
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration2(
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration2(
null,
null,
AstFactory.identifier3(className),
@@ -5063,8 +5056,8 @@ class ElementBuilderTest extends EngineTestCase {
ElementHolder holder = new ElementHolder();
ElementBuilder builder = new ElementBuilder(holder);
String parameterName = 'p';
- DefaultFormalParameter formalParameter =
- AstFactory.positionalFormalParameter(
+ DefaultFormalParameter formalParameter = AstFactory
+ .positionalFormalParameter(
AstFactory.simpleFormalParameter3(parameterName),
AstFactory.integer(0));
formalParameter.accept(builder);
@@ -6469,8 +6462,7 @@ class A {
(obj) => obj is FunctionElement, FunctionElement, element);
}
- void
- test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParameter() {
+ void test_locate_Identifier_annotationClass_namedConstructor_forSimpleFormalParameter() {
AstNode id = _findNodeIndexedIn(
"Class",
2,
@@ -6485,8 +6477,7 @@ void main(@Class.name() parameter) {
(obj) => obj is ClassElement, ClassElement, element);
}
- void
- test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParameter() {
+ void test_locate_Identifier_annotationClass_unnamedConstructor_forSimpleFormalParameter() {
AstNode id = _findNodeIndexedIn(
"Class",
2,
@@ -6593,8 +6584,8 @@ void main() {
SimpleIdentifier identifier = AstFactory.identifier3("A");
PrefixedIdentifier prefixedIdentifier =
AstFactory.identifier4("pref", identifier);
- InstanceCreationExpression creation =
- AstFactory.instanceCreationExpression2(
+ InstanceCreationExpression creation = AstFactory
+ .instanceCreationExpression2(
Keyword.NEW, AstFactory.typeName3(prefixedIdentifier));
// set ClassElement
ClassElement classElement = ElementFactory.classElement2("A");
@@ -6611,8 +6602,8 @@ void main() {
void test_locate_InstanceCreationExpression_type_simpleIdentifier() {
// prepare: new A()
SimpleIdentifier identifier = AstFactory.identifier3("A");
- InstanceCreationExpression creation =
- AstFactory.instanceCreationExpression2(
+ InstanceCreationExpression creation = AstFactory
+ .instanceCreationExpression2(
Keyword.NEW, AstFactory.typeName3(identifier));
// set ClassElement
ClassElement classElement = ElementFactory.classElement2("A");
@@ -8117,8 +8108,8 @@ class ReferenceFinderTest {
String name, bool isConst) {
List<ConstructorInitializer> initializers =
new List<ConstructorInitializer>();
- ConstructorDeclaration constructorDeclaration =
- AstFactory.constructorDeclaration(AstFactory.identifier3(name), null,
+ ConstructorDeclaration constructorDeclaration = AstFactory
+ .constructorDeclaration(AstFactory.identifier3(name), null,
AstFactory.formalParameterList(), initializers);
if (isConst) {
constructorDeclaration.constKeyword = new KeywordToken(Keyword.CONST, 0);

Powered by Google App Engine
This is Rietveld 408576698