From a6655b320c5d95b251d8b94f16bb50231c606733 Mon Sep 17 00:00:00 2001 From: Jon Meow <46229924+jonmeow@users.noreply.github.com> Date: Mon, 16 Aug 2021 16:38:09 -0700 Subject: [PATCH] Clean up Declaration/TypeCheck dependency (#753) Looks more like a mistake/legacy than deliberate --- executable_semantics/ast/BUILD | 2 -- executable_semantics/ast/declaration.h | 14 -------------- executable_semantics/interpreter/typecheck.h | 7 +++++++ 3 files changed, 7 insertions(+), 16 deletions(-) diff --git a/executable_semantics/ast/BUILD b/executable_semantics/ast/BUILD index a7e24a4c179e..45558f5f6320 100644 --- a/executable_semantics/ast/BUILD +++ b/executable_semantics/ast/BUILD @@ -19,8 +19,6 @@ cc_library( ":pattern", ":struct_definition", "//common:ostream", - "//executable_semantics/interpreter:address", - "//executable_semantics/interpreter:containers", "@llvm-project//llvm:Support", ], ) diff --git a/executable_semantics/ast/declaration.h b/executable_semantics/ast/declaration.h index 29e01781c5c8..6f2162afa8bd 100644 --- a/executable_semantics/ast/declaration.h +++ b/executable_semantics/ast/declaration.h @@ -13,24 +13,10 @@ #include "executable_semantics/ast/member.h" #include "executable_semantics/ast/pattern.h" #include "executable_semantics/ast/struct_definition.h" -#include "executable_semantics/interpreter/address.h" -#include "executable_semantics/interpreter/dictionary.h" #include "llvm/Support/Compiler.h" namespace Carbon { -class Value; - -using TypeEnv = Dictionary; -using Env = Dictionary; - -struct TypeCheckContext { - // Symbol table mapping names of runtime entities to their type. - TypeEnv types; - // Symbol table mapping names of compile time entities to their value. - Env values; -}; - // Abstract base class of all AST nodes representing patterns. // // Declaration and its derived classes support LLVM-style RTTI, including diff --git a/executable_semantics/interpreter/typecheck.h b/executable_semantics/interpreter/typecheck.h index acb9acb4bd9a..b9565c618400 100644 --- a/executable_semantics/interpreter/typecheck.h +++ b/executable_semantics/interpreter/typecheck.h @@ -39,6 +39,13 @@ struct TCStatement { TypeEnv types; }; +struct TypeCheckContext { + // Symbol table mapping names of runtime entities to their type. + TypeEnv types; + // Symbol table mapping names of compile time entities to their value. + Env values; +}; + auto TypeCheckExp(const Expression* e, TypeEnv types, Env values) -> TCExpression; auto TypeCheckPattern(const Pattern* p, TypeEnv types, Env values,