The StaDyn Programming Language
Source code documentation of StaDyn, a hybrid static and dynamic typing language.
IntersectionMemberType.cs
Go to the documentation of this file.
1 // -------------------------------------------------------------------------- //
3 // Project rROTOR //
4 // -------------------------------------------------------------------------- //
5 // File: FieldType.cs //
6 // Author: Francisco Ortin - francisco.ortin@gmail.com //
7 // Description: //
8 // Represents a field type. //
9 // Inheritance: MemberType. //
10 // Implements Composite pattern [Composite]. //
11 // -------------------------------------------------------------------------- //
12 // Create date: 04-04-2007 //
13 // Modification date: 04-04-2007 //
15 
16 //visto
17 using System;
18 using System.Collections.Generic;
19 using System.Text;
20 
21 using ErrorManagement;
22 using TypeSystem.Operations;
23 
24 namespace TypeSystem {
29 
30  #region Fields
31 
35  private AccessModifier memberInfo;
36  #endregion
37 
38 
39  #region Properties
40 
45  get { return this.memberInfo; }
46  set {
47  if (this.memberInfo == null) {
48  this.memberInfo = value;
49  }
50  else
51  ErrorManager.Instance.NotifyError(new ClassTypeInfoError(this.memberInfo.MemberIdentifier, this.memberInfo.Class.FullName, value.Class.FullName));
52  }
53  }
54  #endregion
55 
56  #region Constructors
57  public IntersectionMemberType(TypeExpression te) : base(te) { }
62 
63  #region AddMethod
64 
70 
71  public bool AddMethod(MethodType type) {
72  Predicate<TypeExpression> predicate = delegate(TypeExpression te2) {
73  return (bool)te2.AcceptOperation(new EqualsForOverloadOperation(type), null);
74  };
75  if (typeSet.Find(predicate) == null) {
76  this.typeSet.Add(type);
77  return true;
78  }
79  return false;
80  }
81  #endregion
82 
83  #endregion
84 
85  #region Dispatcher
86  public override object AcceptOperation(TypeSystemOperation op, object arg) { return op.Exec(this, arg); }
87  #endregion
88  }
89 }
Represents a error produced when a MethodType has class information and tries to assign other class i...
This class represent the entry wnen sending a message to an operation object derived from TypeExpress...
Implemeents a double dispatcher pattern Role:
string MemberIdentifier
Gets the attribute name
Abstract class that represents all different types.
List< TypeExpression > typeSet
Stores a set of type expression
Representa a method type.
Definition: MethodType.cs:37
override object AcceptOperation(TypeSystemOperation op, object arg)
AccessModifier MemberInfo
Gets or sets the attribute information of method type
bool AddMethod(MethodType type)
Adds a new method for overload.
Association Class between ClassType and MethodType (or Fields). Represents the access modifier inform...
A class that makes possible to have intersection types as class members (overload) ...
Representa an intersection type.
Representa a class attribute (fields or methods).
Definition: IMemberType.cs:32