Exemple #1
0
 /// <summary>
 /// Construct from a procedural type
 /// </summary>
 public RoutineDefinition(string name, ProceduralType type,
                          RoutineDirectives dirs = null, RoutineSection body = null)
     : base(name, type)
 {
     this.Directives.Add(dirs);
     this.body = body;
 }
Exemple #2
0
 public MethodDefinition(string objname, string name, ParametersSection @params,
                         TypeNode ret    = null, RoutineDirectives dirs = null,
                         MethodKind kind = MethodKind.Default, RoutineSection body = null)
     : base(objname, name, @params, ret, dirs, kind)
 {
     this.body = body;
 }
Exemple #3
0
 public RoutineDefinition(string name, ParametersSection @params, TypeNode ret = null,
                          RoutineDirectives dirs = null, RoutineSection body = null)
     : base(name, @params, ret, dirs)
 {
     this.body = body;
     body.declaringCallable = this;
 }
Exemple #4
0
 /// <summary>
 /// Construct from a procedural type
 /// </summary>
 public RoutineDeclaration(string name, ProceduralType type)
     : base(name, type)
 {
     if (Directives == null)
     {
         Directives = new RoutineDirectives();
     }
 }
Exemple #5
0
 public RoutineDeclaration(string name, ParametersSection @params, TypeNode ret = null,
                           RoutineDirectives dirs = null)
     : base(name, @params, ret, dirs)
 {
     if (Directives == null)
     {
         Directives = new RoutineDirectives();
     }
 }
Exemple #6
0
        public override bool Equals(object o)
        {
            if (o == null || !(o is RoutineDirectives))
            {
                return(false);
            }
            RoutineDirectives rtype = (RoutineDirectives)o;

            return(Callconv == rtype.Callconv && generaldirs.SequenceEqual(rtype.generaldirs));
        }
Exemple #7
0
 public ProceduralType(ParametersSection @params, TypeNode ret = null, RoutineDirectives dirs = null)
 {
     this.@params = @params;
     this.funcret = ret;
     if (dirs != null)
     {
         Directives = dirs;
     }
     if (ret != null)
     {
         // TODO check and emit error if any parameter is named 'Result'
         @params.returnVar = new OutParamDeclaration("result", ret);
     }
 }
Exemple #8
0
 public virtual void Add(RoutineDirectives dirs)
 {
     if (dirs == null)
     {
         return;
     }
     if (dirs.Callconv != 0)
     {
         Callconv = dirs.Callconv;
     }
     foreach (GeneralDirective dir in dirs.generaldirs)
     {
         generaldirs.Add(dir);
     }
 }
Exemple #9
0
        public MethodDeclaration(string objname, string name, ParametersSection @params, TypeNode ret = null,
                                 RoutineDirectives dirs = null, MethodKind kind = MethodKind.Default)
            : base(name, new MethodType(@params, ret, dirs, kind))
        {
            this.objname = objname;
            isStatic     = false;
            fullname     = objname + "." + name;

            if (Directives == null)
            {
                Directives = new MethodDirectives();
            }

            foreach (var param in @params.decls)
            {
                if (param.name == "self")
                {
                    throw new IdentifierRedeclared("Method parameter cannot shadow 'self' reference");
                }
            }
        }
Exemple #10
0
 public MethodType(ParametersSection @params, TypeNode ret = null,
                   RoutineDirectives dirs = null, MethodKind kind = MethodKind.Default)
     : base(@params, ret, dirs)
 {
     this.kind = kind;
 }
Exemple #11
0
 public override void Add(RoutineDirectives dirs)
 {
     base.Add(dirs);
 }
Exemple #12
0
 public CallableDeclaration(string name, ParametersSection @params, TypeNode ret = null,
                            RoutineDirectives dirs = null)
     : base(name, new ProceduralType(@params, ret, dirs))
 {
 }