comparison sema/ScopeBuilder.d @ 162:0f38f1a0f06f

Fixed symbol for a functions members.
author Anders Johnsen <skabet@gmail.com>
date Tue, 22 Jul 2008 16:22:58 +0200
parents 57b0b4464a0b
children 362265427838
comparison
equal deleted inserted replaced
161:0e10479623f6 162:0f38f1a0f06f
28 override void visitFuncDecl(FuncDecl d) 28 override void visitFuncDecl(FuncDecl d)
29 { 29 {
30 30
31 visitExp(d.returnType); 31 visitExp(d.returnType);
32 visitExp(d.identifier); 32 visitExp(d.identifier);
33 foreach (arg; d.funcArgs)
34 visitDecl(arg);
35
36 inFunctionBodyStack.push(true);
37
38 foreach (stmt; d.statements)
39 visitStmt(stmt);
40
41 inFunctionBodyStack.pop();
42 33
43 d.sym = current.symbol.createMember( 34 d.sym = current.symbol.createMember(
44 d.identifier.get, 35 d.identifier.get,
45 d.type, 36 d.type,
46 d); 37 d);
38
39 auto old = current.symbol;
40 current.symbol = d.sym;
41
42 foreach (arg; d.funcArgs)
43 visitDecl(arg);
44
45 inFunctionBodyStack.push(true);
46
47 foreach (stmt; d.statements)
48 visitStmt(stmt);
49
50 inFunctionBodyStack.pop();
51
52 current.symbol = old;
53
47 } 54 }
48 55
49 override void visitVarDecl(VarDecl d) 56 override void visitVarDecl(VarDecl d)
50 { 57 {
51 visitExp(d.varType); 58 visitExp(d.varType);