Rename klass getter on InstanceConstant to classNode

This achieves consistency with similar getters in the API.

This is technically a breaking change, since it changes a published
part of the Kernel API. Since the constants API is relatively new and
so far only used internally in the AOT compiler, the change is
expected to be unproblematic.

Closes https://github.com/dart-lang/sdk/issues/35696

Change-Id: I3ca30922580d226ccbdb6f77496983c21ef2102b
Reviewed-on: https://dart-review.googlesource.com/c/90220
Commit-Queue: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71815ac..d8eca42 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -47,6 +47,13 @@
 
 [29554]: https://github.com/dart-lang/sdk/issues/29554
 
+### Other library changes
+
+#### `package:kernel`
+
+*   **Breaking change:** The `klass` getter on the `InstanceConstant` class in
+    the Kernel AST API has been renamed to `classNode` for consistency.
+
 ### Dart VM
 
 ### Tool Changes
diff --git a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart
index d24c6fc..c0be105 100644
--- a/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/type_labeler.dart
@@ -240,10 +240,10 @@
   }
 
   void visitInstanceConstant(InstanceConstant node) {
-    new InterfaceType(node.klass, node.typeArguments).accept(this);
+    new InterfaceType(node.classNode, node.typeArguments).accept(this);
     result.add(" {");
     bool first = true;
-    for (Field field in node.klass.fields) {
+    for (Field field in node.classNode.fields) {
       if (field.isStatic) continue;
       if (!first) result.add(", ");
       result.add("${field.name}: ");
diff --git a/pkg/kernel/lib/ast.dart b/pkg/kernel/lib/ast.dart
index 6d7102b..5f6abdf 100644
--- a/pkg/kernel/lib/ast.dart
+++ b/pkg/kernel/lib/ast.dart
@@ -5306,7 +5306,7 @@
 
   InstanceConstant(this.classReference, this.typeArguments, this.fieldValues);
 
-  Class get klass => classReference.asClass;
+  Class get classNode => classReference.asClass;
 
   visitChildren(Visitor v) {
     classReference.asClass.acceptReference(v);
@@ -5354,7 +5354,7 @@
   }
 
   DartType getType(TypeEnvironment types) =>
-      new InterfaceType(klass, typeArguments);
+      new InterfaceType(classNode, typeArguments);
 }
 
 class PartialInstantiationConstant extends Constant {
diff --git a/pkg/kernel/lib/binary/ast_to_binary.dart b/pkg/kernel/lib/binary/ast_to_binary.dart
index cea20d1..61eae52 100644
--- a/pkg/kernel/lib/binary/ast_to_binary.dart
+++ b/pkg/kernel/lib/binary/ast_to_binary.dart
@@ -221,7 +221,7 @@
       constant.entries.forEach(writeConstantReference);
     } else if (constant is InstanceConstant) {
       writeByte(ConstantTag.InstanceConstant);
-      writeClassReference(constant.klass);
+      writeClassReference(constant.classNode);
       writeUInt30(constant.typeArguments.length);
       constant.typeArguments.forEach(writeDartType);
       writeUInt30(constant.fieldValues.length);
diff --git a/pkg/kernel/lib/external_name.dart b/pkg/kernel/lib/external_name.dart
index 4da52a8..2646fc4 100644
--- a/pkg/kernel/lib/external_name.dart
+++ b/pkg/kernel/lib/external_name.dart
@@ -27,7 +27,7 @@
     } else if (annotation is ConstantExpression) {
       final constant = annotation.constant;
       if (constant is InstanceConstant) {
-        if (_isExternalName(constant.klass)) {
+        if (_isExternalName(constant.classNode)) {
           return (constant.fieldValues.values.single as StringConstant).value;
         }
       }
diff --git a/pkg/kernel/lib/text/ast_to_text.dart b/pkg/kernel/lib/text/ast_to_text.dart
index 8844c12..fe34841 100644
--- a/pkg/kernel/lib/text/ast_to_text.dart
+++ b/pkg/kernel/lib/text/ast_to_text.dart
@@ -1959,8 +1959,8 @@
     final String name = syntheticNames.nameConstant(node);
     write('  $name = ');
     final sb = new StringBuffer();
-    sb.write('${node.klass}');
-    if (!node.klass.typeParameters.isEmpty) {
+    sb.write('${node.classNode}');
+    if (!node.classNode.typeParameters.isEmpty) {
       sb.write('<');
       sb.write(node.typeArguments.map((type) => type.toString()).join(', '));
       sb.write('>');
diff --git a/pkg/kernel/lib/transformations/constants.dart b/pkg/kernel/lib/transformations/constants.dart
index 16f98b7..b66629c 100644
--- a/pkg/kernel/lib/transformations/constants.dart
+++ b/pkg/kernel/lib/transformations/constants.dart
@@ -566,7 +566,7 @@
 
         // Special case the dart:core's Symbol class here and convert it to a
         // [SymbolConstant].  For invalid values we report a compile-time error.
-        if (result.klass == coreTypes.internalSymbolClass) {
+        if (result.classNode == coreTypes.internalSymbolClass) {
           // The dart:_internal's Symbol class has only the name field.
           assert(coreTypes.internalSymbolClass.fields
                   .where((f) => !f.isStatic)
diff --git a/pkg/kernel/lib/transformations/treeshaker.dart b/pkg/kernel/lib/transformations/treeshaker.dart
index 07218c9..b340326 100644
--- a/pkg/kernel/lib/transformations/treeshaker.dart
+++ b/pkg/kernel/lib/transformations/treeshaker.dart
@@ -977,7 +977,7 @@
 
   @override
   visitInstanceConstant(InstanceConstant node) {
-    shaker._addInstantiatedClass(node.klass);
+    shaker._addInstantiatedClass(node.classNode);
     super.visitInstanceConstant(node);
   }
 
diff --git a/pkg/vm/lib/bytecode/gen_bytecode.dart b/pkg/vm/lib/bytecode/gen_bytecode.dart
index 3ebc857..cfbfd76 100644
--- a/pkg/vm/lib/bytecode/gen_bytecode.dart
+++ b/pkg/vm/lib/bytecode/gen_bytecode.dart
@@ -3040,10 +3040,10 @@
 
   @override
   int visitInstanceConstant(InstanceConstant node) => cp.addInstance(
-      node.klass,
-      hasInstantiatorTypeArguments(node.klass)
+      node.classNode,
+      hasInstantiatorTypeArguments(node.classNode)
           ? cp.addTypeArgumentsForInstanceAllocation(
-              node.klass, node.typeArguments)
+              node.classNode, node.typeArguments)
           : cp.addNull(),
       node.fieldValues.map<Field, int>((Reference fieldRef, Constant value) =>
           new MapEntry(fieldRef.asField, value.accept(this))));
diff --git a/pkg/vm/lib/transformations/type_flow/summary_collector.dart b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
index e9d777b..f4e50e7 100644
--- a/pkg/vm/lib/transformations/type_flow/summary_collector.dart
+++ b/pkg/vm/lib/transformations/type_flow/summary_collector.dart
@@ -1629,8 +1629,8 @@
 
   @override
   Type visitInstanceConstant(InstanceConstant constant) {
-    final resultType =
-        summaryCollector._entryPointsListener.addAllocatedClass(constant.klass);
+    final resultType = summaryCollector._entryPointsListener
+        .addAllocatedClass(constant.classNode);
     constant.fieldValues.forEach((Reference fieldReference, Constant value) {
       summaryCollector._entryPointsListener
           .addDirectFieldAccess(fieldReference.asField, typeFor(value));
diff --git a/pkg/vm/lib/transformations/type_flow/transformer.dart b/pkg/vm/lib/transformations/type_flow/transformer.dart
index 4e3103d..c0b92a0 100644
--- a/pkg/vm/lib/transformations/type_flow/transformer.dart
+++ b/pkg/vm/lib/transformations/type_flow/transformer.dart
@@ -1050,7 +1050,7 @@
   @override
   visitInstanceConstant(InstanceConstant constant) {
     instanceConstants.add(constant);
-    shaker.addClassUsedInType(constant.klass);
+    shaker.addClassUsedInType(constant.classNode);
     visitList(constant.typeArguments, typeVisitor);
     constant.fieldValues.forEach((Reference fieldRef, Constant value) {
       shaker.addUsedMember(fieldRef.asField);