public Type GetInstanceType(Expr node, bool isReturnType)
 {
     // Special-case void types for return types
     if (isReturnType && node is TypeExpr && ((TypeExpr)node).type is VoidType) {
         return ((TypeExpr)node).type;
     }
     helper.scope = scope;
     node.Accept(helper);
     if (node.computedType.IsCompleteType()) {
         return node.computedType.InstanceType();
     }
     log.ErrorNotUseableType(node.location, node.computedType);
     return new ErrorType();
 }
示例#2
0
 private object Evaluate(Expr expr)
 {
     return(expr.Accept(this));
 }
示例#3
0
 // Print expression in polish notation
 public string Print(Expr expr)
 {
     return(expr?.Accept(this));
 }
示例#4
0
 public override void Accept(IASTEncoder encoder)
 {
     Expr.Accept(encoder); encoder.Encode(this);
 }
示例#5
0
 internal override void Accept(ExprVisitor visitor)
 {
     visitor.Visit(this);
     _obj.Accept(visitor);
     _ifIsError.Accept(visitor);
 }
示例#6
0
 object evaluate(Expr expr)
 {
     return(expr.Accept(this));
 }
示例#7
0
 public virtual T Visit(Expr e) => e.Accept(this);
 public override void GenCode(Expr expr)
 {
     expr.Accept(this);
 }
示例#9
0
 private void Resolve(Expr expr) => expr.Accept(this);
示例#10
0
 internal static string Print(Expr expr)
 {
     return(expr.Accept(new AstPrinter()));
 }
示例#11
0
 public void WriteLine(Expr expr)
 {
     writer.WriteLine(expr.Accept <string>(this));
 }
示例#12
0
 private object Resolve(Expr expression)
 {
     return(expression.Accept(this));
 }