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

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

クラス継承を行う際、dynamicMembersの中身をコピーする方式をやめ、基底クラスのものを参照するように修正した。

File size: 19.4 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 SplitGenericClassInstance( temporary, className, typeParameters );
335
336 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) );
337 if(!pobj_c) continue;
338
339 compiler.pCompilingClass = pobj_c;
340
341 if(lpszInheritsClass){
342 if(lstrcmp(lpszInheritsClass,pobj_c->GetName().c_str())!=0){
343 //継承先先読み用
344 continue;
345 }
346 }
347
348 if(pobj_c->IsReady()){
349 //既に先読みされているとき
350 continue;
351 }
352
353 /////////////////////////////////////////////////////////
354 // ☆★☆ ジェネリクスサポート ☆★☆
355 BOOST_FOREACH( const std::string &typeParameter, typeParameters )
356 {
357 pobj_c->AddFormalGenericType( GenericType( typeParameter, Type(DEF_OBJECT,*GetObjectClassPtr()) ) );
358 }
359 /////////////////////////////////////////////////////////
360
361 pobj_c->Readed();
362
363 pobj_c->SetConstructorMemberSubIndex( -1 );
364 pobj_c->SetDestructorMemberSubIndex( -1 );
365
366 if( memcmp( basbuf+i+1, "__COM", 5 ) == 0 && IsCommandDelimitation( basbuf[i+1+5] ) )
367 {
368 // COMインターフェイス
369 pobj_c->SetClassType( CClass::ComInterface );
370
371 i += 6;
372 }
373
374 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){
375 //継承を行う場合
376 for(i+=3,i2=0;;i++,i2++){
377 if(IsCommandDelimitation(basbuf[i])){
378 temporary[i2]=0;
379 break;
380 }
381 temporary[i2]=basbuf[i];
382 }
383
384 if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
385 SetError(105,temporary,i);
386 goto Interface_InheritsError;
387 }
388
389 //継承元クラスを取得
390 const Classes &classes = *this;
391 const CClass *pInheritsClass = classes.Find(temporary);
392 if( !pInheritsClass ){
393 SetError(106,temporary,i);
394 goto Interface_InheritsError;
395 }
396
397 //継承させる
398 if( !pobj_c->InheritsClass( *pInheritsClass, Types(), i ) ){
399 goto Interface_InheritsError;
400 }
401 }
402 else{
403 //継承無し
404 if( &pobj_c->GetSuperClass() || pobj_c->GetVtblNum() )
405 {
406 // TODO: ここに来ないことが実証できたらこの分岐は消す
407 Jenga::Throw( "GetClass_recur内の例外" );
408 }
409 }
410Interface_InheritsError:
411
412 //メンバ変数、関数を取得
413 while(1){
414 i++;
415
416 //エラー
417 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE||basbuf[i+1]==ESC_INTERFACE)){
418 SetError(22,"Interface",i);
419 i--;
420 break;
421 }
422
423 if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
424 SetError(111,NULL,i);
425 break;
426 }
427 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPLEMENTS )
428 {
429 SetError(137, NULL, i );
430 break;
431 }
432
433 sub_address=i;
434
435 for(i2=0;;i++,i2++){
436 if(IsCommandDelimitation(basbuf[i])){
437 temporary[i2]=0;
438 break;
439 }
440 temporary[i2]=basbuf[i];
441 }
442 if(temporary[0]=='\0'){
443 if(basbuf[i]=='\0'){
444 i--;
445 SetError(22,"Interface",top_pos);
446 break;
447 }
448 continue;
449 }
450
451 //End Interface記述の場合
452 if(temporary[0]==1&&temporary[1]==ESC_ENDINTERFACE) break;
453
454 if(!(temporary[0]==1&&(
455 temporary[1]==ESC_SUB||temporary[1]==ESC_FUNCTION
456 ))){
457 SetError(1,NULL,i);
458 break;
459 }
460
461 //メンバ関数を追加
462 pobj_c->AddMethod(pobj_c,
463 Prototype::Public, //Publicアクセス権
464 0, // bStatic
465 false, // isConst
466 true, // isAbstract
467 true, // isVirtual
468 false, // isOverride
469 false, // isAutoGeneration
470 temporary,
471 sub_address
472 );
473 }
474 }
475
476 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
477 //////////////////////////
478 // クラス
479 //////////////////////////
480
481 top_pos=i;
482
483 const DWORD dwClassType=basbuf[i+1];
484
485 i+=2;
486
487 int iAlign=0;
488 if(memicmp(basbuf+i,"Align(",6)==0){
489 //アラインメント修飾子
490 i+=6;
491 i+=GetStringInPare_RemovePare(temporary,basbuf+i)+1;
492 iAlign=atoi(temporary);
493
494 if( dwClassType != ESC_TYPE )
495 {
496 SetError(140,NULL,i);
497 }
498
499 if(!(iAlign==1||iAlign==2||iAlign==4||iAlign==8||iAlign==16))
500 SetError(51,NULL,i);
501 }
502 else if( memicmp( basbuf + i, "Blittable(", 10 ) == 0 ){
503 // Blittable修飾子
504 i+=10;
505 i=JumpStringInPare(basbuf,i)+1;
506
507 if( dwClassType != ESC_CLASS )
508 {
509 SetError(141,NULL,i);
510 }
511 }
512
513 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM )
514 {
515 // 列挙型の場合
516 i += 2;
517 }
518 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_DELEGATE )
519 {
520 // デリゲートの場合
521 i += 2;
522 }
523
524 //クラス名を取得
525 GetCommandToken( temporary, basbuf, i );
526
527 char className[VN_SIZE];
528 Jenga::Common::Strings typeParameters;
529 SplitGenericClassInstance( temporary, className, typeParameters );
530
531 CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, className) );
532 if(!pobj_c) continue;
533
534 compiler.pCompilingClass = pobj_c;
535
536 if(lpszInheritsClass){
537 if( pobj_c->GetName() != lpszInheritsClass ){
538 //継承先先読み用
539 continue;
540 }
541 }
542
543 if(pobj_c->IsReady()){
544 //既に先読みされているとき
545 continue;
546 }
547
548
549 /////////////////////////////////////////////////////////
550 // ☆★☆ ジェネリクスサポート ☆★☆
551 BOOST_FOREACH( const std::string &typeParameter, typeParameters )
552 {
553 pobj_c->AddFormalGenericType( GenericType( typeParameter, Type(DEF_OBJECT,*GetObjectClassPtr()) ) );
554 }
555 /////////////////////////////////////////////////////////
556
557
558 pobj_c->SetFixedAlignment( iAlign );
559
560 pobj_c->Readed();
561
562 pobj_c->SetConstructorMemberSubIndex( -1 );
563 pobj_c->SetDestructorMemberSubIndex( -1 );
564
565 //アクセス制限の初期値をセット
566 Prototype::Accessibility accessibility;
567 if(dwClassType==ESC_CLASS){
568 accessibility = Prototype::Private;
569 }
570 else{
571 accessibility = Prototype::Public;
572 }
573
574 if( pobj_c->GetName() == "Object"
575 || dwClassType == ESC_TYPE )
576 {
577 // 何も継承しない
578
579 if( &pobj_c->GetSuperClass() || pobj_c->GetVtblNum() )
580 {
581 // TODO: ここに来ないことが実証できたらこの分岐は消す
582 Jenga::Throw( "GetClass_recur内の例外" );
583 }
584 }
585 else{
586 if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS)
587 {
588 // クラス継承先が指定されているとき
589 i += 3;
590 GetCommandToken( temporary, basbuf, i );
591
592 if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
593 SetError(105,temporary,i);
594 goto InheritsError;
595 }
596 }
597 else
598 {
599 // 何の指定もないときはObjectクラスを継承する
600 lstrcpy( temporary, "Object" );
601 }
602 pobj_c->Inherits( temporary, i );
603
604 if( basbuf[i+1] == 1 && basbuf[i+2] == ESC_IMPLEMENTS )
605 {
606 // インターフェイス実装を行う場合
607 i += 3;
608 GetCommandToken( temporary, basbuf, i );
609
610 pobj_c->Implements( temporary, i );
611 }
612 }
613InheritsError:
614
615 //メンバとメソッドを取得
616 while(1){
617 i++;
618
619 //エラー
620 if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
621 SetError(22,"Class",i);
622 i--;
623 break;
624 }
625
626 if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
627 SetError(111,NULL,i);
628 break;
629 }
630 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_IMPLEMENTS )
631 {
632 SetError(137, NULL, i );
633 break;
634 }
635
636 //Static修飾子
637 BOOL bStatic;
638 if(basbuf[i]==1&&basbuf[i+1]==ESC_STATIC){
639 bStatic=1;
640 i+=2;
641 }
642 else bStatic=0;
643
644 //Const修飾子
645 bool isConst = false;
646 if( basbuf[i] == 1 && basbuf[i + 1] == ESC_CONST ){
647 isConst = true;
648 i += 2;
649 }
650
651 if(basbuf[i]==1&&(
652 basbuf[i+1]==ESC_ABSTRACT||basbuf[i+1]==ESC_VIRTUAL||basbuf[i+1]==ESC_OVERRIDE||
653 basbuf[i+1]==ESC_SUB||basbuf[i+1]==ESC_FUNCTION
654 )){
655 i3=basbuf[i+1];
656 sub_address=i;
657 }
658 else i3=0;
659
660 bool isVirtual = false, isAbstract = false, isOverride = false;
661 if(i3==ESC_ABSTRACT){
662 isAbstract=1;
663 isVirtual=1;
664 i+=2;
665
666 i3=basbuf[i+1];
667 }
668 else if(i3==ESC_VIRTUAL){
669 isAbstract=0;
670 isVirtual=1;
671 i+=2;
672
673 i3=basbuf[i+1];
674 }
675 else if(i3==ESC_OVERRIDE){
676 isOverride=1;
677 isVirtual=1;
678
679 i+=2;
680
681 i3=basbuf[i+1];
682 }
683
684 for(i2=0;;i++,i2++){
685 if(IsCommandDelimitation(basbuf[i])){
686 temporary[i2]=0;
687 break;
688 }
689 temporary[i2]=basbuf[i];
690 }
691 if(temporary[0]=='\0'){
692 if(basbuf[i]=='\0'){
693
694 if(dwClassType==ESC_CLASS)
695 SetError(22,"Class",top_pos);
696 else
697 SetError(22,"Type",top_pos);
698
699 i--;
700 break;
701 }
702 continue;
703 }
704
705 //End Class記述の場合
706 if(temporary[0]==1&&temporary[1]==ESC_ENDCLASS&&dwClassType==ESC_CLASS) break;
707 if(temporary[0]==1&&temporary[1]==ESC_ENDTYPE&&dwClassType==ESC_TYPE) break;
708
709 //アクセスを変更
710 if(lstrcmpi(temporary,"Private")==0){
711 accessibility = Prototype::Private;
712 continue;
713 }
714 if(lstrcmpi(temporary,"Public")==0){
715 accessibility = Prototype::Public;
716 continue;
717 }
718 if(lstrcmpi(temporary,"Protected")==0){
719 accessibility = Prototype::Protected;
720 continue;
721 }
722
723 extern int cp;
724 if(i3==0){
725 if(bStatic){
726 //静的メンバを追加
727 cp=i; //エラー用
728 pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i);
729 }
730 else{
731 //メンバを追加
732 cp=i; //エラー用
733 pobj_c->AddMember( accessibility, isConst, false, temporary, i );
734
735
736 if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
737 if( !pobj_c->GetDynamicMembers().back()->GetType().GetClass().IsReady() ){
738 //参照先が読み取られていないとき
739 GetClass_recur(pobj_c->GetDynamicMembers().back()->GetType().GetClass().GetName().c_str());
740 }
741 }
742
743
744 if(pobj_c->GetDynamicMembers().back()->GetType().IsStruct()){
745 //循環参照のチェック
746 pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
747 if(!MemberVar_LoopRefCheck(pobj_c->GetDynamicMembers().back()->GetType().GetClass())){
748 //エラー回避
749 Type &type = const_cast<Type &>(pobj_c->GetDynamicMembers().back()->GetType());
750 type.SetBasicType( DEF_PTR_VOID );
751 }
752 pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
753 }
754 }
755 }
756 else{
757 //メソッドを追加
758 cp=i; //エラー用
759 pobj_c->AddMethod(pobj_c,
760 accessibility,
761 bStatic,
762 isConst,
763 isAbstract,
764 isVirtual,
765 isOverride,
766 false,
767 temporary,
768 sub_address);
769
770 if( isAbstract ) continue;
771
772 for(;;i++){
773 if(basbuf[i]=='\0'){
774 i--;
775 break;
776 }
777 if(basbuf[i-1]!='*'&&
778 basbuf[i]==1&&(
779 basbuf[i+1]==ESC_SUB||
780 basbuf[i+1]==ESC_FUNCTION||
781 basbuf[i+1]==ESC_MACRO||
782 basbuf[i+1]==ESC_TYPE||
783 basbuf[i+1]==ESC_CLASS||
784 basbuf[i+1]==ESC_INTERFACE||
785 basbuf[i+1]==ESC_ENUM)){
786 GetDefaultNameFromES(i3,temporary);
787 SetError(22,temporary,i);
788 }
789 if(basbuf[i]==1&&basbuf[i+1]==GetEndXXXCommand((char)i3)){
790 i+=2;
791 break;
792 }
793 }
794 }
795 }
796 }
797 }
798
799 // 呼び出し元でコンパイル中のクラスポインタを元に戻す
800 compiler.pCompilingClass = pBackCompilingClass;
801
802 // 名前空間を元に戻す
803 compiler.GetNamespaceSupporter().GetLivingNamespaceScopes() = backupNamespaceScopes;
804
805 // インポートされた名前空間を元に戻す
806 compiler.GetNamespaceSupporter().GetImportedNamespaces() = backupImportedNamespaces;
807}
808
809void Classes::LookaheadClass( const char *className )
810{
811 pobj_LoopRefCheck->add( className );
812 compiler.GetObjectModule().meta.GetClasses().GetClass_recur( className );
813 pobj_LoopRefCheck->del( className );
814}
815
816bool Classes::LoopRefCheck( const CClass &objClass )
817{
818 if( pobj_LoopRefCheck->check( objClass ) )
819 {
820 return false;
821 }
822
823 return true;
824}
825
826void Classes::GetAllClassInfo(void){
827 //ループ継承チェック用のクラス
828 pobj_LoopRefCheck=new CLoopRefCheck();
829
830 //クラスを取得
831 GetClass_recur(0);
832
833 delete pobj_LoopRefCheck;
834 pobj_LoopRefCheck=0;
835
836 // イテレータの準備
837 this->Iterator_Init();
838}
Note: See TracBrowser for help on using the repository browser.