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

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: 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
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) {
ngeoffray 2012/08/17 10:02:51 How about a function with multiple return?
Søren Gjesse 2012/08/17 10:08:54 This should be handled by the graph.exit.predeces
ngeoffray 2012/08/17 10:13:29 Hmm, a HReturn block has the HExit block as a succ
Søren Gjesse 2012/08/17 10:21:04 I checked the (3) places where HReturn nodes are c
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698