comparison trunk/src/dil/Types.d @ 495:b60450804b6e

Attributes are evaluated during the parsing phase now. Renamed parseDeclarationDefinitionsBlock to parseDeclarationDefinitionsBody. Renamed parseDeclaration to parseVariableOrFunction. Removed class Linkage, renamed parseLinkage to parseLinkageType and modified it so that it returns a value from enum LinkageType. Fix in parseStorageAttribute(): class invariants are recognized now. Modified parseAlignAttribute() so that returns an uint - the alignment size. Removed classes AttributeStatement and ExternStatement. Using Declarations instead in parseAttributeStatement(). Added LinkageType to module Enums. Added StorageClassDeclaration and renamed ExternDeclaration to LinkageDeclaration.
author Aziz K?ksal <aziz.koeksal@gmail.com>
date Sat, 08 Dec 2007 22:20:34 +0100
parents 9c208925a3d4
children 3bb94ba21490
comparison
equal deleted inserted replaced
494:9a7ca8c56e59 495:b60450804b6e
5 module dil.Types; 5 module dil.Types;
6 import dil.SyntaxTree; 6 import dil.SyntaxTree;
7 import dil.Token; 7 import dil.Token;
8 import dil.Expressions; 8 import dil.Expressions;
9 import dil.Enums; 9 import dil.Enums;
10
11 class Linkage : Node
12 {
13 enum Type
14 {
15 Extern,
16 C,
17 Cpp,
18 D,
19 Windows,
20 Pascal,
21 System
22 }
23
24 /++
25 This enum is used by the parser to find redundant
26 or conflicting extern attribute declarations.
27 +/
28 enum Category
29 {
30 Unset,
31 ExternSymbol = 1<<1, /// Extern
32 MangleSymbol = 1<<2 /// C, Cpp, D, Windows, Pascal, System
33 }
34
35 Linkage.Type type;
36
37 this(typeof(type) type)
38 {
39 super(NodeCategory.Other);
40 mixin(set_kind);
41 this.type = type;
42 }
43
44 static Category getCategory(Linkage linkage)
45 {
46 if (linkage is null)
47 return Category.ExternSymbol;
48 else
49 return Category.MangleSymbol;
50 }
51 }
52 10
53 class Parameter : Node 11 class Parameter : Node
54 { 12 {
55 StorageClass stc; 13 StorageClass stc;
56 Token* stcTok; 14 Token* stcTok;