Changes in src/AST/Decl.cpp [b230091:7edd5c1]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
rb230091 r7edd5c1 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T ue Jan 12 16:54:55 202113 // Update Count : 2 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu May 5 12:10:00 2022 13 // Update Count : 24 14 14 // 15 15 … … 53 53 // --- FunctionDecl 54 54 55 FunctionDecl::FunctionDecl( const CodeLocation & loc, const std::string & name, 55 FunctionDecl::FunctionDecl( const CodeLocation & loc, const std::string & name, 56 56 std::vector<ptr<TypeDecl>>&& forall, 57 57 std::vector<ptr<DeclWithType>>&& params, std::vector<ptr<DeclWithType>>&& returns, … … 74 74 } 75 75 this->type = ftype; 76 } 77 78 FunctionDecl::FunctionDecl( const CodeLocation & location, const std::string & name, 79 std::vector<ptr<TypeDecl>>&& forall, std::vector<ptr<DeclWithType>>&& assertions, 80 std::vector<ptr<DeclWithType>>&& params, std::vector<ptr<DeclWithType>>&& returns, 81 CompoundStmt * stmts, Storage::Classes storage, Linkage::Spec linkage, 82 std::vector<ptr<Attribute>>&& attrs, Function::Specs fs, bool isVarArgs) 83 : DeclWithType( location, name, storage, linkage, std::move(attrs), fs ), 84 params( std::move(params) ), returns( std::move(returns) ), 85 type_params( std::move( forall) ), assertions( std::move( assertions ) ), 86 type( nullptr ), stmts( stmts ) { 87 FunctionType * type = new FunctionType( (isVarArgs) ? VariableArgs : FixedArgs ); 88 for ( auto & param : this->params ) { 89 type->params.emplace_back( param->get_type() ); 90 } 91 for ( auto & ret : this->returns ) { 92 type->returns.emplace_back( ret->get_type() ); 93 } 94 for ( auto & param : this->type_params ) { 95 type->forall.emplace_back( new TypeInstType( param ) ); 96 } 97 for ( auto & assertion : this->assertions ) { 98 type->assertions.emplace_back( 99 new VariableExpr( assertion->location, assertion ) ); 100 } 101 this->type = type; 76 102 } 77 103 … … 136 162 137 163 auto it = enumValues.find( enumerator->name ); 164 138 165 if ( it != enumValues.end() ) { 139 value = it->second; 166 167 // Handle typed enum by casting the value in (C++) compiler 168 // if ( base ) { // A typed enum 169 // if ( const BasicType * bt = dynamic_cast<const BasicType *>(base) ) { 170 // switch( bt->kind ) { 171 // case BasicType::Kind::Bool: value = (bool) it->second; break; 172 // case BasicType::Kind::Char: value = (char) it->second; break; 173 // case BasicType::Kind::SignedChar: value = (signed char) it->second; break; 174 // case BasicType::Kind::UnsignedChar: value = (unsigned char) it->second; break; 175 // case BasicType::Kind::ShortSignedInt: value = (short signed int) it->second; break; 176 // case BasicType::Kind::SignedInt: value = (signed int) it->second; break; 177 // case BasicType::Kind::UnsignedInt: value = (unsigned int) it->second; break; 178 // case BasicType::Kind::LongSignedInt: value = (long signed int) it->second; break; 179 // case BasicType::Kind::LongUnsignedInt: value = (long unsigned int) it->second; break; 180 // case BasicType::Kind::LongLongSignedInt: value = (long long signed int) it->second; break; 181 // case BasicType::Kind::LongLongUnsignedInt: value = (long long unsigned int) it->second; break; 182 // // TODO: value should be able to handle long long unsigned int 183 184 // default: 185 // value = it->second; 186 // } 187 // } 188 // } else { 189 value = it->second; 190 //} 191 140 192 return true; 141 193 }
Note: See TracChangeset
for help on using the changeset viewer.