Example #1
0
        public MethodBody(SourceCodePosition pos, List <VarDeclaration> v, StatementStatementList b)
            : base(pos)
        {
            this.Variables = v;
            this.Body      = b;

            if (Variables.Any(lp1 => Variables.Any(lp2 => lp1.Identifier.ToLower() == lp2.Identifier.ToLower() && lp1 != lp2)))
            {
                VarDeclaration err = Variables.Last(lp1 => Variables.Any(lp2 => lp1.Identifier.ToLower() == lp2.Identifier.ToLower()));
                throw new DuplicateIdentifierException(err.Position, err.Identifier);
            }
        }
Example #2
0
        public Method(SourceCodePosition pos, BType t, string id, List <VarDeclaration> p, List <VarDeclaration> v, StatementStatementList b)
            : base(pos)
        {
            this.ResultType = t;
            this.Identifier = id;
            this.Parameter  = p;

            this.Variables = v;
            this.Body      = b;

            Variables.AddRange(Parameter);
        }