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

Unified Diff: pkg/analyzer/lib/src/summary/link.dart

Issue 1835313002: Fix AST summarization when there are explicit calls to super constructors. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/summary/link.dart
diff --git a/pkg/analyzer/lib/src/summary/link.dart b/pkg/analyzer/lib/src/summary/link.dart
index 342db57695c77c0be3b1d3110681d57205abfeac..28930fc20225b214648e446eea47b0723fc320d4 100644
--- a/pkg/analyzer/lib/src/summary/link.dart
+++ b/pkg/analyzer/lib/src/summary/link.dart
@@ -570,12 +570,19 @@ class ConstConstructorNode extends ConstNode {
// we'll evaluate calls to this constructor without having to refer to
// any other constants. So we don't need to report any dependencies.
} else {
+ ClassElementForLink superClass = enclosingClass.supertype?.element;
bool superInvocationFound = false;
for (UnlinkedConstructorInitializer constructorInitializer
in constructorElement._unlinkedExecutable.constantInitializers) {
if (constructorInitializer.kind ==
UnlinkedConstructorInitializerKind.superInvocation) {
superInvocationFound = true;
+ if (superClass != null && !superClass.isObject) {
+ ConstructorElementForLink constructor = superClass
+ .getContainedName(constructorInitializer.name)
+ .asConstructor;
+ safeAddDependency(constructor?._constNode);
+ }
}
CompilationUnitElementForLink compilationUnit =
constructorElement.enclosingElement.enclosingElement;
@@ -588,7 +595,6 @@ class ConstConstructorNode extends ConstNode {
if (!superInvocationFound) {
// No explicit superconstructor invocation found, so we need to
// manually insert a reference to the implicit superconstructor.
- ClassElementForLink superClass = enclosingClass.supertype?.element;
if (superClass != null && !superClass.isObject) {
ConstructorElementForLink unnamedConstructor =
superClass.unnamedConstructor;
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/summary_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698