Changeset 18337 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Dec 19, 2006, 10:52:38 PM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/Parser.cpp
r14256 r18337 110 110 } 111 111 112 UString Parser::prettyPrint(const UString& code) 113 { 114 RefPtr<ProgramNode> progNode = parse(UString(), 0, code.data(), code.size()); 115 if (!progNode) 116 return 0; 117 118 return progNode->toString(); 112 119 } 120 121 } -
trunk/JavaScriptCore/kjs/Parser.h
r17372 r18337 49 49 int* sourceId = 0, int* errLine = 0, UString* errMsg = 0); 50 50 51 static UString prettyPrint(const UString&); 52 51 53 static void accept(PassRefPtr<ProgramNode>); 52 54 -
trunk/JavaScriptCore/kjs/testkjs.cpp
r17372 r18337 29 29 #include "JSLock.h" 30 30 #include "object.h" 31 #include "Parser.h" 31 32 32 33 #include <math.h> … … 211 212 { 212 213 bool success = true; 214 bool prettyPrint = false; 213 215 GlobalImp* global = new GlobalImp(); 214 216 … … 233 235 if (strcmp(fileName, "-f") == 0) // mozilla test driver script uses "-f" prefix for files 234 236 continue; 237 if (strcmp(fileName, "-p") == 0) { 238 prettyPrint = true; 239 continue; 240 } 235 241 236 242 char* script = createStringWithContentsOfFile(fileName); … … 240 246 } 241 247 242 Completion completion = interp->evaluate(fileName, 0, script); 243 success = success && completion.complType() != Throw; 248 if (prettyPrint) { 249 UString s = Parser::prettyPrint(script); 250 if (s.isNull()) { 251 success = false; 252 break; 253 } 254 255 printf("%s\n", s.UTF8String().c_str()); 256 257 } else { 258 Completion completion = interp->evaluate(fileName, 0, script); 259 success = success && completion.complType() != Throw; 260 } 261 244 262 free(script); 245 263 }
Note:
See TracChangeset
for help on using the changeset viewer.