Remove push/pop_local_changes from FileProvider trait
[hiphop-php.git] / hphp / hack / src / rupro / hackrs / typing_check_job.rs
blobb46290b643b178508bcc86da98cedbf3e8d1ab17
1 // Copyright (c) Facebook, Inc. and its affiliates.
2 //
3 // This source code is licensed under the MIT license found in the
4 // LICENSE file in the "hack" directory of this source tree.
6 use std::rc::Rc;
8 use oxidized::nast;
10 use crate::errors::HackError;
11 use crate::typing::typing_error::Result;
12 use crate::typing_ctx::TypingCtx;
13 use crate::typing_toplevel::TypingToplevel;
14 use ty::reason::Reason;
16 use crate::tast;
18 pub struct TypingCheckJob;
20 impl TypingCheckJob {
21     pub fn type_fun<R: Reason>(
22         ctx: Rc<TypingCtx<R>>,
23         ast: &nast::FunDef,
24     ) -> Result<(tast::Def<R>, Vec<HackError<R>>)> {
25         let (def, typing_errors) = TypingToplevel::fun_def(ctx, ast)?;
26         let def = oxidized::aast::Def::Fun(Box::new(def));
27         Ok((def, typing_errors.into_iter().map(Into::into).collect()))
28     }
30     pub fn type_class<R: Reason>(
31         ctx: Rc<TypingCtx<R>>,
32         ast: &nast::Class_,
33     ) -> Result<(tast::Def<R>, Vec<HackError<R>>)> {
34         let (def, typing_errors) = TypingToplevel::class_def(ctx, ast)?;
35         let def = oxidized::aast::Def::Class(Box::new(def));
36         Ok((def, typing_errors.into_iter().map(Into::into).collect()))
37     }
39     pub fn type_typedef<R: Reason>(
40         _ctx: Rc<TypingCtx<R>>,
41         _ast: &nast::Typedef,
42     ) -> Result<(tast::Def<R>, Vec<HackError<R>>)> {
43         todo!()
44     }
46     pub fn type_const<R: Reason>(
47         _ctx: Rc<TypingCtx<R>>,
48         _ast: &nast::Gconst,
49     ) -> Result<(tast::Def<R>, Vec<HackError<R>>)> {
50         todo!()
51     }