From 59e47aca14ce352a1814953df4be220406c94747 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Mon, 12 Sep 2016 10:00:43 -0700 Subject: 3341 Process type abbreviations in function headers. Still a couple of places where doing this causes strange errors. We'll track those down next. --- 053recipe_header.cc | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to '053recipe_header.cc') diff --git a/053recipe_header.cc b/053recipe_header.cc index d385d41c..0bbba110 100644 --- a/053recipe_header.cc +++ b/053recipe_header.cc @@ -142,6 +142,28 @@ if (result.has_header) { trace(9999, "parse") << "recipe " << result.name << " has a header" << end(); } +//: Support type abbreviations in headers. + +:(scenario type_abbreviations_in_recipe_headers) +type string = address:array:character +def main [ + local-scope + a:string <- foo + 1:character/raw <- index *a, 0 +] +def foo -> a:string [ + local-scope + load-ingredients + a <- new [abc] +] ++mem: storing 97 in location 1 + +:(before "End Expand Type Abbreviations(caller)") +for (long int i = 0; i < SIZE(caller.ingredients); ++i) + expand_type_abbreviations(caller.ingredients.at(i).type); +for (long int i = 0; i < SIZE(caller.products); ++i) + expand_type_abbreviations(caller.products.at(i).type); + //: Rewrite 'load-ingredients' to instructions to create all reagents in the header. :(before "End Rewrite Instruction(curr, recipe result)") -- cgit 1.4.1-2-gfad0