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

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