Ejemplo n.º 1
0
        public sunConstantSymbol MustResolveConstant(sunIdentifier node)
        {
            var symbol = ResolveConstant(node);

            if (symbol == null)
            {
                throw new sunUndeclaredVariableException(node);
            }
            return(symbol);
        }
Ejemplo n.º 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);
        }
Ejemplo n.º 3
0
        public sunStorableSymbol ResolveStorable(sunIdentifier node)
        {
            var global = node.Value;
            var local  = MangleSymbolName(global, node.Location.ScriptId, false, true);
            var symbol = ResolveStorable(local);

            if (symbol != null)
            {
                return(symbol);
            }
            symbol = ResolveStorable(global);
            if (symbol != null)
            {
                return(symbol);
            }
            return(null);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
0
 public sunConstantSymbol ResolveConstant(sunIdentifier node)
 {
     return(ResolveStorable(node) as sunConstantSymbol);
 }
Ejemplo n.º 6
0
 public sunVariableSymbol ResolveVariable(sunIdentifier node)
 {
     return(ResolveStorable(node) as sunVariableSymbol);
 }