Convert ShadowVariableDeclaration to VariableDeclarationJudgment.

R=brianwilkerson@google.com, paulberry@google.com

Change-Id: I65cb1896d0ad744b8208676e487c448f308b8cd5
Reviewed-on: https://dart-review.googlesource.com/61102
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
index 33b64bf..a1382d0 100644
--- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart
+++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart
@@ -64,7 +64,7 @@
 
 import 'kernel/kernel_library_builder.dart' show KernelLibraryBuilder;
 
-import 'kernel/kernel_shadow_ast.dart' show ShadowVariableDeclaration;
+import 'kernel/kernel_shadow_ast.dart' show VariableDeclarationJudgment;
 
 import 'library_graph.dart' show LibraryGraph;
 
@@ -493,7 +493,7 @@
       FunctionNode parameters = new FunctionNode(null,
           typeParameters: typeDefinitions,
           positionalParameters: definitions.keys
-              .map((name) => new ShadowVariableDeclaration(name, 0))
+              .map((name) => new VariableDeclarationJudgment(name, 0))
               .toList());
 
       debugLibrary.build(userCode.loader.coreLibrary, modifyTarget: false);
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
index a44223c..f4a9d05 100644
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart
@@ -992,7 +992,7 @@
           this, token, expression.variable));
       expression.extend();
     } else {
-      VariableDeclaration variable = new ShadowVariableDeclaration.forValue(
+      VariableDeclaration variable = new VariableDeclarationJudgment.forValue(
           toKernelExpression(expression), functionNestingLevel);
       push(new ShadowCascadeExpression(variable));
       push(new VariableUseGenerator<Expression, Statement, Arguments>(
@@ -1748,7 +1748,7 @@
     bool isConst = (currentLocalVariableModifiers & constMask) != 0;
     bool isFinal = (currentLocalVariableModifiers & finalMask) != 0;
     assert(isConst == (constantContext == ConstantContext.inferred));
-    push(new ShadowVariableDeclaration(identifier.name, functionNestingLevel,
+    push(new VariableDeclarationJudgment(identifier.name, functionNestingLevel,
         initializer: toKernelExpression(initializer),
         type: currentLocalVariableType,
         isFinal: isFinal,
@@ -1889,11 +1889,11 @@
     if (variableOrExpression is VariableDeclaration) {
       return <VariableDeclaration>[variableOrExpression];
     } else if (variableOrExpression is Expression) {
-      VariableDeclaration variable = new ShadowVariableDeclaration.forEffect(
+      VariableDeclaration variable = new VariableDeclarationJudgment.forEffect(
           toKernelExpression(variableOrExpression), functionNestingLevel);
       return <VariableDeclaration>[variable];
     } else if (variableOrExpression is ExpressionStatement) {
-      VariableDeclaration variable = new ShadowVariableDeclaration.forEffect(
+      VariableDeclaration variable = new VariableDeclarationJudgment.forEffect(
           variableOrExpression.expression, functionNestingLevel);
       return <VariableDeclaration>[variable];
     } else if (forest.isVariablesDeclaration(variableOrExpression)) {
@@ -2296,7 +2296,8 @@
         variable.initializer = name.initializer;
       }
     } else {
-      variable = new ShadowVariableDeclaration(name?.name, functionNestingLevel,
+      variable = new VariableDeclarationJudgment(
+          name?.name, functionNestingLevel,
           type: type,
           initializer: name?.initializer,
           isFinal: isFinal,
@@ -3037,7 +3038,7 @@
   void endFunctionName(Token beginToken, Token token) {
     debugEvent("FunctionName");
     Identifier name = pop();
-    VariableDeclaration variable = new ShadowVariableDeclaration(
+    VariableDeclaration variable = new VariableDeclarationJudgment(
         name.name, functionNestingLevel,
         isFinal: true, isLocalFunction: true)
       ..fileOffset = offsetForToken(name.token);
@@ -3141,12 +3142,12 @@
           // This must have been a compile-time error.
           assert(isErroneousNode(toKernelExpression(oldInitializer)));
 
-          push(new Let(
+          push(new ShadowSyntheticExpression(new Let(
               new VariableDeclaration.forValue(
                   toKernelExpression(oldInitializer))
                 ..fileOffset = forest.readOffset(expression),
               toKernelExpression(expression))
-            ..fileOffset = forest.readOffset(expression));
+            ..fileOffset = forest.readOffset(expression)));
         } else {
           push(expression);
         }
@@ -3285,7 +3286,7 @@
       ///       body;
       ///     }
       variable =
-          new ShadowVariableDeclaration.forValue(null, functionNestingLevel);
+          new VariableDeclarationJudgment.forValue(null, functionNestingLevel);
       TypePromotionFact fact =
           typePromoter.getFactForAccess(variable, functionNestingLevel);
       TypePromotionScope scope = typePromoter.currentScope;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
index 18448bf..c331eb7 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_ast_api.dart
@@ -103,7 +103,7 @@
         ShadowSwitchStatement,
         ShadowSyntheticExpression,
         VariableAssignmentJudgment,
-        ShadowVariableDeclaration,
+        VariableDeclarationJudgment,
         VariableGetJudgment,
         YieldJudgment,
         NamedExpressionJudgment;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
index 55627d5..51f22e3 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_expression_generator.dart
@@ -86,7 +86,7 @@
         SuperPropertyGetJudgment,
         VariableAssignmentJudgment,
         ShadowSyntheticExpression,
-        ShadowVariableDeclaration,
+        VariableDeclarationJudgment,
         VariableGetJudgment,
         StaticSet,
         SuperMethodInvocation,
@@ -206,7 +206,7 @@
         offset: offset);
     complexAssignment?.combiner = combiner;
     complexAssignment?.isPostIncDec = true;
-    var dummy = new ShadowVariableDeclaration.forValue(
+    var dummy = new VariableDeclarationJudgment.forValue(
         _makeWrite(combiner, true, complexAssignment),
         helper.functionNestingLevel);
     return _finish(
@@ -768,7 +768,7 @@
         interfaceTarget: setter)
       ..fileOffset = offsetForToken(token);
     complexAssignment?.write = write;
-    var dummy = new ShadowVariableDeclaration.forValue(
+    var dummy = new VariableDeclarationJudgment.forValue(
         write, helper.functionNestingLevel);
     return makeLet(
         valueVariable, makeLet(dummy, new VariableGet(valueVariable)));
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
index 752a461..c6ca4d9 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
@@ -5,7 +5,7 @@
 library fasta.kernel_formal_parameter_builder;
 
 import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'
-    show ShadowVariableDeclaration;
+    show VariableDeclarationJudgment;
 
 import '../modifier.dart' show finalMask;
 
@@ -21,7 +21,7 @@
 
 class KernelFormalParameterBuilder
     extends FormalParameterBuilder<KernelTypeBuilder> {
-  ShadowVariableDeclaration declaration;
+  VariableDeclarationJudgment declaration;
   final int charOffset;
 
   KernelFormalParameterBuilder(
@@ -35,11 +35,11 @@
       : super(metadata, modifiers, type, name, hasThis, compilationUnit,
             charOffset);
 
-  ShadowVariableDeclaration get target => declaration;
+  VariableDeclarationJudgment get target => declaration;
 
-  ShadowVariableDeclaration build(SourceLibraryBuilder library) {
+  VariableDeclarationJudgment build(SourceLibraryBuilder library) {
     if (declaration == null) {
-      declaration = new ShadowVariableDeclaration(name, 0,
+      declaration = new VariableDeclarationJudgment(name, 0,
           type: type?.build(library),
           isFinal: isFinal,
           isConst: isConst,
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
index c78baa0..b09e032 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_procedure_builder.dart
@@ -74,7 +74,8 @@
         TypeVariableBuilder,
         isRedirectingGenerativeConstructorImplementation;
 
-import 'kernel_shadow_ast.dart' show ShadowProcedure, ShadowVariableDeclaration;
+import 'kernel_shadow_ast.dart'
+    show ShadowProcedure, VariableDeclarationJudgment;
 
 import 'redirecting_factory_body.dart' show RedirectingFactoryBody;
 
@@ -169,7 +170,7 @@
       // Do this after building the parameters, since the diet listener
       // assumes that parameters are built, even if illegal in number.
       VariableDeclaration parameter =
-          new ShadowVariableDeclaration("#synthetic", 0);
+          new VariableDeclarationJudgment("#synthetic", 0);
       result.positionalParameters.clear();
       result.positionalParameters.add(parameter);
       parameter.parent = result;
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index eefcbfd..73dee2a 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -343,7 +343,7 @@
   /// variable.  Caller is responsible for ensuring that [variable]'s
   /// initializer is the expression preceding the first `..` of the cascade
   /// expression.
-  ShadowCascadeExpression(ShadowVariableDeclaration variable)
+  ShadowCascadeExpression(VariableDeclarationJudgment variable)
       : super(
             variable,
             makeLet(new VariableDeclaration.forValue(new _UnfinishedCascade()),
@@ -1079,7 +1079,7 @@
     DartType context;
     bool typeNeeded = false;
     bool typeChecksNeeded = !inferrer.isTopLevel;
-    ShadowVariableDeclaration variable;
+    VariableDeclarationJudgment variable;
     var syntheticAssignment = _syntheticAssignment;
     kernel.Expression syntheticWrite;
     DartType syntheticWriteType;
@@ -2773,7 +2773,7 @@
 
   @override
   int getVariableFunctionNestingLevel(VariableDeclaration variable) {
-    if (variable is ShadowVariableDeclaration) {
+    if (variable is VariableDeclarationJudgment) {
       return variable._functionNestingLevel;
     } else {
       // Hack to deal with the fact that BodyBuilder still creates raw
@@ -2786,8 +2786,8 @@
 
   @override
   bool isPromotionCandidate(VariableDeclaration variable) {
-    assert(variable is ShadowVariableDeclaration);
-    ShadowVariableDeclaration kernelVariableDeclaration = variable;
+    assert(variable is VariableDeclarationJudgment);
+    VariableDeclarationJudgment kernelVariableDeclaration = variable;
     return !kernelVariableDeclaration._isLocalFunction;
   }
 
@@ -2798,7 +2798,7 @@
 
   @override
   void setVariableMutatedAnywhere(VariableDeclaration variable) {
-    if (variable is ShadowVariableDeclaration) {
+    if (variable is VariableDeclarationJudgment) {
       variable._mutatedAnywhere = true;
     } else {
       // Hack to deal with the fact that BodyBuilder still creates raw
@@ -2810,7 +2810,7 @@
 
   @override
   void setVariableMutatedInClosure(VariableDeclaration variable) {
-    if (variable is ShadowVariableDeclaration) {
+    if (variable is VariableDeclarationJudgment) {
       variable._mutatedInClosure = true;
     } else {
       // Hack to deal with the fact that BodyBuilder still creates raw
@@ -2822,7 +2822,7 @@
 
   @override
   bool wasVariableMutatedAnywhere(VariableDeclaration variable) {
-    if (variable is ShadowVariableDeclaration) {
+    if (variable is VariableDeclarationJudgment) {
       return variable._mutatedAnywhere;
     } else {
       // Hack to deal with the fact that BodyBuilder still creates raw
@@ -2875,7 +2875,7 @@
 }
 
 /// Concrete shadow object representing a variable declaration in kernel form.
-class ShadowVariableDeclaration extends VariableDeclaration
+class VariableDeclarationJudgment extends VariableDeclaration
     implements StatementJudgment {
   final bool _implicitlyTyped;
 
@@ -2887,7 +2887,7 @@
 
   final bool _isLocalFunction;
 
-  ShadowVariableDeclaration(String name, this._functionNestingLevel,
+  VariableDeclarationJudgment(String name, this._functionNestingLevel,
       {Expression initializer,
       DartType type,
       bool isFinal: false,
@@ -2905,25 +2905,29 @@
             isFieldFormal: isFieldFormal,
             isCovariant: isCovariant);
 
-  ShadowVariableDeclaration.forEffect(
+  VariableDeclarationJudgment.forEffect(
       Expression initializer, this._functionNestingLevel)
       : _implicitlyTyped = false,
         _isLocalFunction = false,
         super.forValue(initializer);
 
-  ShadowVariableDeclaration.forValue(
+  VariableDeclarationJudgment.forValue(
       Expression initializer, this._functionNestingLevel)
       : _implicitlyTyped = true,
         _isLocalFunction = false,
         super.forValue(initializer);
 
+  List<Expression> get annotationJudgments => annotations;
+
+  ExpressionJudgment get initializerJudgment => initializer;
+
   @override
   void infer<Expression, Statement, Initializer, Type>(
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory) {
     inferrer.listener.variableDeclarationEnter(fileOffset);
-    if (annotations.isNotEmpty) {
-      inferrer.inferMetadataKeepingHelper(factory, annotations);
+    if (annotationJudgments.isNotEmpty) {
+      inferrer.inferMetadataKeepingHelper(factory, annotationJudgments);
 
       // After the inference was done on the annotations, we may clone them for
       // this instance of VariableDeclaration in order to avoid having the same
@@ -2944,12 +2948,14 @@
       }
     }
 
+    var initializerJudgment = this.initializerJudgment;
     var declaredType = _implicitlyTyped ? const UnknownType() : type;
     DartType inferredType;
     DartType initializerType;
-    if (initializer != null) {
-      initializerType = inferrer.inferExpression(factory, initializer,
-          declaredType, !inferrer.isTopLevel || _implicitlyTyped);
+    if (initializerJudgment != null) {
+      inferrer.inferExpression(factory, initializerJudgment, declaredType,
+          !inferrer.isTopLevel || _implicitlyTyped);
+      initializerType = initializerJudgment.inferredType;
       inferredType = inferrer.inferDeclarationType(initializerType);
     } else {
       inferredType = const DynamicType();
@@ -2970,20 +2976,20 @@
         fileOffset, type, _implicitlyTyped ? inferredType : type);
   }
 
-  /// Determine whether the given [ShadowVariableDeclaration] had an implicit
+  /// Determine whether the given [VariableDeclarationJudgment] had an implicit
   /// type.
   ///
   /// This is static to avoid introducing a method that would be visible to
   /// the kernel.
-  static bool isImplicitlyTyped(ShadowVariableDeclaration variable) =>
+  static bool isImplicitlyTyped(VariableDeclarationJudgment variable) =>
       variable._implicitlyTyped;
 
-  /// Determines whether the given [ShadowVariableDeclaration] represents a
+  /// Determines whether the given [VariableDeclarationJudgment] represents a
   /// local function.
   ///
   /// This is static to avoid introducing a method that would be visible to the
   /// kernel.
-  static bool isLocalFunction(ShadowVariableDeclaration variable) =>
+  static bool isLocalFunction(VariableDeclarationJudgment variable) =>
       variable._isLocalFunction;
 }
 
@@ -3016,7 +3022,7 @@
       ShadowTypeInferrer inferrer,
       Factory<Expression, Statement, Initializer, Type> factory,
       DartType typeContext) {
-    ShadowVariableDeclaration variable = this.variable;
+    VariableDeclarationJudgment variable = this.variable;
     bool mutatedInClosure = variable._mutatedInClosure;
     DartType declaredOrInferredType = variable.type;
 
diff --git a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
index 9b4bf82..0fc6eb5 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/interface_resolver.dart
@@ -49,7 +49,7 @@
         ShadowField,
         ShadowMember,
         ShadowProcedure,
-        ShadowVariableDeclaration;
+        VariableDeclarationJudgment;
 
 import '../messages.dart'
     show
@@ -773,7 +773,7 @@
     }
     var positionalParameters = method.function.positionalParameters;
     for (int i = 0; i < positionalParameters.length; ++i) {
-      if (ShadowVariableDeclaration
+      if (VariableDeclarationJudgment
           .isImplicitlyTyped(positionalParameters[i])) {
         // Note that if the parameter is not present in the overridden method,
         // getPositionalParameterType treats it as dynamic.  This is consistent
@@ -800,7 +800,7 @@
     }
     var namedParameters = method.function.namedParameters;
     for (int i = 0; i < namedParameters.length; i++) {
-      if (ShadowVariableDeclaration.isImplicitlyTyped(namedParameters[i])) {
+      if (VariableDeclarationJudgment.isImplicitlyTyped(namedParameters[i])) {
         var name = namedParameters[i].name;
         namedParameters[i].type = matchTypes(
             overriddenTypes.map((type) => getNamedParameterType(type, name)),
@@ -1264,10 +1264,10 @@
     }
     var function = procedure.function;
     for (var parameter in function.positionalParameters) {
-      if (ShadowVariableDeclaration.isImplicitlyTyped(parameter)) return true;
+      if (VariableDeclarationJudgment.isImplicitlyTyped(parameter)) return true;
     }
     for (var parameter in function.namedParameters) {
-      if (ShadowVariableDeclaration.isImplicitlyTyped(parameter)) return true;
+      if (VariableDeclarationJudgment.isImplicitlyTyped(parameter)) return true;
     }
     return false;
   }
diff --git a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
index bd7a4ac..95e550b 100644
--- a/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
+++ b/pkg/front_end/lib/src/fasta/type_inference/type_inferrer.dart
@@ -92,7 +92,7 @@
         ShadowField,
         ShadowMember,
         NullJudgment,
-        ShadowVariableDeclaration,
+        VariableDeclarationJudgment,
         getExplicitTypeArguments;
 
 import '../names.dart' show callName;
@@ -1319,8 +1319,8 @@
     // Otherwise, if `Qi` is not `_`, let `Ri` be the greatest closure of
     // `Qi[T/S]` with respect to `?`.  Otherwise, let `Ri` be `dynamic`.
     for (int i = 0; i < formals.length; i++) {
-      ShadowVariableDeclaration formal = formals[i];
-      if (ShadowVariableDeclaration.isImplicitlyTyped(formal)) {
+      VariableDeclarationJudgment formal = formals[i];
+      if (VariableDeclarationJudgment.isImplicitlyTyped(formal)) {
         DartType inferredType;
         if (formalTypesFromContext[i] == coreTypes.nullClass.rawType) {
           inferredType = coreTypes.objectClass.rawType;
@@ -1810,8 +1810,8 @@
     }
     if (expression is VariableGet) {
       var variable = expression.variable;
-      if (variable is ShadowVariableDeclaration &&
-          ShadowVariableDeclaration.isLocalFunction(variable)) {
+      if (variable is VariableDeclarationJudgment &&
+          VariableDeclarationJudgment.isLocalFunction(variable)) {
         return templateInvalidCastLocalFunction;
       }
     }
diff --git a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
index 679349d..97a1d64 100644
--- a/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
+++ b/pkg/front_end/test/fasta/type_inference/interface_resolver_test.dart
@@ -201,7 +201,7 @@
       {String name: 'foo',
       DartType setterType: const DynamicType(),
       bool isCovariant: false}) {
-    var parameter = new ShadowVariableDeclaration('value', 0,
+    var parameter = new VariableDeclarationJudgment('value', 0,
         type: setterType, isCovariant: isCovariant);
     var body = new Block([]);
     var function = new FunctionNode(body,
@@ -256,7 +256,7 @@
   }
 
   void test_candidate_for_setter() {
-    var parameter = new ShadowVariableDeclaration('value', 0);
+    var parameter = new VariableDeclarationJudgment('value', 0);
     var function = new FunctionNode(null,
         positionalParameters: [parameter], returnType: const VoidType());
     var setter = new ShadowProcedure(
@@ -367,8 +367,8 @@
         kind: ProcedureKind.Operator,
         name: '[]=',
         positionalParameters: [
-          new ShadowVariableDeclaration('index', 0, type: intType),
-          new ShadowVariableDeclaration('value', 0, type: numType)
+          new VariableDeclarationJudgment('index', 0, type: intType),
+          new VariableDeclarationJudgment('value', 0, type: numType)
         ]);
     var stub = makeForwardingStub(operator, false);
     expect(stub.name, operator.name);
@@ -397,7 +397,7 @@
   }
 
   void test_createForwardingStub_optionalNamedParameter() {
-    var parameter = new ShadowVariableDeclaration('x', 0, type: intType);
+    var parameter = new VariableDeclarationJudgment('x', 0, type: intType);
     var method = makeEmptyMethod(namedParameters: [parameter]);
     var stub = makeForwardingStub(method, false);
     expect(stub.function.namedParameters, hasLength(1));
@@ -414,7 +414,7 @@
   }
 
   void test_createForwardingStub_optionalPositionalParameter() {
-    var parameter = new ShadowVariableDeclaration('x', 0, type: intType);
+    var parameter = new VariableDeclarationJudgment('x', 0, type: intType);
     var method = makeEmptyMethod(
         positionalParameters: [parameter], requiredParameterCount: 0);
     var stub = makeForwardingStub(method, false);
@@ -431,7 +431,7 @@
   }
 
   void test_createForwardingStub_requiredParameter() {
-    var parameter = new ShadowVariableDeclaration('x', 0, type: intType);
+    var parameter = new VariableDeclarationJudgment('x', 0, type: intType);
     var method = makeEmptyMethod(positionalParameters: [parameter]);
     var stub = makeForwardingStub(method, false);
     expect(stub.function.positionalParameters, hasLength(1));
@@ -512,9 +512,9 @@
     // class C<T> { T foo(T x, {T y}); }
     var T = new TypeParameter('T', objectType);
     var x =
-        new ShadowVariableDeclaration('x', 0, type: new TypeParameterType(T));
+        new VariableDeclarationJudgment('x', 0, type: new TypeParameterType(T));
     var y =
-        new ShadowVariableDeclaration('y', 0, type: new TypeParameterType(T));
+        new VariableDeclarationJudgment('y', 0, type: new TypeParameterType(T));
     var method = makeEmptyMethod(
         positionalParameters: [x],
         namedParameters: [y],
@@ -547,9 +547,9 @@
     var T = new TypeParameter('T', objectType);
     var U = new TypeParameter('U', objectType);
     var x =
-        new ShadowVariableDeclaration('x', 0, type: new TypeParameterType(T));
+        new VariableDeclarationJudgment('x', 0, type: new TypeParameterType(T));
     var y =
-        new ShadowVariableDeclaration('y', 0, type: new TypeParameterType(U));
+        new VariableDeclarationJudgment('y', 0, type: new TypeParameterType(U));
     var method =
         makeEmptyMethod(typeParameters: [U], positionalParameters: [x, y]);
     var substitution = Substitution.fromPairs([T], [intType]);
@@ -563,7 +563,7 @@
   void test_createForwardingStub_typeParameter_substituteUses() {
     // class C { void foo<T>(T x); }
     var typeParameter = new TypeParameter('T', objectType);
-    var param = new ShadowVariableDeclaration('x', 0,
+    var param = new VariableDeclarationJudgment('x', 0,
         type: new TypeParameterType(typeParameter));
     var method = makeEmptyMethod(
         typeParameters: [typeParameter], positionalParameters: [param]);
@@ -578,7 +578,7 @@
     var typeParameter = new TypeParameter('T', null);
     typeParameter.bound =
         new InterfaceType(listClass, [new TypeParameterType(typeParameter)]);
-    var param = new ShadowVariableDeclaration('x', 0,
+    var param = new VariableDeclarationJudgment('x', 0,
         type: new TypeParameterType(typeParameter));
     var method = makeEmptyMethod(
         typeParameters: [typeParameter], positionalParameters: [param]);
@@ -596,9 +596,9 @@
   void test_direct_isGenericCovariant() {
     var typeParameter = new TypeParameter('T', objectType);
     var u = new TypeParameter('U', new TypeParameterType(typeParameter));
-    var x = new ShadowVariableDeclaration('x', 0,
+    var x = new VariableDeclarationJudgment('x', 0,
         type: new TypeParameterType(typeParameter));
-    var y = new ShadowVariableDeclaration('y', 0,
+    var y = new VariableDeclarationJudgment('y', 0,
         type: new TypeParameterType(typeParameter));
     var method = makeEmptyMethod(
         typeParameters: [u], positionalParameters: [x], namedParameters: [y]);
@@ -708,14 +708,14 @@
 
   void test_forwardingStub_isCovariant_inherited() {
     var methodA = makeEmptyMethod(positionalParameters: [
-      new ShadowVariableDeclaration('x', 0, type: numType)
+      new VariableDeclarationJudgment('x', 0, type: numType)
     ], namedParameters: [
-      new ShadowVariableDeclaration('y', 0, type: numType)
+      new VariableDeclarationJudgment('y', 0, type: numType)
     ]);
     var methodB = makeEmptyMethod(positionalParameters: [
-      new ShadowVariableDeclaration('x', 0, type: intType)..isCovariant = true
+      new VariableDeclarationJudgment('x', 0, type: intType)..isCovariant = true
     ], namedParameters: [
-      new ShadowVariableDeclaration('y', 0, type: intType)..isCovariant = true
+      new VariableDeclarationJudgment('y', 0, type: intType)..isCovariant = true
     ]);
     var a = makeClass(name: 'A', procedures: [methodA]);
     var b = makeClass(name: 'B', procedures: [methodB]);
@@ -739,20 +739,20 @@
     var methodA = makeEmptyMethod(typeParameters: [
       new TypeParameter('U', numType)
     ], positionalParameters: [
-      new ShadowVariableDeclaration('x', 0, type: numType)
+      new VariableDeclarationJudgment('x', 0, type: numType)
     ], namedParameters: [
-      new ShadowVariableDeclaration('y', 0, type: numType)
+      new VariableDeclarationJudgment('y', 0, type: numType)
     ]);
     var typeParameterB = new TypeParameter('T', objectType);
     var methodB = makeEmptyMethod(typeParameters: [
       new TypeParameter('U', new TypeParameterType(typeParameterB))
         ..isGenericCovariantImpl = true
     ], positionalParameters: [
-      new ShadowVariableDeclaration('x', 0,
+      new VariableDeclarationJudgment('x', 0,
           type: new TypeParameterType(typeParameterB))
         ..isGenericCovariantImpl = true
     ], namedParameters: [
-      new ShadowVariableDeclaration('y', 0,
+      new VariableDeclarationJudgment('y', 0,
           type: new TypeParameterType(typeParameterB))
         ..isGenericCovariantImpl = true
     ]);
@@ -907,11 +907,11 @@
   }
 
   void test_resolve_directly_declared() {
-    var parameterA = new ShadowVariableDeclaration('x', 0,
+    var parameterA = new VariableDeclarationJudgment('x', 0,
         type: objectType, isCovariant: true);
     var methodA = makeEmptyMethod(positionalParameters: [parameterA]);
-    var parameterB =
-        new ShadowVariableDeclaration('x', 0, type: intType, isCovariant: true);
+    var parameterB = new VariableDeclarationJudgment('x', 0,
+        type: intType, isCovariant: true);
     var methodB = makeEmptyMethod(positionalParameters: [parameterB]);
     var a = makeClass(name: 'A', procedures: [methodA]);
     var b = makeClass(
@@ -987,16 +987,16 @@
 
   void test_resolve_with_added_implementation() {
     var methodA = makeEmptyMethod(positionalParameters: [
-      new ShadowVariableDeclaration('x', 0, type: numType)
+      new VariableDeclarationJudgment('x', 0, type: numType)
     ]);
     var typeParamB = new TypeParameter('T', objectType);
     var methodB = makeEmptyMethod(positionalParameters: [
-      new ShadowVariableDeclaration('x', 0,
+      new VariableDeclarationJudgment('x', 0,
           type: new TypeParameterType(typeParamB))
         ..isGenericCovariantImpl = true
     ]);
     var methodC = makeEmptyMethod(positionalParameters: [
-      new ShadowVariableDeclaration('x', 0, type: numType)
+      new VariableDeclarationJudgment('x', 0, type: numType)
     ], isAbstract: true);
     var a = makeClass(name: 'A', procedures: [methodA]);
     var b = makeClass(