Пример #1
0
        sunVariableSymbol DeclareVariable(sunIdentifier node, sunSymbolModifiers modifiers)
        {
            var local  = (modifiers & sunSymbolModifiers.Local) != 0;
            var name   = MangleSymbolName(node.Value, node.Location.ScriptId, false, local);
            var symbol = Scopes.DeclareVariable(name);

            if (symbol == null)
            {
                throw new sunRedeclaredVariableException(node);
            }
#if SSC_SCOPES
            if (Scopes.Top.Type == sunScopeType.Script)
            {
#else
            if (Scopes.Count == 1)
            {
#endif
                SymbolTable.Add(symbol);
            }
            return(symbol);
        }
Пример #2
0
        sunConstantSymbol DeclareConstant(sunIdentifier node, sunExpression expression, sunSymbolModifiers modifiers)
        {
            var local  = (modifiers & sunSymbolModifiers.Local) != 0;
            var name   = MangleSymbolName(node.Value, node.Location.ScriptId, false, local);
            var symbol = Scopes.DeclareConstant(name, expression);

            if (symbol == null)
            {
                throw new sunRedeclaredVariableException(node);
            }
            return(symbol);
        }