Mercurial > projects > ddmd
comparison dmd/DeleteDeclaration.d @ 130:60bb0fe4563e
dmdfe 2.037 first main iteration
author | Eldar Insafutdinov <e.insafutdinov@gmail.com> |
---|---|
date | Thu, 09 Sep 2010 22:51:44 +0100 |
parents | 9e39c7de8438 |
children | e3afd1303184 |
comparison
equal
deleted
inserted
replaced
129:010eb8f0e18d | 130:60bb0fe4563e |
---|---|
8 import dmd.Scope; | 8 import dmd.Scope; |
9 import dmd.OutBuffer; | 9 import dmd.OutBuffer; |
10 import dmd.HdrGenState; | 10 import dmd.HdrGenState; |
11 import dmd.STC; | 11 import dmd.STC; |
12 import dmd.Id; | 12 import dmd.Id; |
13 import dmd.Argument; | 13 import dmd.Parameter; |
14 import dmd.ClassDeclaration; | 14 import dmd.ClassDeclaration; |
15 import dmd.TypeFunction; | 15 import dmd.TypeFunction; |
16 import dmd.Type; | 16 import dmd.Type; |
17 import dmd.LINK; | 17 import dmd.LINK; |
18 import dmd.TY; | 18 import dmd.TY; |
19 | 19 |
20 class DeleteDeclaration : FuncDeclaration | 20 class DeleteDeclaration : FuncDeclaration |
21 { | 21 { |
22 Arguments arguments; | 22 Parameters arguments; |
23 | 23 |
24 this(Loc loc, Loc endloc, Arguments arguments) | 24 this(Loc loc, Loc endloc, Parameters arguments) |
25 { | 25 { |
26 super(loc, endloc, Id.classDelete, STCstatic, null); | 26 super(loc, endloc, Id.classDelete, STCstatic, null); |
27 this.arguments = arguments; | 27 this.arguments = arguments; |
28 } | 28 } |
29 | 29 |
33 | 33 |
34 f = new DeleteDeclaration(loc, endloc, null); | 34 f = new DeleteDeclaration(loc, endloc, null); |
35 | 35 |
36 FuncDeclaration.syntaxCopy(f); | 36 FuncDeclaration.syntaxCopy(f); |
37 | 37 |
38 f.arguments = Argument.arraySyntaxCopy(arguments); | 38 f.arguments = Parameter.arraySyntaxCopy(arguments); |
39 | 39 |
40 return f; | 40 return f; |
41 } | 41 } |
42 | 42 |
43 override void semantic(Scope sc) | 43 override void semantic(Scope sc) |
58 type = type.semantic(loc, sc); | 58 type = type.semantic(loc, sc); |
59 assert(type.ty == Tfunction); | 59 assert(type.ty == Tfunction); |
60 | 60 |
61 // Check that there is only one argument of type void* | 61 // Check that there is only one argument of type void* |
62 TypeFunction tf = cast(TypeFunction)type; | 62 TypeFunction tf = cast(TypeFunction)type; |
63 if (Argument.dim(tf.parameters) != 1) | 63 if (Parameter.dim(tf.parameters) != 1) |
64 { | 64 { |
65 error("one argument of type void* expected"); | 65 error("one argument of type void* expected"); |
66 } | 66 } |
67 else | 67 else |
68 { | 68 { |
69 Argument a = Argument.getNth(tf.parameters, 0); | 69 auto a = Parameter.getNth(tf.parameters, 0); |
70 if (!a.type.equals(Type.tvoid.pointerTo())) | 70 if (!a.type.equals(Type.tvoid.pointerTo())) |
71 error("one argument of type void* expected, not %s", a.type.toChars()); | 71 error("one argument of type void* expected, not %s", a.type.toChars()); |
72 } | 72 } |
73 | 73 |
74 FuncDeclaration.semantic(sc); | 74 FuncDeclaration.semantic(sc); |
75 } | 75 } |
76 | 76 |
77 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) | 77 override void toCBuffer(OutBuffer buf, HdrGenState* hgs) |
78 { | 78 { |
79 buf.writestring("delete"); | 79 buf.writestring("delete"); |
80 Argument.argsToCBuffer(buf, hgs, arguments, 0); | 80 Parameter.argsToCBuffer(buf, hgs, arguments, 0); |
81 bodyToCBuffer(buf, hgs); | 81 bodyToCBuffer(buf, hgs); |
82 } | 82 } |
83 | 83 |
84 override string kind() | 84 override string kind() |
85 { | 85 { |