Changeset 422 in dev for trunk/abdev/BasicCompiler_Common/src/Delegate.cpp
- Timestamp:
- Mar 8, 2008, 10:38:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/Delegate.cpp
r339 r422 3 3 #include <Delegate.h> 4 4 5 Delegate::Delegate( const NamespaceScopes &namespaceScopes, const std::string &name, Procedure::Kind procKind, const char *paramStr, const Type &returnType, int nowLine)6 : Procedure( namespaceScopes, name, procKind, false ) 7 { 8 this->returnType = returnType;9 params.Analyze( paramStr, nowLine ); 10 5 void Delegate::RefleshParameterAndReturnType() 6 { 7 // パラメータを解析 8 params.Analyze( paramStr.c_str(), sourceIndex ); 9 10 // 動的パラメータを作る 11 11 dynamicParams = params; 12 12 dynamicParams.insert( dynamicParams.begin(), new Parameter( "_System_LocalThis", Type( DEF_PTR_VOID ) ) ); 13 14 if( IsFunction() ) 15 { 16 // 戻り値を取得 17 if( !compiler.StringToType( returnTypeName, returnType ) ) 18 { 19 SetError(3,returnTypeName,sourceIndex); 20 } 21 } 13 22 } 14 23 … … 93 102 GetIdentifierToken( name, source.GetBuffer(), i ); 94 103 104 if( source[i] != '(' ) 105 { 106 SetError(1,NULL,nowLine); 107 continue; 108 } 109 110 // パラメータ文字列 95 111 char paramStr[8192]; 96 i += GetStringInPare( paramStr, source.GetBuffer() + i );97 98 // 戻り値 99 Type returnType;112 i += GetStringInPare( paramStr, source.GetBuffer() + i, true ); 113 114 // 戻り値の型の文字列 115 char returnTypeName[VN_SIZE] = ""; 100 116 if( source[i] == 1 && source[i+1] == ESC_AS ) 101 117 { 102 118 i += 2; 103 char typeName[VN_SIZE]; 104 GetCommandToken( typeName, source.GetBuffer(), i ); 105 compiler.StringToType( typeName, returnType ); 106 } 107 108 this->Put( new Delegate( namespaceScopes, name, procKind, paramStr, returnType, nowLine ) ); 119 GetCommandToken( returnTypeName, source.GetBuffer(), i ); 120 121 if( procKind != Procedure::Function ) 122 { 123 SetError(38,name,nowLine); 124 } 125 } 126 else 127 { 128 if( procKind == Procedure::Function ) 129 { 130 SetError(-104,name,nowLine); 131 lstrcpy( returnTypeName, "Double" ); 132 } 133 } 134 135 this->Put( new Delegate( namespaceScopes, name, procKind, paramStr, returnTypeName, nowLine ) ); 109 136 } 110 137 } … … 156 183 values.insert( std::map<std::string,std::string>::value_type( "#name#", dg.GetName() ) ); 157 184 158 std::string paramsStr = dg.Params().GetString();159 160 185 if( dg.IsFunction() ) 161 186 { 162 187 values.insert( std::map<std::string,std::string>::value_type( 163 188 "#call_method_begin#", 164 (string)"Function Call(" + paramsStr + ") As " + compiler.TypeToString( dg.ReturnType() )189 (string)"Function Call(" + dg.paramStr + ") As " + dg.returnTypeName 165 190 ) ); 166 191 … … 176 201 values.insert( std::map<std::string,std::string>::value_type( 177 202 "#call_method_begin#", 178 (string)"Sub Call(" + paramsStr + ")"203 (string)"Sub Call(" + dg.paramStr + ")" 179 204 ) ); 180 205 … … 187 212 } 188 213 189 values.insert( std::map<std::string,std::string>::value_type( "#params#", paramsStr ) );214 values.insert( std::map<std::string,std::string>::value_type( "#params#", dg.paramStr ) ); 190 215 191 216 destSource += sourceTemplate.GetResult( values ); … … 197 222 */ 198 223 } 224 225 void Delegates::RefleshParameterAndReturnType() 226 { 227 this->Iterator_Reset(); 228 while( this->Iterator_HasNext() ) 229 { 230 Delegate &dg = *this->Iterator_GetNext(); 231 dg.RefleshParameterAndReturnType(); 232 } 233 }
Note:
See TracChangeset
for help on using the changeset viewer.