ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | 
            Last change
 on this file since 1b5c81ed was             843054c2, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago           | 
        
        
          | 
             
licencing: seventh groups of files 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Line |   | 
|---|
| 1 | From the refrat (5.5) we have our specification:
 | 
|---|
| 2 | 
 | 
|---|
| 3 |     \section{Initialization} An expression that is used as an
 | 
|---|
| 4 |     \nonterm{initializer} is treated as being cast to the type of the
 | 
|---|
| 5 |     object being initialized.  An expression used in an
 | 
|---|
| 6 |     \nonterm{initializer-list} is treated as being cast to the type of
 | 
|---|
| 7 |     the aggregate member that it initializes.  In either case the cast
 | 
|---|
| 8 |     must have a single unambiguous
 | 
|---|
| 9 |     interpretation\index{interpretations}.
 | 
|---|
| 10 | 
 | 
|---|
| 11 | Steps:
 | 
|---|
| 12 | 
 | 
|---|
| 13 | - add a member function "void Resolver::visit( SynTree::DeclStmt
 | 
|---|
| 14 | *declStmt )"; for each DeclStmt:
 | 
|---|
| 15 | 
 | 
|---|
| 16 | - do what you need to do to establish correspondences between
 | 
|---|
| 17 | expressions in the initializer and pieces of the object to be
 | 
|---|
| 18 | initialized
 | 
|---|
| 19 | 
 | 
|---|
| 20 | - for each initializer expression, construct a cast expression that
 | 
|---|
| 21 | casts the value of the expression to the type of the corresponding
 | 
|---|
| 22 | sub-object
 | 
|---|
| 23 | 
 | 
|---|
| 24 | - invoke the resolver recursively on each cast expression; it's an invariant
 | 
|---|
| 25 | of the resolver that attempting to resolve a cast expression results either
 | 
|---|
| 26 | in a single resolved expression (corresponding to the unambiguous interpretation
 | 
|---|
| 27 | referred to above) or a thrown SemanticError.
 | 
|---|
| 28 | 
 | 
|---|
| 29 | - construct a new initializer from the resolved expressions
 | 
|---|
| 30 | 
 | 
|---|
| 31 | You'll undoubtedly have to play with the CodeGen stuff a bit; I
 | 
|---|
| 32 | hacked it to spit out unresolved initializers for file-scope
 | 
|---|
| 33 | declarations so that real programs would compile.  You'll want to make
 | 
|---|
| 34 | sure that resolved initializers for all declarations are being
 | 
|---|
| 35 | generated.
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.