예제 #1
0
 /// <summary>
 /// Initialize a new instance of the <see cref="ScriptClass"/> class using the specified parameters.
 /// </summary>
 /// <param name="name">The name of the class.</param>
 /// <param name="super">The super class.</param>
 /// <param name="constructor">The constructor of the class.</param>
 public ScriptClass(
     string name,
     ScriptClass super,
     ScriptConstructor constructor)
     : base(name, super)
 {
     Super             = super;
     FieldInitializers = new Dictionary <string, Expression>();
     Constructor       = constructor;
 }
예제 #2
0
        private void DeclareMember(Constructor member)
        {
            if (member.Modifier != Modifier.Public)
            {
                throw new RuntimeException(member.LinePragma,
                                           ExceptionResource.ConstructorMustBePublic);
            }
            if (member.IsStatic)
            {
                throw new RuntimeException(member.LinePragma,
                                           ExceptionResource.CannotBeStatic);
            }
            var con = new ScriptConstructor(Class, member.Parameters, member.Statements, Context);

            Class.Constructor = con;
        }