Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Import Validation phase as the first step of compilation phases #1174

Open
afsalthaj opened this issue Dec 11, 2024 · 0 comments
Open
Assignees
Labels
Milestone

Comments

@afsalthaj
Copy link
Contributor

Here we make sure that, all of the imports are valid based on the component metadata that was passed into one of the stages of initial phase within the set of compilation phases. We also make sure to avoid duplicate imports

i.e

    pub fn infer_types_initial_phase(
        &mut self,
        function_type_registry: &FunctionTypeRegistry,
    ) -> Result<Scope, Vec<String>> {
        self.validate_imports();  // Here is where we add this validation
        self.bind_types();
        self.bind_variables_of_list_comprehension();
        self.bind_variables_of_list_reduce();

        .......
    }

Introduce a Scope struct such that initial_phase can return a Scope that's probably mutable. For now, it can be kept as simple as

struct Scope {
   functions: Vec<Functions>;

}

struct  Function {
  alias: Option<String>
  analysed_function: AnalysedExport
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant