Changeset 628 in dev
- Timestamp:
- May 29, 2008, 1:36:02 AM (16 years ago)
- Location:
- trunk/ab5.0/abdev
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/VariableOpe.cpp
r603 r628 849 849 } 850 850 851 if( !compiler.StringToType( temporary, type ) ){ 852 compiler.errorMessenger.Output(3,temporary,cp); 851 ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType result = compiler.StringToTypeEx( temporary, type, true ); 852 if( result != ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful ) 853 { 854 if( result == ActiveBasic::Compiler::Error::StringToTypeErrorCode::FailedResolveGenericType ) 855 { 856 compiler.errorMessenger.Output(143,temporary,cp); 857 } 858 else 859 { 860 compiler.errorMessenger.Output(3,temporary,cp); 861 } 853 862 return false; 854 863 } -
trunk/ab5.0/abdev/BasicCompiler_Common/include/Compiler.h
r622 r628 184 184 185 185 186 ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics = false ); 186 187 bool StringToType( const std::string &typeName, Type &type ); 187 188 const std::string TypeToString( const Type &type ); -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Compiler.cpp
r603 r628 14 14 } 15 15 16 bool Compiler::StringToType( const std::string &typeName, Type &type ){ 16 ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType Compiler::StringToTypeEx( const std::string &typeName, Type &type, bool isResolveGenerics ) 17 { 17 18 type.SetIndex( -1 ); 18 19 … … 35 36 if( !pGenericClass ) 36 37 { 37 return false;38 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundGenericClass; 38 39 } 39 40 … … 70 71 type.SetActualGenericTypes( genericTypes ); 71 72 72 return true;73 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 73 74 } 74 75 … … 102 103 type.SetBasicType( DEF_PTR_PROC ); 103 104 type.SetIndex( this->GetObjectModule().meta.GetProcPointers().size() - 1 ); 104 return true;105 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 105 106 } 106 107 107 108 const std::string &nextTypeName = typeName.substr( 1 ); 108 109 109 if( !StringToType( nextTypeName, type ) ){ 110 return false; 110 ActiveBasic::Compiler::Error::StringToTypeErrorCode::EnumType result = StringToTypeEx( nextTypeName, type, isResolveGenerics ); 111 if( result != ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful ) 112 { 113 return result; 111 114 } 112 115 113 116 type.PtrLevelUp(); 114 117 115 return true;118 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 116 119 } 117 120 118 121 { 119 122 int basicType; 120 if( Type::StringToBasicType( typeName, basicType ) ){ 123 if( Type::StringToBasicType( typeName, basicType ) ) 124 { 121 125 // 基本型だったとき 122 126 type.SetBasicType( basicType ); 123 return true;127 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 124 128 } 125 129 } 126 130 127 131 // Object型だったとき 128 if( typeName == "Object" ){ 132 if( typeName == "Object" ) 133 { 129 134 type.SetType( DEF_OBJECT, this->GetObjectModule().meta.GetClasses().GetObjectClassPtr() ); 130 return true;135 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 131 136 } 132 137 133 138 // String型だったとき 134 if( typeName == "String" ){ 139 if( typeName == "String" ) 140 { 135 141 type.SetType( DEF_OBJECT, this->GetObjectModule().meta.GetClasses().GetStringClassPtr() ); 136 return true;142 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 137 143 } 138 144 … … 142 148 //////////////////// 143 149 int i=this->GetObjectModule().meta.GetTypeDefs().GetIndex( LexicalAnalyzer::FullNameToSymbol( typeName ) ); 144 if(i!=-1){ 150 if(i!=-1) 151 { 145 152 type = this->GetObjectModule().meta.GetTypeDefs()[i].GetBaseType(); 146 return true;153 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 147 154 } 148 155 149 156 //クラス 150 157 const CClass *pobj_c = this->GetObjectModule().meta.GetClasses().FindEx( LexicalAnalyzer::FullNameToSymbol( typeName ) ); 151 if(pobj_c){ 152 if( pobj_c->IsStructure() ){ 158 if(pobj_c) 159 { 160 if( isResolveGenerics ) 161 { 162 if( pobj_c->IsGeneric() ) 163 { 164 // ジェネリッククラスの場合 165 trace( "型解決されていない" ); 166 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::FailedResolveGenericType; 167 } 168 } 169 170 if( pobj_c->IsStructure() ) 171 { 153 172 type.SetBasicType( DEF_STRUCT ); 154 173 } 155 else{ 174 else 175 { 156 176 type.SetBasicType( DEF_OBJECT ); 157 177 } 158 178 type.SetClassPtr( pobj_c ); 159 return true;179 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 160 180 } 161 181 … … 176 196 type.SetFormalTypeName( typeName ); 177 197 type.SetFormalTypeIndex( formalTypeIndex ); 178 return true;198 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful; 179 199 } 180 200 } … … 183 203 ///////////////////////////////////////////////////////// 184 204 185 return false; 205 return ActiveBasic::Compiler::Error::StringToTypeErrorCode::NotfoundType; 206 } 207 208 bool Compiler::StringToType( const std::string &typeName, Type &type ) 209 { 210 return ( StringToTypeEx( typeName, type, false ) == ActiveBasic::Compiler::Error::StringToTypeErrorCode::Successful ); 186 211 } 187 212 -
trunk/ab5.0/abdev/BasicCompiler_Common/src/Messenger.cpp
r587 r628 76 76 for( int i3=0; ; i3++ ) 77 77 { 78 if( !IsVariableChar( tempKeyWord[i3] ) || tempKeyWord[i3] == '.')78 if( !IsVariableChar( tempKeyWord[i3] ) ) 79 79 { 80 80 temporary[i3] = 0; … … 249 249 if(errorCode==141) lstrcpy(msg,"Blittable修飾子をクラス以外の型に指定することはできません。"); 250 250 if(errorCode==142) lstrcpy(msg,"不正なThis参照です。"); 251 if(errorCode==143) sprintf(msg,"\"%s\" ジェネリクス型に型パラメータが指定されていません。",tempKeyWord); 251 252 252 253 //Enum関連 -
trunk/ab5.0/abdev/compiler_x64/compiler_x64.vcproj
r627 r628 326 326 </File> 327 327 <File 328 RelativePath="..\BasicCompiler_Common\include\ErrorCode.h" 329 > 330 </File> 331 <File 328 332 RelativePath="..\BasicCompiler_Common\include\LexicalAnalyzer.h" 329 333 > -
trunk/ab5.0/abdev/compiler_x64/stdafx.h
r603 r628 48 48 #include <CodeGenerator.h> 49 49 #include <Messenger.h> 50 #include <ErrorCode.h> 50 51 #include <Linker.h> 51 52 #include <Compiler.h> -
trunk/ab5.0/abdev/compiler_x86/compiler_x86.vcproj
r622 r628 1382 1382 </File> 1383 1383 <File 1384 RelativePath="..\BasicCompiler_Common\include\ErrorCode.h" 1385 > 1386 </File> 1387 <File 1384 1388 RelativePath="..\BasicCompiler_Common\include\LexicalAnalyzer.h" 1385 1389 > -
trunk/ab5.0/abdev/compiler_x86/stdafx.h
r603 r628 48 48 #include <CodeGenerator.h> 49 49 #include <Messenger.h> 50 #include <ErrorCode.h> 50 51 #include <Linker.h> 51 52 #include <Compiler.h>
Note:
See TracChangeset
for help on using the changeset viewer.