source: dev/trunk/abdev/BasicCompiler_Common/src/Class_Collect.cpp@ 424

Last change on this file since 424 was 424, checked in by dai_9181, 16 years ago

・ジェネリックな型をパラメータに持つメソッドのオーバーロード解決に対応した。
・型パラメータの制約クラス指定に対応した。

File size: 20.3 KB
Line 
1#include "stdafx.h"
2
3#include <jenga/include/smoothie/Smoothie.h>
4#include <jenga/include/smoothie/SmoothieException.h>
5
6#include <Source.h>
7#include <Class.h>
8#include <Compiler.h>
9#include <NamespaceSupporter.h>
10
11#include "../common.h"
12#ifdef _AMD64_
13#include "../../BasicCompiler64/opcode.h"
14#else
15#include "../../BasicCompiler32/opcode.h"
16#endif
17
18
19class CLoopRefCheck{
20 char **names;
21 int num;
22 void init(){
23 int i;
24 for(i=0;i<num;i++){
25 free(names[i]);
26 }
27 free(names);
28 }
29public:
30 CLoopRefCheck()
31 {
32 names=(char **)malloc(1);
33 num=0;
34 }
35 ~CLoopRefCheck()
36 {
37 init();
38 }
39 void add(const char *lpszInheritsClass)
40 {
41 names=(char **)realloc(names,(num+1)*sizeof(char *));
42 names[num]=(char *)malloc(lstrlen(lpszInheritsClass)+1);
43 lstrcpy(names[num],lpszInheritsClass);
44 num++;
45 }
46 void del(const char *lpszInheritsClass)
47 {
48 int i;
49 for(i=0;i<num;i++){
50 if(lstrcmp(names[i],lpszInheritsClass)==0){
51 free(names[i]);
52 break;
53 }
54 }
55 if(i!=num){
56 num--;
57 for(;i<num;i++){
58 names[i]=names[i+1];
59 }
60 }
61 }
62 BOOL check(const CClass &inheritsClass) const
63 {
64 //ループ継承チェック
65 int i;
66 for(i=0;i<num;i++){
67 if( inheritsClass.GetName() == names[i] ){
68 return 1;
69 }
70 }
71 return 0;
72 }
73};
74CLoopRefCheck *pobj_LoopRefCheck;
75
76
77void Classes::CollectClassesForNameOnly( const BasicSource &source )
78{
79 int i, i2;
80 char temporary[VN_SIZE];
81
82 // 名前空間管理
83 NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();
84 namespaceScopes.clear();
85
86 // Importsされた名前空間の管理
87 NamespaceScopesCollection &importedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces();
88 importedNamespaces.clear();
89
90 for(i=0;;i++){
91 if(source[i]=='\0') break;
92
93 if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){
94 for(i+=2,i2=0;;i2++,i++){
95 if( IsCommandDelimitation( source[i] ) ){
96 temporary[i2]=0;
97 break;
98 }
99 temporary[i2]=source[i];
100 }
101 namespaceScopes.push_back( temporary );
102
103 continue;
104 }
105 else if( source[i] == 1 && source[i+1] == ESC_ENDNAMESPACE ){
106 if( namespaceScopes.size() <= 0 ){
107 SmoothieException::Throw(12, "End Namespace", i );
108 }
109 else{
110 namespaceScopes.pop_back();
111 }
112
113 i += 2;
114 continue;
115 }
116 else if( source[i] == 1 && source[i+1] == ESC_IMPORTS ){
117 for(i+=2,i2=0;;i2++,i++){
118 if( IsCommandDelimitation( source[i] ) ){
119 temporary[i2]=0;
120 break;
121 }
122 temporary[i2]=source[i];
123 }
124 if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )
125 {
126 SmoothieException::Throw(64,temporary,i );
127 }
128
129 continue;
130 }
131 else if( source[i] == 1 && source[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
132 importedNamespaces.clear();
133 continue;
134 }
135
136 if(source[i]==1&&(
137 source[i+1]==ESC_CLASS||
138 source[i+1]==ESC_TYPE||
139 source[i+1]==ESC_INTERFACE
140 ))
141 {
142 int nowLine = i;
143 i += 2;
144
145 Type blittableType;
146 if(memicmp(source.GetBuffer()+i,"Align(",6)==0){
147 //アラインメント修飾子
148 i+=6;
149 i=JumpStringInPare(source.GetBuffer(),i)+1;
150 }
151 else if( memicmp( source.GetBuffer() + i, "Blittable(", 10 ) == 0 ){
152 // Blittable修飾子
153 i+=10;
154 i+=GetStringInPare_RemovePare(temporary,source.GetBuffer()+i)+1;
155 compiler.StringToType( temporary, blittableType );
156 }
157
158 bool isEnum = false;
159 bool isDelegate = false;
160 if( source[i] == 1 && source[i+1] == ESC_ENUM ){
161 // 列挙型の場合
162 isEnum = true;
163
164 i += 2;
165 }
166 else if( source[i] == 1 && source[i+1] == ESC_DELEGATE )
167 {
168 // デリゲートの場合
169 isDelegate = true;
170
171 i += 2;
172 }
173
174 for(i2=0;;i++,i2++){
175 if(!IsVariableChar(source[i])){
176 temporary[i2]=0;
177 break;
178 }
179 temporary[i2]=source[i];
180 }
181
182 //クラスを追加
183 CClass *pClass = this->Add(namespaceScopes, importedNamespaces, temporary,nowLine);
184 if( pClass ){
185 if( source[nowLine+1] == ESC_CLASS ){
186 if( isEnum )
187 {
188 pClass->SetClassType( CClass::Enum );
189 }
190 else if( isDelegate )
191 {
192 pClass->SetClassType( CClass::Delegate );
193 }
194 else{
195 pClass->SetClassType( CClass::Class );
196 }
197 }
198 else if( source[nowLine+1] == ESC_INTERFACE ){
199 pClass->SetClassType( CClass::Interface );
200 }
201 else{
202 pClass->SetClassType( CClass::Structure );
203 }
204 }
205
206 // Blittable型の場合
207 if( !blittableType.IsNull() ){
208 pClass->SetBlittableType( blittableType );
209
210 // Blittable型として登録
211 compiler.GetObjectModule().meta.GetBlittableTypes().push_back( BlittableType( blittableType, pClass ) );
212 }
213 }
214 }
215}
216
217bool Classes::MemberVar_LoopRefCheck(const CClass &objClass){
218 if( objClass.HasSuperClass() )
219 {
220 // 基底クラスをチェック
221 if( MemberVar_LoopRefCheck( objClass.GetSuperClass() ) == false )
222 {
223 return false;
224 }
225 }
226
227 bool result = true;
228 BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
229 if(pMember->GetType().IsStruct()){
230 //循環参照でないかをチェック
231 if(pobj_LoopRefCheck->check(pMember->GetType().GetClass())){
232 extern int cp;
233 SetError(124,pMember->GetType().GetClass().GetName(),cp);
234 return false;
235 }
236
237 pobj_LoopRefCheck->add(objClass.GetName().c_str());
238
239 bool tempResult = MemberVar_LoopRefCheck(pMember->GetType().GetClass());
240 if( result )
241 {
242 result = tempResult;
243 }
244
245 pobj_LoopRefCheck->del(objClass.GetName().c_str());
246 }
247 }
248
249 return result;
250}
251
252void Classes::GetClass_recur(const char *lpszInheritsClass){
253 extern char *basbuf;
254 int i,i2,i3,sub_address,top_pos;
255 char temporary[8192];
256
257 // 名前空間管理
258 NamespaceScopes backupNamespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();
259 NamespaceScopes &namespaceScopes = compiler.GetNamespaceSupporter().GetLivingNamespaceScopes();
260 namespaceScopes.clear();
261
262 // Importsされた名前空間の管理
263 NamespaceScopesCollection backupImportedNamespaces = compiler.GetNamespaceSupporter().GetImportedNamespaces();
264 compiler.GetNamespaceSupporter().GetImportedNamespaces().clear();
265
266 // 呼び出し元でコンパイル中のクラスポインタをバックアップ
267 const CClass *pBackCompilingClass = compiler.pCompilingClass;
268
269 for(i=0;;i++){
270 if(basbuf[i]=='\0') break;
271
272
273 // 名前空間
274 if( basbuf[i] == 1 && basbuf[i+1] == ESC_NAMESPACE ){
275 for(i+=2,i2=0;;i2++,i++){
276 if( IsCommandDelimitation( basbuf[i] ) ){
277 temporary[i2]=0;
278 break;
279 }
280 temporary[i2]=basbuf[i];
281 }
282 namespaceScopes.push_back( temporary );
283
284 continue;
285 }
286 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENDNAMESPACE ){
287 if( namespaceScopes.size() <= 0 ){
288 SetError(12, "End Namespace", i );
289 }
290 else{
291 namespaceScopes.pop_back();
292 }
293
294 i += 2;
295 continue;
296 }
297
298 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPORTS ){
299 for(i+=2,i2=0;;i2++,i++){
300 if( IsCommandDelimitation( basbuf[i] ) ){
301 temporary[i2]=0;
302 break;
303 }
304 temporary[i2]=basbuf[i];
305 }
306 if( !compiler.GetNamespaceSupporter().ImportsNamespace( temporary ) )
307 {
308 SmoothieException::Throw(64,temporary,i );
309 }
310
311 continue;
312 }
313 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
314 compiler.GetNamespaceSupporter().GetImportedNamespaces().clear();
315 continue;
316 }
317
318
319
320 if(basbuf[i]==1&&basbuf[i+1]==ESC_INTERFACE){
321 //////////////////////////
322 // インターフェイス
323 //////////////////////////
324
325 top_pos=i;
326
327 i+=2;
328
329 //インターフェイス名を取得
330 GetCommandToken( temporary, basbuf, i );
331
332 char className[VN_SIZE];
333 Jenga::Common::Strings typeParameters;
334 Jenga::Common::Strings typeParameterBaseClassNames;
335 SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
336
337 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) );
338 if(!pobj_c) continue;
339
340 compiler.pCompilingClass = pobj_c;
341
342 if(lpszInheritsClass){
343 if(lstrcmp(lpszInheritsClass,pobj_c->GetName().c_str())!=0){
344 //継承先先読み用
345 continue;
346 }
347 }
348
349 if(pobj_c->IsReady()){
350 //既に先読みされているとき
351 continue;
352 }
353
354 /////////////////////////////////////////////////////////
355 // ☆★☆ ジェネリクスサポート ☆★☆
356 for( i2=0; i2<static_cast<int>(typeParameters.size()); i2++ )
357 {
358 Type baseType( DEF_OBJECT, *GetObjectClassPtr() );
359 if( typeParameterBaseClassNames[i2].size() )
360 {
361 if( !compiler.StringToType( typeParameterBaseClassNames[i2], baseType ) )
362 {
363 SetError(106,typeParameterBaseClassNames[i2],i);
364 }
365 else if( !baseType.IsObject() )
366 {
367 SetError(106,typeParameterBaseClassNames[i2],i);
368 }
369 }
370
371 pobj_c->AddFormalGenericType( GenericType( typeParameters[i2], baseType ) );
372 }
373 /////////////////////////////////////////////////////////
374
375 pobj_c->Readed();
376
377 pobj_c->SetConstructorMemberSubIndex( -1 );
378 pobj_c->SetDestructorMemberSubIndex( -1 );
379
380 if( memcmp( basbuf+i+1, "__COM", 5 ) == 0 && IsCommandDelimitation( basbuf[i+1+5] ) )
381 {
382 // COMインターフェイス
383 pobj_c->SetClassType( CClass::ComInterface );
384
385 i += 6;
386 }
387
388 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){
389 //継承を行う場合
390 for(i+=3,i2=0;;i++,i2++){
391 if(IsCommandDelimitation(basbuf[i])){
392 temporary[i2]=0;
393 break;
394 }
395 temporary[i2]=basbuf[i];
396 }
397
398 if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
399 SetError(105,temporary,i);
400 goto Interface_InheritsError;
401 }
402
403 //継承元クラスを取得
404 const Classes &classes = *this;
405 const CClass *pInheritsClass = classes.Find(temporary);
406 if( !pInheritsClass ){
407 SetError(106,temporary,i);
408 goto Interface_InheritsError;
409 }
410
411 //継承させる
412 if( !pobj_c->InheritsClass( *pInheritsClass, Types(), i ) ){
413 goto Interface_InheritsError;
414 }
415 }
416 else{
417 //継承無し
418 if( &pobj_c->GetSuperClass() || pobj_c->GetVtblNum() )
419 {
420 // TODO: ここに来ないことが実証できたらこの分岐は消す
421 Jenga::Throw( "GetClass_recur内の例外" );
422 }
423 }
424Interface_InheritsError:
425
426 //メンバ変数、関数を取得
427 while(1){
428 i++;
429
430 //エラー
431 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE||basbuf[i+1]==ESC_INTERFACE)){
432 SetError(22,"Interface",i);
433 i--;
434 break;
435 }
436
437 if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
438 SetError(111,NULL,i);
439 break;
440 }
441 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPLEMENTS )
442 {
443 SetError(137, NULL, i );
444 break;
445 }
446
447 sub_address=i;
448
449 for(i2=0;;i++,i2++){
450 if(IsCommandDelimitation(basbuf[i])){
451 temporary[i2]=0;
452 break;
453 }
454 temporary[i2]=basbuf[i];
455 }
456 if(temporary[0]=='\0'){
457 if(basbuf[i]=='\0'){
458 i--;
459 SetError(22,"Interface",top_pos);
460 break;
461 }
462 continue;
463 }
464
465 //End Interface記述の場合
466 if(temporary[0]==1&&temporary[1]==ESC_ENDINTERFACE) break;
467
468 if(!(temporary[0]==1&&(
469 temporary[1]==ESC_SUB||temporary[1]==ESC_FUNCTION
470 ))){
471 SetError(1,NULL,i);
472 break;
473 }
474
475 //メンバ関数を追加
476 pobj_c->AddMethod(pobj_c,
477 Prototype::Public, //Publicアクセス権
478 0, // bStatic
479 false, // isConst
480 true, // isAbstract
481 true, // isVirtual
482 false, // isOverride
483 false, // isAutoGeneration
484 temporary,
485 sub_address
486 );
487 }
488 }
489
490 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
491 //////////////////////////
492 // クラス
493 //////////////////////////
494
495 top_pos=i;
496
497 const DWORD dwClassType=basbuf[i+1];
498
499 i+=2;
500
501 int iAlign=0;
502 if(memicmp(basbuf+i,"Align(",6)==0){
503 //アラインメント修飾子
504 i+=6;
505 i+=GetStringInPare_RemovePare(temporary,basbuf+i)+1;
506 iAlign=atoi(temporary);
507
508 if( dwClassType != ESC_TYPE )
509 {
510 SetError(140,NULL,i);
511 }
512
513 if(!(iAlign==1||iAlign==2||iAlign==4||iAlign==8||iAlign==16))
514 SetError(51,NULL,i);
515 }
516 else if( memicmp( basbuf + i, "Blittable(", 10 ) == 0 ){
517 // Blittable修飾子
518 i+=10;
519 i=JumpStringInPare(basbuf,i)+1;
520
521 if( dwClassType != ESC_CLASS )
522 {
523 SetError(141,NULL,i);
524 }
525 }
526
527 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM )
528 {
529 // 列挙型の場合
530 i += 2;
531 }
532 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_DELEGATE )
533 {
534 // デリゲートの場合
535 i += 2;
536 }
537
538 //クラス名を取得
539 GetCommandToken( temporary, basbuf, i );
540
541 char className[VN_SIZE];
542 Jenga::Common::Strings typeParameters;
543 Jenga::Common::Strings typeParameterBaseClassNames;
544 SplitGenericClassInstance( temporary, className, typeParameters, true, &typeParameterBaseClassNames );
545
546 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) );
547 if(!pobj_c) continue;
548
549 compiler.pCompilingClass = pobj_c;
550
551 if(lpszInheritsClass){
552 if( pobj_c->GetName() != lpszInheritsClass ){
553 //継承先先読み用
554 continue;
555 }
556 }
557
558 if(pobj_c->IsReady()){
559 //既に先読みされているとき
560 continue;
561 }
562
563
564 /////////////////////////////////////////////////////////
565 // ☆★☆ ジェネリクスサポート ☆★☆
566 for( i2=0; i2<static_cast<int>(typeParameters.size()); i2++ )
567 {
568 Type baseType( DEF_OBJECT, *GetObjectClassPtr() );
569 if( typeParameterBaseClassNames[i2].size() )
570 {
571 if( !compiler.StringToType( typeParameterBaseClassNames[i2], baseType ) )
572 {
573 SetError(106,typeParameterBaseClassNames[i2],i);
574 }
575 else if( !baseType.IsObject() )
576 {
577 SetError(106,typeParameterBaseClassNames[i2],i);
578 }
579 }
580
581 pobj_c->AddFormalGenericType( GenericType( typeParameters[i2], baseType ) );
582 }
583 /////////////////////////////////////////////////////////
584
585
586 pobj_c->SetFixedAlignment( iAlign );
587
588 pobj_c->Readed();
589
590 pobj_c->SetConstructorMemberSubIndex( -1 );
591 pobj_c->SetDestructorMemberSubIndex( -1 );
592
593 //アクセス制限の初期値をセット
594 Prototype::Accessibility accessibility;
595 if(dwClassType==ESC_CLASS){
596 accessibility = Prototype::Private;
597 }
598 else{
599 accessibility = Prototype::Public;
600 }
601
602 if( pobj_c->GetName() == "Object"
603 || dwClassType == ESC_TYPE )
604 {
605 // 何も継承しない
606
607 if( &pobj_c->GetSuperClass() || pobj_c->GetVtblNum() )
608 {
609 // TODO: ここに来ないことが実証できたらこの分岐は消す
610 Jenga::Throw( "GetClass_recur内の例外" );
611 }
612 }
613 else{
614 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS)
615 {
616 // クラス継承先が指定されているとき
617 i += 3;
618 GetCommandToken( temporary, basbuf, i );
619
620 if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
621 SetError(105,temporary,i);
622 goto InheritsError;
623 }
624 }
625 else
626 {
627 // 何の指定もないときはObjectクラスを継承する
628 lstrcpy( temporary, "Object" );
629 }
630 pobj_c->Inherits( temporary, i );
631
632 if( basbuf[i+1] == 1 && basbuf[i+2] == ESC_IMPLEMENTS )
633 {
634 // インターフェイス実装を行う場合
635 i += 3;
636 GetCommandToken( temporary, basbuf, i );
637
638 pobj_c->Implements( temporary, i );
639 }
640 }
641InheritsError:
642
643 //メンバとメソッドを取得
644 while(1){
645 i++;
646
647 //エラー
648 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
649 SetError(22,"Class",i);
650 i--;
651 break;
652 }
653
654 if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
655 SetError(111,NULL,i);
656 break;
657 }
658 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPLEMENTS )
659 {
660 SetError(137, NULL, i );
661 break;
662 }
663
664 //Static修飾子
665 BOOL bStatic;
666 if(basbuf[i]==1&&basbuf[i+1]==ESC_STATIC){
667 bStatic=1;
668 i+=2;
669 }
670 else bStatic=0;
671
672 //Const修飾子
673 bool isConst = false;
674 if( basbuf[i] == 1 && basbuf[i + 1] == ESC_CONST ){
675 isConst = true;
676 i += 2;
677 }
678
679 if(basbuf[i]==1&&(
680 basbuf[i+1]==ESC_ABSTRACT||basbuf[i+1]==ESC_VIRTUAL||basbuf[i+1]==ESC_OVERRIDE||
681 basbuf[i+1]==ESC_SUB||basbuf[i+1]==ESC_FUNCTION
682 )){
683 i3=basbuf[i+1];
684 sub_address=i;
685 }
686 else i3=0;
687
688 bool isVirtual = false, isAbstract = false, isOverride = false;
689 if(i3==ESC_ABSTRACT){
690 isAbstract=1;
691 isVirtual=1;
692 i+=2;
693
694 i3=basbuf[i+1];
695 }
696 else if(i3==ESC_VIRTUAL){
697 isAbstract=0;
698 isVirtual=1;
699 i+=2;
700
701 i3=basbuf[i+1];
702 }
703 else if(i3==ESC_OVERRIDE){
704 isOverride=1;
705 isVirtual=1;
706
707 i+=2;
708
709 i3=basbuf[i+1];
710 }
711
712 for(i2=0;;i++,i2++){
713 if(IsCommandDelimitation(basbuf[i])){
714 temporary[i2]=0;
715 break;
716 }
717 temporary[i2]=basbuf[i];
718 }
719 if(temporary[0]=='\0'){
720 if(basbuf[i]=='\0'){
721
722 if(dwClassType==ESC_CLASS)
723 SetError(22,"Class",top_pos);
724 else
725 SetError(22,"Type",top_pos);
726
727 i--;
728 break;
729 }
730 continue;
731 }
732
733 //End Class記述の場合
734 if(temporary[0]==1&&temporary[1]==ESC_ENDCLASS&&dwClassType==ESC_CLASS) break;
735 if(temporary[0]==1&&temporary[1]==ESC_ENDTYPE&&dwClassType==ESC_TYPE) break;
736
737 //アクセスを変更
738 if(lstrcmpi(temporary,"Private")==0){
739 accessibility = Prototype::Private;
740 continue;
741 }
742 if(lstrcmpi(temporary,"Public")==0){
743 accessibility = Prototype::Public;
744 continue;
745 }
746 if(lstrcmpi(temporary,"Protected")==0){
747 accessibility = Prototype::Protected;
748 continue;
749 }
750
751 extern int cp;
752 if(i3==0){
753 if(bStatic){
754 //静的メンバを追加
755 cp=i; //エラー用
756 pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i);
757 }
758 else{
759 //メンバを追加
760 cp=i; //エラー用
761 pobj_c->AddMember( accessibility, isConst, false, temporary, i );
762
763
764 if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
765 if( !pobj_c->GetDynamicMembers().back()->GetType().GetClass().IsReady() ){
766 //参照先が読み取られていないとき
767 GetClass_recur(pobj_c->GetDynamicMembers().back()->GetType().GetClass().GetName().c_str());
768 }
769 }
770
771
772 if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
773 //循環参照のチェック
774 pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
775 if(!MemberVar_LoopRefCheck(pobj_c->GetDynamicMembers().back()->GetType().GetClass())){
776 //エラー回避
777 Type &type = const_cast<Type &>(pobj_c->GetDynamicMembers().back()->GetType());
778 type.SetBasicType( DEF_PTR_VOID );
779 }
780 pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
781 }
782 }
783 }
784 else{
785 //メソッドを追加
786 cp=i; //エラー用
787 pobj_c->AddMethod(pobj_c,
788 accessibility,
789 bStatic,
790 isConst,
791 isAbstract,
792 isVirtual,
793 isOverride,
794 false,
795 temporary,
796 sub_address);
797
798 if( isAbstract ) continue;
799
800 for(;;i++){
801 if(basbuf[i]=='\0'){
802 i--;
803 break;
804 }
805 if(basbuf[i-1]!='*'&&
806 basbuf[i]==1&&(
807 basbuf[i+1]==ESC_SUB||
808 basbuf[i+1]==ESC_FUNCTION||
809 basbuf[i+1]==ESC_MACRO||
810 basbuf[i+1]==ESC_TYPE||
811 basbuf[i+1]==ESC_CLASS||
812 basbuf[i+1]==ESC_INTERFACE||
813 basbuf[i+1]==ESC_ENUM)){
814 GetDefaultNameFromES(i3,temporary);
815 SetError(22,temporary,i);
816 }
817 if(basbuf[i]==1&&basbuf[i+1]==GetEndXXXCommand((char)i3)){
818 i+=2;
819 break;
820 }
821 }
822 }
823 }
824 }
825 }
826
827 // 呼び出し元でコンパイル中のクラスポインタを元に戻す
828 compiler.pCompilingClass = pBackCompilingClass;
829
830 // 名前空間を元に戻す
831 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes() = backupNamespaceScopes;
832
833 // インポートされた名前空間を元に戻す
834 compiler.GetNamespaceSupporter().GetImportedNamespaces() = backupImportedNamespaces;
835}
836
837void Classes::LookaheadClass( const char *className )
838{
839 pobj_LoopRefCheck->add( className );
840 compiler.GetObjectModule().meta.GetClasses().GetClass_recur( className );
841 pobj_LoopRefCheck->del( className );
842}
843
844bool Classes::LoopRefCheck( const CClass &objClass )
845{
846 if( pobj_LoopRefCheck->check( objClass ) )
847 {
848 return false;
849 }
850
851 return true;
852}
853
854void Classes::GetAllClassInfo(void){
855 //ループ継承チェック用のクラス
856 pobj_LoopRefCheck=new CLoopRefCheck();
857
858 //クラスを取得
859 GetClass_recur(0);
860
861 delete pobj_LoopRefCheck;
862 pobj_LoopRefCheck=0;
863
864 // イテレータの準備
865 this->Iterator_Init();
866}
Note: See TracBrowser for help on using the repository browser.