示例#1
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;
 }
示例#2
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;
 }
示例#3
0
 public RoutineDeclaration(string name, ParametersSection @params, TypeNode ret = null,
                           RoutineDirectives dirs = null)
     : base(name, @params, ret, dirs)
 {
     if (Directives == null)
     {
         Directives = new RoutineDirectives();
     }
 }
示例#4
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);
     }
 }
示例#5
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");
                }
            }
        }
示例#6
0
 public MethodType(ParametersSection @params, TypeNode ret = null,
                   RoutineDirectives dirs = null, MethodKind kind = MethodKind.Default)
     : base(@params, ret, dirs)
 {
     this.kind = kind;
 }
示例#7
0
 public CallableDeclaration(string name, ParametersSection @params, TypeNode ret = null,
                            RoutineDirectives dirs = null)
     : base(name, new ProceduralType(@params, ret, dirs))
 {
 }
示例#8
0
 public ExportItem(String name, ParametersSection pars, int index)
     : base(name)
 {
     this.formalparams = pars;
     this.index        = index;
 }
示例#9
0
 public ExportItem(String name, ParametersSection pars, String exportname = null)
     : base(name)
 {
     this.formalparams = pars;
     this.exportname   = exportname;
 }
示例#10
0
        public override bool Equals(object obj)
        {
            ParametersSection sec = obj as ParametersSection;

            return(sec != null && returnVar.Equals(sec.returnVar) && decls.SequenceEqual(sec.decls));
        }