Example #1
0
 /// <summary>
 /// Adds a variable to the variable list
 /// </summary>
 /// <param name="decl"></param>
 public void AddVariable(VariableDeclaration decl)
 {
     // Check if the same identifier was already declared as a variable
     foreach (VariableDeclaration var in variables)
     {
         if (decl.name == var.name)
         {
             // Issue error
             Compiler.Compiler.errors.SemErr(decl.t.line, decl.t.col, string.Format("Identifier redeclared '{0}'", decl.name));
         }
     }
     variables.Add(decl);
 }
Example #2
0
        /// <summary>
        /// Adds an argument to the argument list
        /// </summary>
        /// <param name="decl"></param>
        public void AddArgument(VariableDeclaration decl)
        {
            // Check if the same identifier was already declared as an argument
            foreach (VariableDeclaration arg in arguments)
            {
                if (decl.name == arg.name)
                {
                    // Issue error
                    Compiler.Compiler.errors.SemErr(decl.t.line, decl.t.col, string.Format("Identifier redeclared '{0}'", decl.name));
                }
            }

            arguments.Add(decl);
        }