示例#1
0
文件: context.cs 项目: RenolY2/ssc
        public sunConstantSymbol MustResolveConstant(sunIdentifier node)
        {
            var symbol = ResolveConstant(node);

            if (symbol == null)
            {
                throw new sunUndeclaredVariableException(node);
            }
            return(symbol);
        }
示例#2
0
文件: context.cs 项目: RenolY2/ssc
        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);
        }
示例#3
0
文件: context.cs 项目: RenolY2/ssc
        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);
        }
示例#4
0
文件: context.cs 项目: RenolY2/ssc
        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);
        }
示例#5
0
文件: context.cs 项目: RenolY2/ssc
 public sunConstantSymbol ResolveConstant(sunIdentifier node)
 {
     return(ResolveStorable(node) as sunConstantSymbol);
 }
示例#6
0
文件: context.cs 项目: RenolY2/ssc
 public sunVariableSymbol ResolveVariable(sunIdentifier node)
 {
     return(ResolveStorable(node) as sunVariableSymbol);
 }