Changeset d29fa5f
- Timestamp:
- Oct 2, 2017, 4:58:51 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- effdde0
- Parents:
- bf4b4cf
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
rbf4b4cf rd29fa5f 600 600 601 601 // add size/align for generic types to parameter list 602 if ( ! appExpr->get_function()-> has_result()) return;602 if ( ! appExpr->get_function()->result ) return; 603 603 FunctionType *funcType = getFunctionType( appExpr->get_function()->get_result() ); 604 604 assert( funcType ); … … 714 714 715 715 void Pass1::boxParam( Type *param, Expression *&arg, const TyVarMap &exprTyVars ) { 716 assertf( arg-> has_result(), "arg does not have result: %s", toString( arg ).c_str() );716 assertf( arg->result, "arg does not have result: %s", toString( arg ).c_str() ); 717 717 if ( isPolyType( param, exprTyVars ) ) { 718 718 Type * newType = arg->get_result()->clone(); … … 965 965 if ( varExpr->get_var()->get_linkage() == LinkageSpec::Intrinsic ) { 966 966 if ( varExpr->get_var()->get_name() == "?[?]" ) { 967 assert( appExpr-> has_result());967 assert( appExpr->result ); 968 968 assert( appExpr->get_args().size() == 2 ); 969 969 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env ); … … 999 999 } // if 1000 1000 } else if ( varExpr->get_var()->get_name() == "*?" ) { 1001 assert( appExpr-> has_result());1001 assert( appExpr->result ); 1002 1002 assert( ! appExpr->get_args().empty() ); 1003 1003 if ( isPolyType( appExpr->get_result(), scopeTyVars, env ) ) { … … 1016 1016 } // if 1017 1017 } else if ( varExpr->get_var()->get_name() == "?++" || varExpr->get_var()->get_name() == "?--" ) { 1018 assert( appExpr-> has_result());1018 assert( appExpr->result ); 1019 1019 assert( appExpr->get_args().size() == 1 ); 1020 1020 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) { … … 1036 1036 } // if 1037 1037 } else if ( varExpr->get_var()->get_name() == "++?" || varExpr->get_var()->get_name() == "--?" ) { 1038 assert( appExpr-> has_result());1038 assert( appExpr->result ); 1039 1039 assert( appExpr->get_args().size() == 1 ); 1040 1040 if ( Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ) ) { … … 1042 1042 } // if 1043 1043 } else if ( varExpr->get_var()->get_name() == "?+?" || varExpr->get_var()->get_name() == "?-?" ) { 1044 assert( appExpr-> has_result());1044 assert( appExpr->result ); 1045 1045 assert( appExpr->get_args().size() == 2 ); 1046 1046 Type *baseType1 = isPolyPtr( appExpr->get_args().front()->get_result(), scopeTyVars, env ); … … 1068 1068 } // if 1069 1069 } else if ( varExpr->get_var()->get_name() == "?+=?" || varExpr->get_var()->get_name() == "?-=?" ) { 1070 assert( appExpr-> has_result());1070 assert( appExpr->result ); 1071 1071 assert( appExpr->get_args().size() == 2 ); 1072 1072 Type *baseType = isPolyPtr( appExpr->get_result(), scopeTyVars, env ); … … 1162 1162 void Pass1::premutate( AddressExpr * ) { visit_children = false; } 1163 1163 Expression * Pass1::postmutate( AddressExpr * addrExpr ) { 1164 assert( addrExpr->get_arg()-> has_result()&& ! addrExpr->get_arg()->get_result()->isVoid() );1164 assert( addrExpr->get_arg()->result && ! addrExpr->get_arg()->get_result()->isVoid() ); 1165 1165 1166 1166 bool needs = false; 1167 1167 if ( UntypedExpr *expr = dynamic_cast< UntypedExpr *>( addrExpr->get_arg() ) ) { 1168 if ( expr-> has_result()&& isPolyType( expr->get_result(), scopeTyVars, env ) ) {1168 if ( expr->result && isPolyType( expr->get_result(), scopeTyVars, env ) ) { 1169 1169 if ( NameExpr *name = dynamic_cast< NameExpr *>( expr->get_function() ) ) { 1170 1170 if ( name->get_name() == "*?" ) { 1171 1171 if ( ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr->get_args().front() ) ) { 1172 assert( appExpr->get_function()-> has_result());1172 assert( appExpr->get_function()->result ); 1173 1173 FunctionType *function = getFunctionType( appExpr->get_function()->get_result() ); 1174 1174 assert( function ); -
src/GenPoly/Specialize.cc
rbf4b4cf rd29fa5f 147 147 148 148 Expression * Specialize::doSpecialization( Type *formalType, Expression *actual, InferredParams *inferParams ) { 149 assertf( actual-> has_result(), "attempting to specialize an untyped expression" );149 assertf( actual->result, "attempting to specialize an untyped expression" ); 150 150 if ( needsSpecialization( formalType, actual->get_result(), env ) ) { 151 151 if ( FunctionType *funType = getFunctionType( formalType ) ) { -
src/InitTweak/FixInit.cc
rbf4b4cf rd29fa5f 390 390 assert( env ); 391 391 CP_CTOR_PRINT( std::cerr << "Type Substitution: " << *env << std::endl; ) 392 assert( arg-> has_result());392 assert( arg->result ); 393 393 Type * result = arg->get_result(); 394 394 if ( skipCopyConstruct( result ) ) return; // skip certain non-copyable types … … 1125 1125 static UniqueName tempNamer( "_tmp_ctor_expr" ); 1126 1126 // xxx - is the size check necessary? 1127 assert( ctorExpr-> has_result()&& ctorExpr->get_result()->size() == 1 );1127 assert( ctorExpr->result && ctorExpr->get_result()->size() == 1 ); 1128 1128 1129 1129 // xxx - ideally we would reuse the temporary generated from the copy constructor passes from within firstArg if it exists and not generate a temporary if it's unnecessary. -
src/ResolvExpr/AlternativeFinder.cc
rbf4b4cf rd29fa5f 839 839 bool isLvalue( Expression *expr ) { 840 840 // xxx - recurse into tuples? 841 return expr-> has_result()&& ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) );841 return expr->result && ( expr->get_result()->get_lvalue() || dynamic_cast< ReferenceType * >( expr->get_result() ) ); 842 842 } 843 843 -
src/ResolvExpr/ResolveTypeof.cc
rbf4b4cf rd29fa5f 63 63 if ( typeofType->get_expr() ) { 64 64 Expression *newExpr = resolveInVoidContext( typeofType->get_expr(), indexer ); 65 assert( newExpr-> has_result()&& ! newExpr->get_result()->isVoid() );65 assert( newExpr->result && ! newExpr->get_result()->isVoid() ); 66 66 Type *newType = newExpr->get_result(); 67 67 newExpr->set_result( nullptr ); -
src/SynTree/AddressExpr.cc
rbf4b4cf rd29fa5f 33 33 Type * addrType( Type * type ) { 34 34 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) { 35 return new ReferenceType( refType->get_qualifiers(), addrType( refType-> get_base()) );35 return new ReferenceType( refType->get_qualifiers(), addrType( refType->base ) ); 36 36 } else { 37 37 return new PointerType( Type::Qualifiers(), type->clone() ); … … 41 41 42 42 AddressExpr::AddressExpr( Expression *arg ) : Expression(), arg( arg ) { 43 if ( arg-> has_result()) {44 if ( arg-> get_result()->get_lvalue() ) {43 if ( arg->result ) { 44 if ( arg->result->get_lvalue() ) { 45 45 // lvalue, retains all layers of reference and gains a pointer inside the references 46 set_result( addrType( arg-> get_result()) );46 set_result( addrType( arg->result ) ); 47 47 } else { 48 48 // taking address of non-lvalue -- must be a reference, loses one layer of reference 49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg-> get_result());50 set_result( addrType( refType-> get_base()) );49 ReferenceType * refType = strict_dynamic_cast< ReferenceType * >( arg->result ); 50 set_result( addrType( refType->base ) ); 51 51 } 52 52 // result of & is never an lvalue -
src/SynTree/ApplicationExpr.cc
rbf4b4cf rd29fa5f 55 55 set_result( ResolvExpr::extractResultType( function ) ); 56 56 57 assert( has_result());57 assert( result ); 58 58 } 59 59 -
src/SynTree/Expression.h
rbf4b4cf rd29fa5f 45 45 const Type * get_result() const { return result; } 46 46 void set_result( Type * newValue ) { result = newValue; } 47 bool has_result() const { return result != nullptr; }48 47 49 48 TypeSubstitution * get_env() const { return env; } -
src/Tuples/TupleAssignment.cc
rbf4b4cf rd29fa5f 84 84 bool isTuple( Expression *expr ) { 85 85 if ( ! expr ) return false; 86 assert( expr-> has_result());86 assert( expr->result ); 87 87 return dynamic_cast< TupleType * >( expr->get_result()->stripReferences() ); 88 88 } … … 238 238 239 239 ObjectDecl * TupleAssignSpotter::Matcher::newObject( UniqueName & namer, Expression * expr ) { 240 assert( expr-> has_result()&& ! expr->get_result()->isVoid() );240 assert( expr->result && ! expr->get_result()->isVoid() ); 241 241 ObjectDecl * ret = new ObjectDecl( namer.newName(), Type::StorageClasses(), LinkageSpec::Cforall, nullptr, expr->get_result()->clone(), new SingleInit( expr->clone() ) ); 242 242 // if expression type is a reference, don't need to construct anything, a simple initializer is sufficient.
Note: See TracChangeset
for help on using the changeset viewer.