Пример #1
0
 // Semantic resolution
 public override void ResolveStatement(ISemanticResolver s)
 {
     MethodExpEntry m = s.GetCurrentMethod();
     if (m_exp != null) 
     {
         Exp.ResolveExpAsRight(ref m_exp, s);
     
         // Ensure that expression we're returning matches the method's
         // return type            
         //s.EnsureDerivedType(m.RetType, m_exp);
         s.EnsureAssignable(m_exp, m.RetType.CLRType);
     } 
     else 
     {
         // If we're not returning an expression, then our return type should be void
         if (m.RetType.CLRType != typeof(void))
         {
             ThrowError(SymbolError.NoReturnTypeExpected(this));
             /*
             s.ThrowError(SemanticChecker.Code.cNoReturnTypeExpected,
                 this.Location, 
                 "Functions with void return type can't return an expression"
                 );
             */
         }        
     }
 }