[glsl-in] Cleanup public api

This commit is contained in:
João Capucho 2021-08-08 00:21:34 +01:00 committed by Dzmitry Malyshau
parent 1aaf77489b
commit 48a4a9b902
7 changed files with 31 additions and 23 deletions

View File

@ -39,7 +39,7 @@ impl Parser {
})
}
pub fn function_or_constructor_call(
pub(crate) fn function_or_constructor_call(
&mut self,
ctx: &mut Context,
body: &mut Block,
@ -1053,7 +1053,7 @@ impl Parser {
}
}
pub fn parse_relational_fun(
pub(crate) fn parse_relational_fun(
&mut self,
ctx: &mut Context,
body: &mut Block,
@ -1075,7 +1075,7 @@ impl Parser {
))
}
pub fn add_function(
pub(crate) fn add_function(
&mut self,
ctx: Context,
name: String,
@ -1149,7 +1149,7 @@ impl Parser {
});
}
pub fn add_prototype(
pub(crate) fn add_prototype(
&mut self,
ctx: Context,
name: String,
@ -1209,7 +1209,7 @@ impl Parser {
});
}
pub fn add_entry_point(
pub(crate) fn add_entry_point(
&mut self,
function: Handle<Function>,
mut global_init_body: Block,

View File

@ -1,6 +1,6 @@
pub use ast::Profile;
pub use error::{Error, ErrorKind};
pub use token::{SourceMetadata, Token};
pub use ast::{Precision, Profile};
pub use error::{Error, ErrorKind, ExpectedToken};
pub use token::{SourceMetadata, TokenValue};
use crate::{FastHashMap, FastHashSet, Handle, Module, ShaderStage, Type};
use ast::{EntryArg, FunctionDeclaration, GlobalLookup};

View File

@ -7,10 +7,10 @@ use crate::{
context::Context,
error::ExpectedToken,
offset,
token::TokenValue,
token::{Token, TokenValue},
types::scalar_components,
variables::{GlobalOrConstant, VarDeclaration},
Error, ErrorKind, Parser, SourceMetadata, Token,
Error, ErrorKind, Parser, SourceMetadata,
},
Block, Expression, FunctionResult, Handle, ScalarKind, Statement, StorageClass, StructMember,
Type, TypeInner,

View File

@ -1,7 +1,11 @@
use crate::{
front::glsl::{
ast::ParameterQualifier, context::Context, parser::ParsingContext, token::TokenValue,
variables::VarDeclaration, Error, ErrorKind, Parser, Result, Token,
ast::ParameterQualifier,
context::Context,
parser::ParsingContext,
token::{Token, TokenValue},
variables::VarDeclaration,
Error, ErrorKind, Parser, Result,
},
Block, ConstantInner, Expression, ScalarValue, Statement, SwitchCase, UnaryOperator,
};

View File

@ -16,14 +16,14 @@ pub struct SourceMetadata {
}
impl SourceMetadata {
pub fn union(&self, other: &Self) -> Self {
pub(crate) fn union(&self, other: &Self) -> Self {
SourceMetadata {
start: self.start.min(other.start),
end: self.end.max(other.end),
}
}
pub fn none() -> Self {
pub(crate) fn none() -> Self {
SourceMetadata::default()
}
}

View File

@ -181,7 +181,7 @@ pub fn type_power(kind: ScalarKind) -> Option<u32> {
}
impl Parser {
pub fn typifier_grow(
pub(crate) fn typifier_grow(
&self,
ctx: &mut Context,
handle: Handle<Expression>,
@ -204,7 +204,7 @@ impl Parser {
})
}
pub fn resolve_type<'b>(
pub(crate) fn resolve_type<'b>(
&'b self,
ctx: &'b mut Context,
handle: Handle<Expression>,
@ -215,7 +215,7 @@ impl Parser {
}
/// Invalidates the cached type resolution for `handle` forcing a recomputation
pub fn invalidate_expression<'b>(
pub(crate) fn invalidate_expression<'b>(
&'b self,
ctx: &'b mut Context,
handle: Handle<Expression>,
@ -238,7 +238,7 @@ impl Parser {
})
}
pub fn solve_constant(
pub(crate) fn solve_constant(
&mut self,
ctx: &Context,
root: Handle<Expression>,
@ -256,7 +256,11 @@ impl Parser {
})
}
pub fn maybe_array(&mut self, base: Handle<Type>, size: Option<ArraySize>) -> Handle<Type> {
pub(crate) fn maybe_array(
&mut self,
base: Handle<Type>,
size: Option<ArraySize>,
) -> Handle<Type> {
size.map(|size| {
self.module.types.fetch_or_append(Type {
name: None,

View File

@ -37,7 +37,7 @@ pub enum GlobalOrConstant {
}
impl Parser {
pub fn lookup_variable(
pub(crate) fn lookup_variable(
&mut self,
ctx: &mut Context,
body: &mut Block,
@ -174,7 +174,7 @@ impl Parser {
}
}
pub fn field_selection(
pub(crate) fn field_selection(
&mut self,
ctx: &mut Context,
lhs: bool,
@ -329,7 +329,7 @@ impl Parser {
}
}
pub fn add_global_var(
pub(crate) fn add_global_var(
&mut self,
ctx: &mut Context,
body: &mut Block,
@ -573,7 +573,7 @@ impl Parser {
Ok(GlobalOrConstant::Global(handle))
}
pub fn add_local_var(
pub(crate) fn add_local_var(
&mut self,
ctx: &mut Context,
body: &mut Block,