Skip to content

Commit 5a0dfa1

Browse files
committed
Get rid of parser-level type inferencer
1 parent aeec049 commit 5a0dfa1

File tree

4 files changed

+1
-110
lines changed

4 files changed

+1
-110
lines changed

src/ast/mod.rs

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ use std::collections::HashSet;
2121
pub mod types;
2222
use types::Type;
2323

24-
/// Table that contains all symbol and its types
25-
pub type SymbolTable = HashMap<String, Option<Type>>;
26-
2724
#[derive(Debug, Clone)]
2825
pub struct Module {
2926
pub path: String,
@@ -39,16 +36,6 @@ impl Module {
3936
self.structs.append(&mut other.structs);
4037
self.globals.append(&mut other.globals)
4138
}
42-
43-
pub fn get_symbol_table(&self) -> SymbolTable {
44-
let mut table = SymbolTable::new();
45-
46-
for func in self.func.clone() {
47-
table.insert(func.name, func.ret_type);
48-
}
49-
50-
table
51-
}
5239
}
5340

5441
#[derive(Debug, Clone)]

src/parser/infer.rs

Lines changed: 0 additions & 90 deletions
This file was deleted.

src/parser/mod.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
* See the License for the specific language governing permissions and
1414
* limitations under the License.
1515
*/
16-
mod infer;
1716
// TODO: Resolve this lint by renaming the module
1817
#[allow(clippy::module_inception)]
1918
mod parser;

src/parser/parser.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ use crate::ast::*;
1717
use crate::lexer::Keyword;
1818
use crate::lexer::Position;
1919
use crate::lexer::{Token, TokenKind};
20-
use crate::parser::infer::infer;
2120
use crate::util::string_util::highlight_position_in_file;
2221
use std::convert::TryFrom;
2322
use std::iter::Peekable;
@@ -50,11 +49,7 @@ impl Parser {
5049
}
5150

5251
pub fn parse(&mut self) -> Result<Module, String> {
53-
let mut program = self.parse_module()?;
54-
// infer types
55-
infer(&mut program);
56-
57-
Ok(program)
52+
self.parse_module()
5853
}
5954

6055
pub(super) fn next(&mut self) -> Result<Token, String> {

0 commit comments

Comments
 (0)