public Void VisitReturnStmt(Stmt.Return stmt) { object value = null; if (stmt.Value != null) { value = Evaluate(stmt.Value); } throw new Return(value); }
public object VisitReturnStmt(Stmt.Return stmt) { object value = null; if (stmt.value != null) { value = Evaluate(stmt.value); } throw new ReturnException(value); }
public Void VisitReturnStmt(Stmt.Return stmt) { if (_currentFunction == FunctionType.NONE) { Lox.Error(stmt.Keyword, "Can't return from top-level code."); } if (stmt.Value != null) { if (_currentFunction == FunctionType.INITIALIZER) { Lox.Error(stmt.Keyword, "Can't return a value from an initializer"); } Resolve(stmt.Value); } return(null); }
public object VisitReturnStmt(Stmt.Return stmt) { if (currentFunction == FunctionType.NONE) { Lox.Error(stmt.keyword, "Return statement must be inside a function."); } if (stmt.value != null) { if (currentFunction == FunctionType.INITIALIZER) { Lox.Error(stmt.keyword, "Cannot return a value from an initializer."); } Resolve(stmt.value); } return(null); }
public object VisitReturnStmt(Stmt.Return stmt) { if (currentFunction == FunctionType.NONE) { Program.Error(stmt.keyword, "Can't return from top-level code."); } if (stmt.value != null) { if (currentFunction == FunctionType.INITIALIZER) { Program.Error(stmt.keyword, "Can't return a value from an initializer."); } Resolve(stmt.value); } return(null); }
public object Visit(Stmt.Return _return) { if (_currentFunction == FunctionType.NONE) { Lox.Error(_return.keyword, "Cannot return from top-level code."); } if (_return.value != null) { if (_currentFunction == FunctionType.INITIALIZER) { Lox.Error(_return.keyword, "Cannot return a value from an initializer."); } Resolve(_return.value); } return(null); }
public string VisitReturnStmt(Stmt.Return stmt) { throw new NotImplementedException(); }
public string VisitReturnStmt(Stmt.Return stmt) => throw new System.NotImplementedException();