comparison ast/Exp.d @ 168:7982eb63c0eb

Some changes to get function overloading to work. Also class inherit works now - to some extend. needs vtables and all the complex stuff of it.
author Anders Johnsen <skabet@gmail.com>
date Thu, 24 Jul 2008 12:06:48 +0200
parents ba94fd563548
children 01c2c49775ef
comparison
equal deleted inserted replaced
166:9cfa33517526 168:7982eb63c0eb
113 return this; 113 return this;
114 } 114 }
115 115
116 Exp exp; 116 Exp exp;
117 Exp[] args; 117 Exp[] args;
118 Symbol callSym;
118 bool sret = false; 119 bool sret = false;
119 120
120 override SourceRange sourceRange() 121 override SourceRange sourceRange()
121 { 122 {
122 SourceRange res = exp.sourceRange; 123 SourceRange res = exp.sourceRange;
387 if (myType) 388 if (myType)
388 return myType; 389 return myType;
389 390
390 if ( target.type.isStruct ) 391 if ( target.type.isStruct )
391 { 392 {
392 DStruct st = target.type.asStruct; 393 Symbol st = target.getSymbol;
393 if (auto t = st.typeOf(child.name)) 394 if (auto t = st.findMembers(child.name))
394 myType = t; 395 myType = t[0].type;
395 // else assert(0, "Referencing non-existant member"); 396 // else assert(0, "Referencing non-existant member");
396 } 397 }
397 else if ( target.type.isClass ) 398 else if ( target.type.isClass )
398 { 399 {
399 DClass cl = target.type.asClass; 400 Symbol cl = target.getSymbol;
400 if (auto t = cl.typeOf(child.name)) 401 if (auto t = cl.findMembers(child.name))
401 myType = t; 402 myType = t[0].type;
402 // else assert(0, "Referencing non-existant member"); 403 // else assert(0, "Referencing non-existant member");
403 } 404 }
404 else 405 else
405 assert(0, "Only structs and classes have members"); 406 assert(0, "Only structs and classes have members");
406 // no error reporting here 407 // no error reporting here
603 } 604 }
604 605
605 override Symbol getSymbol() 606 override Symbol getSymbol()
606 { 607 {
607 if (auto decl = env.find(this.get)) 608 if (auto decl = env.find(this.get))
608 return decl.sym; 609 if(decl.length)
609 else 610 return decl[$-1].sym;
610 return null; 611 return null;
611 } 612 }
612 613
613 override DType type() 614 override DType type()
614 { 615 {
615 if (myType !is null) 616 if (myType !is null)