Chromium Code Reviews| Index: pkg/analyzer/test/src/summary/summary_common.dart |
| diff --git a/pkg/analyzer/test/src/summary/summary_common.dart b/pkg/analyzer/test/src/summary/summary_common.dart |
| index 90884b33f3682a9f4650cc2f5402ec0e98551486..bfb3e8e6bd055fa431c5a7cc803715a40aab22cb 100644 |
| --- a/pkg/analyzer/test/src/summary/summary_common.dart |
| +++ b/pkg/analyzer/test/src/summary/summary_common.dart |
| @@ -48,7 +48,8 @@ final Map<String, UnlinkedPublicNamespace> sdkPublicNamespace = () { |
| for (int i = 0; i < serializedLibrary.unlinkedUnits.length; i++) { |
| uriToNamespace[serializedLibrary.unitUris[i]] = |
| new UnlinkedUnit.fromBuffer( |
| - serializedLibrary.unlinkedUnits[i].toBuffer()).publicNamespace; |
| + serializedLibrary.unlinkedUnits[i].toBuffer()) |
| + .publicNamespace; |
| } |
| } |
| return uriToNamespace; |
| @@ -761,7 +762,8 @@ enum E { |
| EntityRef serializeTypeText(String text, |
| {String otherDeclarations: '', bool allowErrors: false}) { |
| return serializeVariableText('$otherDeclarations\n$text v;', |
| - allowErrors: allowErrors).type; |
| + allowErrors: allowErrors) |
| + .type; |
| } |
| /** |
| @@ -1046,6 +1048,45 @@ class E {}'''; |
| checkDocumentationComment(cls.documentationComment, text); |
| } |
| + test_class_executables() { |
| + UnlinkedClass cls = serializeClassText(''' |
| +class C { |
| + static void methodStaticPublic() {} |
|
Paul Berry
2016/01/25 13:10:04
I'd recommend adding a line like this:
"C operato
scheglov
2016/01/25 17:27:09
Done.
|
| + static void _methodStaticPrivate() {} |
| + void methodInstancePublic() {} |
| + C(); |
| + C.constructorNamedPublic(); |
| + C._constructorNamedPrivate(); |
| +} |
| +'''); |
| + expect(cls.isAbstract, false); |
| + expect(unlinkedUnits[0].publicNamespace.names, hasLength(1)); |
| + UnlinkedPublicName className = unlinkedUnits[0].publicNamespace.names[0]; |
| + expect(className.kind, ReferenceKind.classOrEnum); |
| + expect(className.name, 'C'); |
| + expect(className.numTypeParameters, 0); |
| + // executables |
| + Map<String, UnlinkedPublicName> executablesMap = |
| + <String, UnlinkedPublicName>{}; |
| + className.executables.forEach((e) => executablesMap[e.name] = e); |
| + expect(executablesMap, hasLength(3)); |
| + { |
| + UnlinkedPublicName executable = executablesMap['methodStaticPublic']; |
| + expect(executable.kind, ReferenceKind.staticMethod); |
| + expect(executable.executables, isEmpty); |
| + } |
| + { |
| + UnlinkedPublicName executable = executablesMap['']; |
| + expect(executable.kind, ReferenceKind.constructor); |
| + expect(executable.executables, isEmpty); |
| + } |
| + { |
| + UnlinkedPublicName executable = executablesMap['constructorNamedPublic']; |
| + expect(executable.kind, ReferenceKind.constructor); |
| + expect(executable.executables, isEmpty); |
| + } |
| + } |
| + |
| test_class_interface() { |
| UnlinkedClass cls = serializeClassText(''' |
| class C implements D {} |
| @@ -1556,10 +1597,12 @@ const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); |
| test_constExpr_length() { |
| UnlinkedVariable variable = |
| serializeVariableText('const v = "abc".length;'); |
| - _assertUnlinkedConst(variable.constExpr, |
| - operators: |
| - [UnlinkedConstOperation.pushString, UnlinkedConstOperation.length], |
| - strings: ['abc']); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushString, |
| + UnlinkedConstOperation.length |
| + ], strings: [ |
| + 'abc' |
| + ]); |
| } |
| test_constExpr_makeSymbol() { |
| @@ -1719,24 +1762,30 @@ const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); |
| test_constExpr_prefix_complement() { |
| UnlinkedVariable variable = serializeVariableText('const v = ~2;'); |
| - _assertUnlinkedConst(variable.constExpr, |
| - operators: |
| - [UnlinkedConstOperation.pushInt, UnlinkedConstOperation.complement], |
| - ints: [2]); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushInt, |
| + UnlinkedConstOperation.complement |
| + ], ints: [ |
| + 2 |
| + ]); |
| } |
| test_constExpr_prefix_negate() { |
| UnlinkedVariable variable = serializeVariableText('const v = -(2);'); |
| - _assertUnlinkedConst(variable.constExpr, |
| - operators: |
| - [UnlinkedConstOperation.pushInt, UnlinkedConstOperation.negate], |
| - ints: [2]); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushInt, |
| + UnlinkedConstOperation.negate |
| + ], ints: [ |
| + 2 |
| + ]); |
| } |
| test_constExpr_prefix_not() { |
| UnlinkedVariable variable = serializeVariableText('const v = !true;'); |
| - _assertUnlinkedConst(variable.constExpr, operators: |
| - [UnlinkedConstOperation.pushTrue, UnlinkedConstOperation.not]); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushTrue, |
| + UnlinkedConstOperation.not |
| + ]); |
| } |
| test_constExpr_pushDouble() { |
| @@ -1765,10 +1814,12 @@ const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); |
| test_constExpr_pushInt_negative() { |
| UnlinkedVariable variable = serializeVariableText('const v = -5;'); |
| - _assertUnlinkedConst(variable.constExpr, |
| - operators: |
| - [UnlinkedConstOperation.pushInt, UnlinkedConstOperation.negate], |
| - ints: [5]); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushInt, |
| + UnlinkedConstOperation.negate |
| + ], ints: [ |
| + 5 |
| + ]); |
| } |
| test_constExpr_pushInt_shiftOr_long() { |
| @@ -1789,10 +1840,13 @@ const v = const C(11, 22, 3.3, '444', e: 55, g: '777', f: 66); |
| test_constExpr_pushInt_shiftOr_min() { |
| UnlinkedVariable variable = serializeVariableText('const v = 0x100000000;'); |
| - _assertUnlinkedConst(variable.constExpr, |
| - operators: |
| - [UnlinkedConstOperation.pushInt, UnlinkedConstOperation.shiftOr,], |
| - ints: [1, 0,]); |
| + _assertUnlinkedConst(variable.constExpr, operators: [ |
| + UnlinkedConstOperation.pushInt, |
| + UnlinkedConstOperation.shiftOr, |
| + ], ints: [ |
| + 1, |
| + 0, |
| + ]); |
| } |
| test_constExpr_pushInt_shiftOr_min2() { |
| @@ -2586,7 +2640,8 @@ enum E { v }'''; |
| test_executable_operator_equal() { |
| UnlinkedExecutable executable = serializeClassText( |
| - 'class C { bool operator==(Object other) => false; }').executables[0]; |
| + 'class C { bool operator==(Object other) => false; }') |
| + .executables[0]; |
| expect(executable.name, '=='); |
| } |
| @@ -2622,7 +2677,8 @@ enum E { v }'''; |
| test_executable_operator_index_set() { |
| UnlinkedExecutable executable = serializeClassText( |
| - 'class C { void operator[]=(int i, bool v) => null; }').executables[0]; |
| + 'class C { void operator[]=(int i, bool v) => null; }') |
| + .executables[0]; |
| expect(executable.kind, UnlinkedExecutableKind.functionOrMethod); |
| expect(executable.name, '[]='); |
| expect(executable.returnType, isNotNull); |
| @@ -3445,7 +3501,8 @@ p.B b; |
| return; |
| } |
| checkUnresolvedTypeRef( |
| - serializeClassText('class C<T> { T.U x; }', allowErrors: true).fields[0] |
| + serializeClassText('class C<T> { T.U x; }', allowErrors: true) |
| + .fields[0] |
| .type, |
| 'T', |
| 'U'); |