| [a32b204] | 1 | //
 | 
|---|
 | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
 | 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
 | 6 | //
 | 
|---|
| [db4ecc5] | 7 | // Resolver.h --
 | 
|---|
| [a32b204] | 8 | //
 | 
|---|
 | 9 | // Author           : Richard C. Bilson
 | 
|---|
 | 10 | // Created On       : Sun May 17 12:18:34 2015
 | 
|---|
| [6b0b624] | 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| [5170d95] | 12 | // Last Modified On : Mon Feb 18 20:40:38 2019
 | 
|---|
 | 13 | // Update Count     : 4
 | 
|---|
| [a32b204] | 14 | //
 | 
|---|
 | 15 | 
 | 
|---|
| [6b0b624] | 16 | #pragma once
 | 
|---|
| [51b73452] | 17 | 
 | 
|---|
| [d76c588] | 18 | #include <list>          // for list
 | 
|---|
| [4b7cce6] | 19 | 
 | 
|---|
 | 20 | #include "AST/Node.hpp"  // for ptr
 | 
|---|
| [ea6332d] | 21 | 
 | 
|---|
 | 22 | class ConstructorInit;
 | 
|---|
 | 23 | class Declaration;
 | 
|---|
 | 24 | class Expression;
 | 
|---|
 | 25 | class StmtExpr;
 | 
|---|
 | 26 | namespace SymTab {
 | 
|---|
| [d76c588] | 27 |         class Indexer;
 | 
|---|
 | 28 | } // namespace SymTab
 | 
|---|
 | 29 | 
 | 
|---|
 | 30 | namespace ast {
 | 
|---|
| [234b1cb] | 31 |         class ConstructorInit;
 | 
|---|
| [d76c588] | 32 |         class Decl;
 | 
|---|
| [d57e349] | 33 |         class DeletedExpr;
 | 
|---|
| [234b1cb] | 34 |         class Init;
 | 
|---|
| [17a0ede2] | 35 |         class StmtExpr;
 | 
|---|
| [4b7cce6] | 36 |         class SymbolTable;
 | 
|---|
| [b2e0df3] | 37 |         struct TranslationUnit;
 | 
|---|
| [18e683b] | 38 |         class Type;
 | 
|---|
| [4b7cce6] | 39 |         class TypeEnvironment;
 | 
|---|
| [d76c588] | 40 | } // namespace ast
 | 
|---|
| [51b73452] | 41 | 
 | 
|---|
 | 42 | namespace ResolvExpr {
 | 
|---|
| [82dd287] | 43 |         /// Checks types and binds syntactic constructs to typed representations
 | 
|---|
| [a32b204] | 44 |         void resolve( std::list< Declaration * > translationUnit );
 | 
|---|
| [5170d95] | 45 |         void resolveDecl( Declaration *, const SymTab::Indexer & indexer );
 | 
|---|
 | 46 |         Expression *resolveInVoidContext( Expression * expr, const SymTab::Indexer & indexer );
 | 
|---|
 | 47 |         void findVoidExpression( Expression *& untyped, const SymTab::Indexer & indexer );
 | 
|---|
 | 48 |         void findSingleExpression( Expression *& untyped, const SymTab::Indexer & indexer );
 | 
|---|
 | 49 |         void findSingleExpression( Expression *& untyped, Type * type, const SymTab::Indexer & indexer );
 | 
|---|
| [1d2b64f] | 50 |         void resolveCtorInit( ConstructorInit * ctorInit, const SymTab::Indexer & indexer );
 | 
|---|
 | 51 |         void resolveStmtExpr( StmtExpr * stmtExpr, const SymTab::Indexer & indexer );
 | 
|---|
| [630bcb5] | 52 |         /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
 | 
|---|
 | 53 |         DeletedExpr * findDeletedExpr( Expression * expr );
 | 
|---|
| [2a6292d] | 54 |         /// Resolves with-stmts and with-clauses on functions
 | 
|---|
 | 55 |         void resolveWithExprs( std::list< Declaration * > & translationUnit );
 | 
|---|
| [d76c588] | 56 | 
 | 
|---|
 | 57 |         /// Checks types and binds syntactic constructs to typed representations
 | 
|---|
| [293dc1c] | 58 |         void resolve( ast::TranslationUnit& translationUnit );
 | 
|---|
| [d57e349] | 59 |         /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
 | 
|---|
 | 60 |         const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr );
 | 
|---|
| [4b7cce6] | 61 |         /// Find the expression candidate that is the unique best match for `untyped` in a `void`
 | 
|---|
 | 62 |         /// context.
 | 
|---|
 | 63 |         ast::ptr< ast::Expr > resolveInVoidContext(
 | 
|---|
 | 64 |                 const ast::Expr * expr, const ast::SymbolTable & symtab, ast::TypeEnvironment & env );
 | 
|---|
| [b2e0df3] | 65 |         /// Resolve `untyped` to the single expression whose candidate is the best match for the
 | 
|---|
| [18e683b] | 66 |         /// given type.
 | 
|---|
 | 67 |         ast::ptr< ast::Expr > findSingleExpression(
 | 
|---|
 | 68 |                 const ast::Expr * untyped, const ast::Type * type, const ast::SymbolTable & symtab );
 | 
|---|
| [490fb92e] | 69 |         ast::ptr< ast::Expr > findVoidExpression(
 | 
|---|
 | 70 |                 const ast::Expr * untyped, const ast::SymbolTable & symtab);
 | 
|---|
| [234b1cb] | 71 |         /// Resolves a constructor init expression
 | 
|---|
| [293dc1c] | 72 |         ast::ptr< ast::Init > resolveCtorInit(
 | 
|---|
| [234b1cb] | 73 |                 const ast::ConstructorInit * ctorInit, const ast::SymbolTable & symtab );
 | 
|---|
| [302ef2a] | 74 |         /// Resolves a statement expression 
 | 
|---|
 | 75 |         const ast::Expr * resolveStmtExpr(
 | 
|---|
| [17a0ede2] | 76 |                 const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab );
 | 
|---|
| [51b73452] | 77 | } // namespace ResolvExpr
 | 
|---|
 | 78 | 
 | 
|---|
| [a32b204] | 79 | // Local Variables: //
 | 
|---|
 | 80 | // tab-width: 4 //
 | 
|---|
 | 81 | // mode: c++ //
 | 
|---|
 | 82 | // compile-command: "make install" //
 | 
|---|
 | 83 | // End: //
 | 
|---|