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 41737589144f75efe371464219ca6f3853ac822e..e8dae9c5ee51280f551313e1e331cc8f94957d77 100644 |
| --- a/pkg/analyzer/test/src/summary/summary_common.dart |
| +++ b/pkg/analyzer/test/src/summary/summary_common.dart |
| @@ -53,7 +53,8 @@ final Map<String, UnlinkedPublicNamespace> sdkPublicNamespace = () { |
| } |
| } |
| return uriToNamespace; |
| - } catch (_) { |
| + } catch (_, st) { |
| + print(st); |
|
Paul Berry
2016/02/08 14:53:12
Was this temporary code you accidentally forgot to
scheglov
2016/02/08 16:29:51
Another debugging code that accidentally got into
|
| return null; |
| } |
| }(); |
| @@ -2691,6 +2692,117 @@ class C { |
| expect(executable, isNull); |
| } |
| + test_constructor_initializers_field() { |
| + UnlinkedExecutable executable = |
| + findExecutable('', executables: serializeClassText(r''' |
| +class C { |
| + final x; |
| + const C() : x = 42; |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, hasLength(1)); |
| + UnlinkedConstructorInitializer initializer = |
| + executable.constantInitializers[0]; |
| + expect(initializer.kind, UnlinkedConstructorInitializerKind.field); |
| + expect(initializer.name, 'x'); |
| + _assertUnlinkedConst(initializer.expression, |
| + operators: [UnlinkedConstOperation.pushInt], ints: [42]); |
| + expect(initializer.arguments, isEmpty); |
| + } |
| + |
| + test_constructor_initializers_field_withParameter() { |
| + UnlinkedExecutable executable = |
| + findExecutable('', executables: serializeClassText(r''' |
| +class C { |
| + final x; |
| + const C(int p) : x = p; |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, hasLength(1)); |
| + UnlinkedConstructorInitializer initializer = |
| + executable.constantInitializers[0]; |
| + expect(initializer.kind, UnlinkedConstructorInitializerKind.field); |
| + expect(initializer.name, 'x'); |
| + _assertUnlinkedConst(initializer.expression, |
| + operators: [UnlinkedConstOperation.pushConstructorParameter], strings: ['p']); |
| + expect(initializer.arguments, isEmpty); |
| + } |
| + |
| + test_constructor_initializers_notConst() { |
| + UnlinkedExecutable executable = |
| + findExecutable('', executables: serializeClassText(r''' |
| +class C { |
| + final x; |
| + C() : x = 42; |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, isEmpty); |
| + } |
| + |
| + test_constructor_initializers_superInvocation() { |
|
Paul Berry
2016/02/08 14:53:12
Also test a super invocation of an unnamed constru
scheglov
2016/02/08 16:29:51
Done.
|
| + UnlinkedExecutable executable = |
| + findExecutable('', executables: serializeClassText(r''' |
| +class A { |
| + const A.aaa(int p); |
| +} |
| +class C extends A { |
| + const C() : super.aaa(42); |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, hasLength(1)); |
| + UnlinkedConstructorInitializer initializer = |
| + executable.constantInitializers[0]; |
| + expect( |
| + initializer.kind, UnlinkedConstructorInitializerKind.superInvocation); |
| + expect(initializer.name, 'aaa'); |
| + expect(initializer.expression, isNull); |
| + expect(initializer.arguments, hasLength(1)); |
| + _assertUnlinkedConst(initializer.arguments[0], |
| + operators: [UnlinkedConstOperation.pushInt], ints: [42]); |
| + } |
| + |
| + test_constructor_initializers_thisInvocation_toNamed() { |
| + UnlinkedExecutable executable = |
| + findExecutable('', executables: serializeClassText(r''' |
| +class C { |
| + const C() : this.named(1, 'bbb'); |
| + const C.named(int a, String b); |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, hasLength(1)); |
| + UnlinkedConstructorInitializer initializer = |
| + executable.constantInitializers[0]; |
| + expect(initializer.kind, UnlinkedConstructorInitializerKind.thisInvocation); |
| + expect(initializer.name, 'named'); |
| + expect(initializer.expression, isNull); |
| + expect(initializer.arguments, hasLength(2)); |
| + _assertUnlinkedConst(initializer.arguments[0], |
| + operators: [UnlinkedConstOperation.pushInt], ints: [1]); |
| + _assertUnlinkedConst(initializer.arguments[1], |
| + operators: [UnlinkedConstOperation.pushString], strings: ['bbb']); |
| + } |
| + |
| + test_constructor_initializers_thisInvocation_toUnnamed() { |
| + UnlinkedExecutable executable = |
| + findExecutable('named', executables: serializeClassText(r''' |
| +class C { |
| + const C.named() : this(1, 'bbb'); |
| + const C(int a, String b); |
| +} |
| +''').executables); |
| + expect(executable.constantInitializers, hasLength(1)); |
| + UnlinkedConstructorInitializer initializer = |
| + executable.constantInitializers[0]; |
| + expect(initializer.kind, UnlinkedConstructorInitializerKind.thisInvocation); |
| + expect(initializer.name, ''); |
| + expect(initializer.expression, isNull); |
| + expect(initializer.arguments, hasLength(2)); |
| + _assertUnlinkedConst(initializer.arguments[0], |
| + operators: [UnlinkedConstOperation.pushInt], ints: [1]); |
| + _assertUnlinkedConst(initializer.arguments[1], |
| + operators: [UnlinkedConstOperation.pushString], strings: ['bbb']); |
| + } |
| + |
| test_constructor_initializing_formal() { |
| UnlinkedExecutable executable = findExecutable('', |
| executables: |