Skip to content
Snippets Groups Projects
Select Git revision
  • bc28246bb2a44a3291ffb2440a6395fef07cd151
  • master default protected
  • github/fork/hrani/master
  • github/fork/dilawar/master
  • chamcham
  • chhennapoda
  • wheel
  • 3.2.0-pre0
  • v3.1.3
  • 3.1.2
  • 3.1.1
  • chamcham-3.1.1
  • 3.1.0
  • ghevar_3.0.2_pre2
  • ghevar_3.0.2
15 results

NonlinearSystem.h

Blame
  • astmanip.hpp 1.21 KiB
    #pragma once
    
    // Helper utilities for manipulating/modifying AST.
    
    #include <string>
    
    #include "expression.hpp"
    #include "location.hpp"
    #include "scope.hpp"
    
    // Create new local variable symbol and local declaration expression in current scope.
    // Returns the local declaration expression.
    
    struct local_declaration {
        expression_ptr local_decl;
        expression_ptr id;
        scope_ptr scope;
    };
    
    local_declaration make_unique_local_decl(
        scope_ptr scope,
        Location loc,
        std::string const& prefix="ll");
    
    // Create a local declaration as for `make_unique_local_decl`, together with an
    // assignment to it from the given expression, using the location of that expression.
    // Returns local declaration expression, assignment expression, new identifier id and
    // consequent scope.
    
    struct local_assignment {
        expression_ptr local_decl;
        expression_ptr assignment;
        expression_ptr id;
        scope_ptr scope;
    };
    
    local_assignment make_unique_local_assign(
        scope_ptr scope,
        Expression* e,
        std::string const& prefix="ll");
    
    inline local_assignment make_unique_local_assign(
        scope_ptr scope,
        expression_ptr& e,
        std::string const& prefix="ll")
    {
        return make_unique_local_assign(scope, e.get(), prefix);
    }