rajac_types/
method_signature.rs1use crate::TypeId;
2use rajac_base::shared_string::SharedString;
3
4#[derive(Debug, Clone, Copy, PartialEq, Eq)]
6pub struct MethodModifiers(pub u32);
7
8impl MethodModifiers {
9 pub const PUBLIC: u32 = 0x0001;
11 pub const PRIVATE: u32 = 0x0002;
13 pub const PROTECTED: u32 = 0x0004;
15 pub const STATIC: u32 = 0x0008;
17 pub const FINAL: u32 = 0x0010;
19 pub const ABSTRACT: u32 = 0x0400;
21 pub const NATIVE: u32 = 0x0100;
23 pub const SYNCHRONIZED: u32 = 0x0020;
25 pub const STRICTFP: u32 = 0x0800;
27
28 pub fn is_static(&self) -> bool {
30 self.0 & Self::STATIC != 0
31 }
32}
33
34#[derive(Debug, Clone, PartialEq)]
36pub struct MethodSignature {
37 pub name: SharedString,
39 pub params: Vec<TypeId>,
41 pub return_type: TypeId,
43 pub throws: Vec<TypeId>,
45 pub modifiers: MethodModifiers,
47}
48
49impl MethodSignature {
50 pub fn new(
51 name: SharedString,
52 params: Vec<TypeId>,
53 return_type: TypeId,
54 modifiers: MethodModifiers,
55 ) -> Self {
56 Self {
57 name,
58 params,
59 return_type,
60 throws: Vec::new(),
61 modifiers,
62 }
63 }
64
65 pub fn with_throws(mut self, throws: Vec<TypeId>) -> Self {
66 self.throws = throws;
67 self
68 }
69}