Mercurial > projects > ddmd
comparison dmd/NewDeclaration.d @ 179:cd48cb899aee
Updated to dmd2.040
author | korDen |
---|---|
date | Sun, 17 Oct 2010 20:56:07 +0400 |
parents | e3afd1303184 |
children | b0d41ff5e0df |
comparison
equal
deleted
inserted
replaced
178:e3afd1303184 | 179:cd48cb899aee |
---|---|
43 return f; | 43 return f; |
44 } | 44 } |
45 | 45 |
46 override void semantic(Scope sc) | 46 override void semantic(Scope sc) |
47 { | 47 { |
48 ClassDeclaration cd; | |
49 Type tret; | |
50 | |
51 //printf("NewDeclaration.semantic()\n"); | 48 //printf("NewDeclaration.semantic()\n"); |
52 | 49 |
53 parent = sc.parent; | 50 parent = sc.parent; |
54 Dsymbol parent = toParent(); | 51 Dsymbol parent = toParent(); |
55 cd = parent.isClassDeclaration(); | 52 ClassDeclaration cd = parent.isClassDeclaration(); |
56 if (!cd && !parent.isStructDeclaration()) | 53 if (!cd && !parent.isStructDeclaration()) |
57 { | 54 { |
58 error("new allocators only are for class or struct definitions"); | 55 error("new allocators only are for class or struct definitions"); |
59 } | 56 } |
60 tret = Type.tvoid.pointerTo(); | 57 Type tret = Type.tvoid.pointerTo(); |
61 type = new TypeFunction(arguments, tret, varargs, LINKd); | 58 if (!type) |
59 type = new TypeFunction(arguments, tret, varargs, LINKd); | |
62 | 60 |
63 type = type.semantic(loc, sc); | 61 type = type.semantic(loc, sc); |
64 assert(type.ty == Tfunction); | 62 assert(type.ty == Tfunction); |
65 | 63 |
66 // Check that there is at least one argument of type size_t | 64 // Check that there is at least one argument of type size_t |