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/Dafny.atg | |
parent | fc43d9d56bdf3cae68bb15871f074149d1381c6a (diff) |
added multiple trait inheritance.
- a class can now extend more than one traits
Diffstat (limited to 'Source/Dafny/Dafny.atg')
-rw-r--r-- | Source/Dafny/Dafny.atg | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/Source/Dafny/Dafny.atg b/Source/Dafny/Dafny.atg index b59c586a..137c6215 100644 --- a/Source/Dafny/Dafny.atg +++ b/Source/Dafny/Dafny.atg @@ -447,7 +447,8 @@ ClassDecl<ModuleDefinition/*!*/ module, out ClassDecl/*!*/ c> = (. 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/*!*/>();
@@ -458,12 +459,15 @@ ClassDecl<ModuleDefinition/*!*/ module, out ClassDecl/*!*/ c> { Attribute<ref attrs> }
NoUSIdent<out id>
[ GenericParameters<typeArgs> ]
- ["extends" Type<out trait>]
+ ["extends"
+ Type<out trait> (. traits.Add(trait); .)
+ {"," Type<out trait> (. traits.Add(trait); .) }
+ ]
"{" (. bodyStart = t; .)
{ ClassMemberDecl<members, true>
}
"}"
- (. 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;
.)
|