diff options
author | Reza Ahmadi <reza.ahmadi@uta.fi> | 2014-12-03 12:44:41 +0200 |
---|---|---|
committer | Reza Ahmadi <reza.ahmadi@uta.fi> | 2014-12-03 12:44:41 +0200 |
commit | c5d7c43605d832cc64e16c66a2c830a880a3d3a2 (patch) | |
tree | 2a11e88fa879a224cadd9f488ffbd78b4c35b5d2 /Source/Dafny/Parser.cs | |
parent | fc43d9d56bdf3cae68bb15871f074149d1381c6a (diff) |
added multiple trait inheritance.
- a class can now extend more than one traits
Diffstat (limited to 'Source/Dafny/Parser.cs')
-rw-r--r-- | Source/Dafny/Parser.cs | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/Source/Dafny/Parser.cs b/Source/Dafny/Parser.cs index d30a3fd9..03eee802 100644 --- a/Source/Dafny/Parser.cs +++ b/Source/Dafny/Parser.cs @@ -558,7 +558,8 @@ bool IsNotEndOfCase() { Contract.Requires(module != null);
Contract.Ensures(Contract.ValueAtReturn(out c) != null);
IToken/*!*/ id;
- Type/*!*/ trait = null;
+ Type trait = null;
+ List<Type>/*!*/ traits = new List<Type>();
Attributes attrs = null;
List<TypeParameter/*!*/> typeArgs = new List<TypeParameter/*!*/>();
List<MemberDecl/*!*/> members = new List<MemberDecl/*!*/>();
@@ -576,6 +577,12 @@ bool IsNotEndOfCase() { if (la.kind == 44) {
Get();
Type(out trait);
+ traits.Add(trait);
+ while (la.kind == 9) {
+ Get();
+ Type(out trait);
+ traits.Add(trait);
+ }
}
Expect(25);
bodyStart = t;
@@ -583,7 +590,7 @@ bool IsNotEndOfCase() { ClassMemberDecl(members, true);
}
Expect(26);
- c = new ClassDecl(id, id.val, module, typeArgs, members, attrs, trait);
+ c = new ClassDecl(id, id.val, module, typeArgs, members, attrs, traits);
c.BodyStartTok = bodyStart;
c.BodyEndTok = t;
|