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

Unified Diff: tests/compiler/dart2js/equivalence/id_equivalence.dart

Issue 2951723002: Add closure_test for kernel based members (Closed)
Patch Set: Cleanup Created 3 years, 6 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
Index: tests/compiler/dart2js/equivalence/id_equivalence.dart
diff --git a/tests/compiler/dart2js/equivalence/id_equivalence.dart b/tests/compiler/dart2js/equivalence/id_equivalence.dart
index e6665eb376fcd1f9bbde64b902ddb50cf84c8dd9..749a7b8ebb3ec2cb29d4579f47ebf125353f2f20 100644
--- a/tests/compiler/dart2js/equivalence/id_equivalence.dart
+++ b/tests/compiler/dart2js/equivalence/id_equivalence.dart
@@ -9,7 +9,10 @@ import 'package:compiler/src/resolution/tree_elements.dart';
import 'package:compiler/src/tree/nodes.dart' as ast;
import 'package:kernel/ast.dart' as ir;
-enum IdKind { element, node, local_variable, local_function }
+enum IdKind {
+ element,
+ node,
+}
/// Id for a code point or element with type inference information.
abstract class Id {
@@ -85,7 +88,7 @@ abstract class AstEnumeratorMixin {
case AccessKind.DYNAMIC_PROPERTY:
return new NodeId(node.selector.getBeginToken().charOffset);
default:
- return new NodeId(node.getBeginToken().charOffset);
+ return null;
}
}
@@ -98,13 +101,11 @@ abstract class AstEnumeratorMixin {
switch (sendStructure.kind) {
case SendStructureKind.GET:
case SendStructureKind.INVOKE:
- case SendStructureKind.INCOMPATIBLE_INVOKE:
return computeAccessId(node, sendStructure.semantics);
default:
- return new NodeId(node.getBeginToken().charOffset);
}
}
- return new NodeId(node.getBeginToken().charOffset);
+ return null;
}
}
@@ -202,13 +203,19 @@ abstract class IrEnumeratorMixin {
return new ElementId.internal(memberName, className);
}
- Id computeNodeId(ir.Node node) {
+ Id computeNodeId(ir.TreeNode node) {
if (node is ir.MethodInvocation) {
assert(node.fileOffset != ir.TreeNode.noOffset);
return new NodeId(node.fileOffset);
} else if (node is ir.PropertyGet) {
assert(node.fileOffset != ir.TreeNode.noOffset);
return new NodeId(node.fileOffset);
+ } else if (node is ir.VariableDeclaration) {
+ assert(node.fileOffset != ir.TreeNode.noOffset);
+ return new NodeId(node.fileOffset);
+ } else if (node is ir.FunctionDeclaration) {
+ assert(node.fileOffset != ir.TreeNode.noOffset);
+ return new NodeId(node.fileOffset);
}
return null;
}
@@ -228,7 +235,7 @@ class IrIdFinder extends ir.Visitor with IrEnumeratorMixin {
return result;
}
- defaultNode(ir.Node node) {
+ defaultTreeNode(ir.TreeNode node) {
if (found == null) {
Id id = computeNodeId(node);
if (id == soughtId) {
@@ -246,7 +253,7 @@ class IrIdFinder extends ir.Visitor with IrEnumeratorMixin {
found = node;
return;
}
- defaultNode(node);
+ defaultTreeNode(node);
}
}
}
« no previous file with comments | « tests/compiler/dart2js/closure/closure_test.dart ('k') | tests/compiler/dart2js/equivalence/id_equivalence_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698