Exemplo n.º 1
0
 public void Visit(ValueExpression expression)
 {
     switch (expression.TypeCode) {
         case TypeCode.Boolean: Result = Global.BooleanClass.New((bool)expression.Value); break;
         case TypeCode.Int32:
         case TypeCode.Single:
         case TypeCode.Double: Result = Global.NumberClass.New(Convert.ToDouble(expression.Value)); break;
         case TypeCode.String: Result = Global.StringClass.New((string)expression.Value); break;
         default: Result = expression.Value as JsInstance;
             break;
     }
 }
Exemplo n.º 2
0
		public void Visit(ValueExpression expression)
		{
			Builder.Append(expression.Value);
		}
Exemplo n.º 3
0
 void Analyze(ValueExpression Stmt)
 {
     SetCurrentLineAndCharNos(Stmt);
     if (JintStack.Count == 0)
     {
         if (Stmt.TypeCode == TypeCode.String)
             AddToJintStack(Stmt.Source, JintState.StringValue, Stmt.Value.ToString());
         else
             AddToJintStack(Stmt.Source, JintState.NonStringValue, Stmt.Value.ToString());
         return;
     }
     JintItem LastItem = JintStack[JintStack.Count - 1];
     switch (LastItem.State)
     {
         case (JintState.Indexer):
             if(Stmt.TypeCode == TypeCode.String)
                 AddToJintStack(Stmt.Source, JintState.StringValue, Stmt.Value.ToString());
             else
                 AddToJintStack(Stmt.Source, JintState.IntValue, Stmt.Value.ToString());
             break;
         default:
             AddToJintStack(Stmt.Source, JintState.StringValue, Stmt.Value.ToString());
             break;
     }
     if (TraceKeyword)
     {
         List<string> Contexts = GetContext(RawLines[CurrentLineNo - 1], Stmt.Value.ToString());
         if (Contexts.Count == 0 && Stmt.Value.ToString().IndexOf(KeywordToTrace) >= 0)
         {
             if(Stmt.TypeCode == TypeCode.String)
                 KeywordContexts.Add("StringValue");
             else
                 KeywordContexts.Add("NonStringValue");
         }
         KeywordContexts.AddRange(Contexts);
     }
     //Analyzer.CheckIdentifier(Stmt.Value.ToString());
 }