LCOV - code coverage report
Current view: top level - as2js/lib - compiler_program.cpp (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 22 4.5 %
Date: 2014-08-10 Functions: 2 3 66.7 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* compiler_program.cpp -- written by Alexis WILKE for Made to Order Software Corp. (c) 2005-2014 */
       2             : 
       3             : /*
       4             : 
       5             : Copyright (c) 2005-2014 Made to Order Software Corp.
       6             : 
       7             : http://snapwebsites.org/project/as2js
       8             : 
       9             : Permission is hereby granted, free of charge, to any
      10             : person obtaining a copy of this software and
      11             : associated documentation files (the "Software"), to
      12             : deal in the Software without restriction, including
      13             : without limitation the rights to use, copy, modify,
      14             : merge, publish, distribute, sublicense, and/or sell
      15             : copies of the Software, and to permit persons to whom
      16             : the Software is furnished to do so, subject to the
      17             : following conditions:
      18             : 
      19             : The above copyright notice and this permission notice
      20             : shall be included in all copies or substantial
      21             : portions of the Software.
      22             : 
      23             : THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
      24             : ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
      25             : LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
      26             : FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
      27             : EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
      28             : LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
      29             : WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
      30             : ARISING FROM, OUT OF OR IN CONNECTION WITH THE
      31             : SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
      32             : SOFTWARE.
      33             : 
      34             : */
      35             : 
      36             : #include    "as2js/compiler.h"
      37             : 
      38             : #include    "as2js/message.h"
      39             : 
      40             : 
      41             : namespace as2js
      42             : {
      43             : 
      44             : 
      45             : /**********************************************************************/
      46             : /**********************************************************************/
      47             : /***  PROGRAM  ********************************************************/
      48             : /**********************************************************************/
      49             : /**********************************************************************/
      50             : 
      51             : 
      52             : 
      53           0 : void Compiler::program(Node::pointer_t program_node)
      54             : {
      55             :     // This is the root. Whenever you search to resolve a reference,
      56             :     // don't go past that node! What's in the parent of a program is
      57             :     // not part of that program...
      58           0 :     f_program = program_node;
      59             : 
      60             : #if 0
      61             : std::cerr << program_node;
      62             : #endif
      63             :     // get rid of any declaration marked false
      64           0 :     size_t const org_max(program_node->get_children_size());
      65           0 :     for(size_t idx(0); idx < org_max; ++idx)
      66             :     {
      67           0 :         Node::pointer_t child(program_node->get_child(idx));
      68           0 :         if(get_attribute(child, Node::attribute_t::NODE_ATTR_FALSE))
      69             :         {
      70           0 :             child->to_unknown();
      71             :         }
      72           0 :     }
      73           0 :     program_node->clean_tree();
      74             : 
      75           0 :     NodeLock ln(program_node);
      76             : 
      77             :     // look for all the labels in this program (for goto's)
      78           0 :     for(size_t idx(0); idx < org_max; ++idx)
      79             :     {
      80           0 :         Node::pointer_t child(program_node->get_child(idx));
      81           0 :         if(child->get_type() == Node::node_t::NODE_DIRECTIVE_LIST)
      82             :         {
      83           0 :             find_labels(program_node, child);
      84             :         }
      85           0 :     }
      86             : 
      87             :     // a program is composed of directives (usually just one list)
      88             :     // which we want to compile
      89           0 :     for(size_t idx(0); idx < org_max; ++idx)
      90             :     {
      91           0 :         Node::pointer_t child(program_node->get_child(idx));
      92           0 :         if(child->get_type() == Node::node_t::NODE_DIRECTIVE_LIST)
      93             :         {
      94           0 :             directive_list(child);
      95             :         }
      96           0 :     }
      97             : 
      98             : #if 0
      99             : if(Message::error_count() > 0)
     100             : std::cerr << program_node;
     101             : #endif
     102           0 : }
     103             : 
     104             : 
     105             : 
     106             : 
     107             : 
     108             : 
     109             : 
     110          20 : }
     111             : // namespace as2js
     112             : 
     113             : // vim: ts=4 sw=4 et

Generated by: LCOV version 1.9