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

Unified Diff: pkg/compiler/lib/src/ssa/kernel_impact.dart

Issue 2375613003: Handle getters/setters and try in kernel_impact. (Closed)
Patch Set: Created 4 years, 3 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 | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/ssa/kernel_impact.dart
diff --git a/pkg/compiler/lib/src/ssa/kernel_impact.dart b/pkg/compiler/lib/src/ssa/kernel_impact.dart
index 81b6358ac9ee5e56485d707b6ecf918c31b96d27..74d604237d787c80deb1d04c8c01b71ee3480e6e 100644
--- a/pkg/compiler/lib/src/ssa/kernel_impact.dart
+++ b/pkg/compiler/lib/src/ssa/kernel_impact.dart
@@ -29,7 +29,7 @@ ResolutionImpact build(Compiler compiler, ResolvedAst resolvedAst) {
Kernel kernel = backend.kernelTask.kernel;
KernelImpactBuilder builder =
new KernelImpactBuilder(resolvedAst, compiler, kernel);
- if (element.isFunction) {
+ if (element.isFunction || element.isGetter || element.isSetter) {
ir.Procedure function = kernel.functions[element];
if (function == null) {
print("FOUND NULL FUNCTION: $element");
@@ -39,7 +39,7 @@ ResolutionImpact build(Compiler compiler, ResolvedAst resolvedAst) {
} else {
ir.Field field = kernel.fields[element];
if (field == null) {
- print("FOUND NULL FUNCTION: $element");
+ print("FOUND NULL FIELD: $element");
} else {
return builder.buildField(field);
}
@@ -93,8 +93,7 @@ class KernelImpactBuilder extends ir.Visitor {
}
ResolutionImpact buildProcedure(ir.Procedure procedure) {
- if (procedure.kind == ir.ProcedureKind.Method ||
- procedure.kind == ir.ProcedureKind.Operator) {
+ if (procedure.kind != ir.ProcedureKind.Factory) {
checkFunctionTypes(procedure.function);
visitNode(procedure.function.body);
switch (procedure.function.asyncMarker) {
@@ -280,6 +279,13 @@ class KernelImpactBuilder extends ir.Visitor {
}
@override
+ void visitStaticSet(ir.StaticSet node) {
+ visitNode(node.value);
+ Element element = astAdapter.getElement(node.target).declaration;
+ impactBuilder.registerStaticUse(new StaticUse.staticSet(element));
+ }
+
+ @override
void visitMethodInvocation(ir.MethodInvocation invocation) {
var receiver = invocation.receiver;
if (receiver is ir.VariableGet &&
@@ -384,6 +390,31 @@ class KernelImpactBuilder extends ir.Visitor {
impactBuilder.registerDynamicUse(new DynamicUse(Selectors.moveNext, null));
}
+ @override
+ void visitTryCatch(ir.TryCatch node) {
+ visitNode(node.body);
+ visitNodes(node.catches);
+ }
+
+ @override
+ void visitCatch(ir.Catch node) {
+ impactBuilder.registerFeature(Feature.CATCH_STATEMENT);
+ visitNode(node.exception);
+ if (node.stackTrace != null) {
+ impactBuilder.registerFeature(Feature.STACK_TRACE_IN_CATCH);
+ }
+ if (node.guard is! ir.DynamicType) {
+ impactBuilder.registerTypeUse(
+ new TypeUse.catchType(astAdapter.getDartType(node.guard)));
+ }
+ visitNode(node.body);
+ }
+
+ @override
+ void visitTryFinally(ir.TryFinally node) {
+ visitNode(node.body);
Harry Terkelsen 2016/09/27 17:12:37 also visit the finalizer
Johnni Winther 2016/09/30 07:59:04 Done.
+ }
+
// TODO(johnniwinther): Make this throw and visit child nodes explicitly
// instead to ensure that we don't visit unwanted parts of the ir.
@override
« no previous file with comments | « no previous file | tests/compiler/dart2js/kernel/impact_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698