Ejemplo n.º 1
0
  @Override
  public Type egressType(Scope scope) {
    // MAJOR HACK(dhanji): Special case print for now.
    if (PRINT.equals(name)) {
      // Because we short-circuit the print() case, we need to probe the ingress
      // types of the (single) argument. This triggers the witnessing of called
      // functions that are polymorphic in the argument expression.
      // In other words, we need to exercise the argument types in order to generate
      // overloads for any unbound functions.
      assert args.children().size() == 1;
      args.children().get(0).egressType(scope);

      return Types.VOID;
    }

    FunctionDecl function = scope.getFunction(name);
    if (null == function) {
      scope.errors().unknownFunction(name);
      return Types.VOID;
    }

    // Assert argument type mismatches if appropriate.
    return function.inferType(scope, args);
  }
Ejemplo n.º 2
0
 @Override
 public String toString() {
   return "ConstructorCall{" + name + args.toString() + "}";
 }
Ejemplo n.º 3
0
 @Override
 public String toString() {
   return "Call{" + name + (isFunction ? args.toString() : "") + "}";
 }