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

Unified Diff: lib/compiler/implementation/ssa/codegen.dart

Issue 10823389: Start inferring return types for static functions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 8 years, 4 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 | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/compiler/dart2js/return_type_inferer_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/ssa/codegen.dart
diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart
index f68eedea1faed2849d015a57aa7f258300eda6ed..ec02d39175ffeeef51e0e8c3c95a636213acb607 100644
--- a/lib/compiler/implementation/ssa/codegen.dart
+++ b/lib/compiler/implementation/ssa/codegen.dart
@@ -27,6 +27,15 @@ class SsaCodeGeneratorTask extends CompilerTask {
CodeBuffer generateMethod(WorkItem work, HGraph graph) {
return measure(() {
+ HTypeMap types = work.compilationContext.types;
+ graph.exit.predecessors.forEach((block) {
+ assert(block.last is HGoto || block.last is HReturn);
+ if (block.last is HReturn) {
+ backend.registerReturnType(work.element, types[block.last.inputs[0]]);
+ } else {
+ backend.registerReturnType(work.element, HType.NULL);
+ }
+ });
compiler.tracer.traceGraph("codegen", graph);
Map<Element, String> parameterNames = getParameterNames(work);
parameterNames.forEach((element, name) {
« no previous file with comments | « lib/compiler/implementation/ssa/builder.dart ('k') | tests/compiler/dart2js/return_type_inferer_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698