]> git.saurik.com Git - cycript.git/blobdiff - Console.cpp
Optimized the variable renamer to rename more variables to 'a'.
[cycript.git] / Console.cpp
index 1ba72eaea2d9a4dee2c887cfd779269a0da8158f..65eeb4f08a472db52db8c1d62601b2dcc35c2957 100644 (file)
 
 #include "cycript.hpp"
 
+#ifdef CY_EXECUTE
+#include "JavaScript.hpp"
+#endif
+
 #include <cstdio>
 #include <sstream>
 
@@ -111,7 +115,8 @@ void Setup(CYDriver &driver, cy::parser &parser) {
 void Setup(CYOutput &out, CYDriver &driver) {
     out.pretty_ = pretty_;
 
-    CYContext context(driver.pool_);
+    CYOptions options;
+    CYContext context(driver.pool_, options);
     driver.program_->Replace(context);
 }
 
@@ -320,7 +325,8 @@ static void Console(apr_pool_t *pool, int client) {
                 code = command;
             else {
                 std::ostringstream str;
-                CYOutput out(str);
+                CYOptions options;
+                CYOutput out(str, options);
                 Setup(out, driver);
                 out << *driver.program_;
                 code = str.str();
@@ -332,7 +338,6 @@ static void Console(apr_pool_t *pool, int client) {
 
         if (debug)
             std::cout << code << std::endl;
-        code = "with(Cycript.all){" + code + "}";
 
         Run(client, code, fout, expand);
     }
@@ -600,20 +605,18 @@ int Main(int argc, char const * const argv[], char const * const envp[]) {
         } else if (driver.program_ != NULL)
             if (client != -1) {
                 std::string code(start, end-start);
-                code = "with(Cycript.all){" + code + "}";
-                Run(client, start, end - start, stdout);
+                Run(client, code, stdout);
             } else {
                 std::ostringstream str;
-                CYOutput out(str);
+                CYOptions options;
+                CYOutput out(str, options);
                 Setup(out, driver);
                 out << *driver.program_;
                 std::string code(str.str());
                 if (compile)
                     std::cout << code;
-                else {
-                    code = "with(Cycript.all){" + code + "}";
+                else
                     Run(client, code, stdout);
-                }
             }
     }