annotate sema/ScopeCheck.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 57b0b4464a0b
children 01c2c49775ef
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
92
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 88
diff changeset
1 module sema.ScopeCheck;
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
2
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
3 import sema.Visitor,
130
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
4 sema.Symbol,
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
5 sema.Scope,
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
6 sema.DType;
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
7
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
8 import basic.Message,
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
9 basic.Attribute;
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
10
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
11 import tango.io.Stdout;
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
12
92
771ac63898e2 A few better parser errors plus renaming most of the sema classes to match that they do now. Some have changes a lot.
Anders Johnsen <skabet@gmail.com>
parents: 88
diff changeset
13 class ScopeCheck : Visitor!(void)
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
14 {
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
15
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
16 this(MessageHandler messages)
29
41d23f2762c3 Merge, and updated Error class
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
17 {
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
18 this.messages = messages;
29
41d23f2762c3 Merge, and updated Error class
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
19 }
41d23f2762c3 Merge, and updated Error class
Anders Halager <halager@gmail.com>
parents: 28
diff changeset
20
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
21 override void visitIdentifier(Identifier i)
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
22 {
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 136
diff changeset
23 auto symbol = i.env.find(i.get);
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
24
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
25 if(symbol is null)
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
26 messages.report(UndefinedIdentifier, i.loc)
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 68
diff changeset
27 .arg(i.get);
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
28 }
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
29
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
30 override void visitVarDecl(VarDecl d)
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
31 {
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 136
diff changeset
32 if(!d.env.findType(d.varType.get))
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
33 messages.report(UndefinedType, d.varType.loc)
88
eb5b2c719a39 Major change to locations, tokens and expressions.
Anders Halager <halager@gmail.com>
parents: 68
diff changeset
34 .arg(d.varType.get);
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
35
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
36 auto env = d.env;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
37 if (d.env.enclosing)
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 136
diff changeset
38 if (d.env.enclosing.find(d.identifier.get) !is null)
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
39 if (d.env.parentFunction !is null)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
40 while( d.env.parentFunction.env !is env)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
41 {
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
42 if (d.env.enclosing.find(d.identifier.get)[0].env == env)
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
43 messages.report(CannotRedeclare, d.identifier.loc)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
44 .arg(d.identifier.get);
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
45 env = env.enclosing;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
46 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
47
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
48 visitExp(d.identifier);
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
49 if (d.init)
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
50 visitExp(d.init);
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
51 }
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
52
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
53 override void visitFuncDecl(FuncDecl f)
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
54 {
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
55 visitExp(f.identifier);
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
56
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
57 inFunction = true;
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
58 foreach (stmt; f.statements)
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
59 visitStmt(stmt);
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
60 inFunction = false;
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
61 }
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
62
99
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
63 override void visitImportDecl(ImportDecl) { }
857f0d530789 Imports and improved module statement
Anders Halager <halager@gmail.com>
parents: 92
diff changeset
64
68
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
65 override void visitCastExp(CastExp exp)
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
66 {
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
67 visitExp(exp.exp);
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
68 }
381975d76baf A LOT of bug fixing - also implemented implicit casts. If you do a --ast-dump-code on a target with some algebra of differant types, you should now see the type casts being made. Also, Tests are again back with only switches failing...
Anders Johnsen <skabet@gmail.com>
parents: 63
diff changeset
69
55
79cb0afafabe Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
70 override void visitMemberReference(MemberReference m)
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
71 {
130
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
72 internalVisitMemberRef(m);
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
73 }
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
74
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
75 private Symbol internalVisitMemberRef(MemberReference m)
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
76 {
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
77 Symbol visitRef(MemberReference m, Identifier target, Symbol st)
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
78 {
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
79 auto child = m.child;
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
80 auto res = st.findMembers(child.get);
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
81
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
82 if(!res.length)
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
83 messages.report(MissingMember, m.loc)
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
84 .arg(st.type.name)
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
85 .arg(target.get)
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
86 .arg(child.get);
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
87 else
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
88 internalCheckProtection(res[0], child);
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
89
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
90 return res.length ? res[0] : null;
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
91 }
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
92 switch(m.target.expType)
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
93 {
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
94 case ExpType.Identifier:
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
95 return visitRef(m, cast(Identifier)m.target,
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
96 (cast(Identifier)m.target).getSymbol);
55
79cb0afafabe Now structs are somewhat useable to use.
Anders Johnsen <skabet@gmail.com>
parents: 39
diff changeset
97 case ExpType.MemberReference:
130
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
98 Symbol s = internalVisitMemberRef(cast(MemberReference)m.target);
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
99 if(!s)
6545a8d59596 Recursive member-lookup.
Anders Johnsen <skabet@gmail.com>
parents: 114
diff changeset
100 return null;
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
101 return visitRef(m, cast(Identifier)m.target, s);
28
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
102 }
69464d465284 Now supporting structs - both read and write. Still a few errors though, so watch out.
Anders Johnsen <skabet@gmail.com>
parents: 24
diff changeset
103 }
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
104
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
105 override void visitExp(Exp exp)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
106 {
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
107 if (exp.expType == ExpType.Identifier && inFunction
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 136
diff changeset
108 && exp.env.find((cast(Identifier)exp).get) !is null)
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
109 {
145
a14ac9e5c858 Changes Scope to use char[]'s insted of Identifiers for lookup.
Anders Johnsen <skabet@gmail.com>
parents: 136
diff changeset
110 if (exp.env.findType((cast(Identifier)exp).get) is null)
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
111 internalCheckProtection(
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.
Anders Johnsen <skabet@gmail.com>
parents: 158
diff changeset
112 exp.env.find((cast(Identifier)exp).get)[0].sym,
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
113 cast(Identifier)exp);
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
114 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
115
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
116 super.visitExp(exp);
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
117 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
118
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
119 private void internalCheckProtection(Symbol sym, Identifier iden)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
120 {
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
121 if (isChildOf(sym.decl.env, iden.env))
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
122 return;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
123
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
124 switch(sym.decl.att.getProtection)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
125 {
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
126 case Protection.Private:
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
127 /* if (iden.env.inModule == sym.decl.getIdentifier.env.inModule
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
128 && sym.decl.getIdentifier.env.enclosing == iden.env.inModule)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
129 {}
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
130 else*/
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
131 messages.report(CannotAccessPrivate, iden.loc);
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
132 return;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
133 default:
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
134 return;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
135 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
136 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
137
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
138 private bool isChildOf(Scope parent, Scope child)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
139 {
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
140 if (child is parent)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
141 return true;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
142
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
143 if (child.enclosing !is null)
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
144 return isChildOf(parent, child.enclosing);
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
145
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
146 return false;
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
147 }
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
148
63
9f8131676242 Now Decl's have a DType type(), and should use varType and returnType to get the old type id
Anders Halager <halager@gmail.com>
parents: 55
diff changeset
149 private bool isType(char[] s)
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
150 {
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
151 return (s in types? true : false);
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
152 }
114
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
153
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
154 int[char[]] types;
3a0cd42de9cc Removed misc/Error.d and is now using the error system all way through.
Anders Johnsen <skabet@gmail.com>
parents: 99
diff changeset
155 MessageHandler messages;
136
2be29b296081 Lots of changes:
johnsen@johnsen-laptop
parents: 135
diff changeset
156 bool inFunction;
13
e5caf9971207 Checking for types and identifiers. TODO: Make each varDecl create a new scope
johnsen@johnsen-desktop
parents:
diff changeset
157 }
22
e331e4e816e4 now handling structs to some extend
johnsen@johnsen-laptop
parents: 15
diff changeset
158