compiler/passes/normalize.cpp
// The type-expr is known to be a simple DefExpr
The type-expr is known to be a simple DefExpr
The type - expr is known to be a simple DefExpr
static void replaceUsesWithPrimTypeof(FnSymbol* fn, ArgSymbol* formal) {
  BlockStmt*            typeExpr = formal->typeExpr;
  DefExpr*              def      = toDefExpr(typeExpr->body.tail);
  std::vector<SymExpr*> symExprs;
  collectSymExprs(fn, symExprs);
  if (formal->variableExpr) 
    addToWhereClause(fn, formal, new CallExpr(PRIM_IS_STAR_TUPLE_TYPE, formal));
  for_vector(SymExpr, se, symExprs) {
    if (se->symbol() == def->sym) {
      if (formal->variableExpr)
        se->replace(new CallExpr(PRIM_QUERY, formal, new_IntSymbol(2)));
      else
        se->replace(new CallExpr(PRIM_TYPEOF, formal));
    }
  }
  formal->typeExpr->remove();
  formal->type = dtAny;
}
static void replaceUsesWithPrimTypeof ( FnSymbol * fn , ArgSymbol * formal ) { BlockStmt * typeExpr = formal -> typeExpr ; DefExpr * def = toDefExpr ( typeExpr -> body . tail ) ; std :: vector < SymExpr * > symExprs ; collectSymExprs ( fn , symExprs ) ; if ( formal -> variableExpr ) addToWhereClause ( fn , formal , new CallExpr ( PRIM_IS_STAR_TUPLE_TYPE , formal ) ) ; for_vector ( SymExpr , se , symExprs ) { if ( se -> symbol ( ) == def -> sym ) { if ( formal -> variableExpr ) se -> replace ( new CallExpr ( PRIM_QUERY , formal , new_IntSymbol ( 2 ) ) ) ; else se -> replace ( new CallExpr ( PRIM_TYPEOF , formal ) ) ; } } formal -> typeExpr -> remove ( ) ; formal -> type = dtAny ; }
The type-expr is known to be a simple DefExpr
The type - expr is known to be a simple DefExpr
// varargs argument e.g. proc f(x...) // e.g. proc foo(arg:?t ...) // formal is a tuple but the query should be of the tuple elements // 1 is the size field, 2 is the index of the first tuple field