Esempio n. 1
0
        /*
         * public DefinedVar(ScopeGroup scopeGroup, DefinedNode node, VarCollection varCollection)
         *  : base(node.VariableName, node.IsGlobal, varCollection.UseVar, node.UseIndex ?? varCollection.Assign(node.IsGlobal))
         * {
         *  if (scopeGroup.IsVar(node.VariableName))
         *      throw SyntaxErrorException.AlreadyDefined(node.VariableName, node.Range);
         *
         *  scopeGroup.In(this);
         * }
         */

        public DefinedVar(ScopeGroup scopeGroup, string name, bool isGlobal, Variable variable, int index, Range range)
            : base(name, isGlobal, variable, index)
        {
            if (scopeGroup.IsVar(name))
            {
                throw SyntaxErrorException.AlreadyDefined(name, range);
            }

            scopeGroup./* we're */ In(this) /* together! */;
        }
Esempio n. 2
0
 public void In(IScopeable var)
 {
     //if (!FullVarCollection().Any(v => var.Name == v.Name))
     if (IsAlreadyDefined(var.Name) && var.Node != null)
     {
         throw SyntaxErrorException.AlreadyDefined(var.Name, var.Node.Location);
     }
     else
     {
         InScope.Add(var);
     }
 }