Changes in src/AST/Decl.cpp [7edd5c1:b230091]
- File:
-
- 1 edited
-
src/AST/Decl.cpp (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r7edd5c1 rb230091 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Andrew Beach12 // Last Modified On : T hu May 5 12:10:00 202213 // Update Count : 2 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jan 12 16:54:55 2021 13 // Update Count : 23 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;102 76 } 103 77 … … 162 136 163 137 auto it = enumValues.find( enumerator->name ); 164 165 138 if ( it != enumValues.end() ) { 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 139 value = it->second; 192 140 return true; 193 141 }
Note:
See TracChangeset
for help on using the changeset viewer.