|
68 | 68 |
|
69 | 69 | #define DISABLE_SCRIPT_CACHE |
70 | 70 |
|
71 | | -#define OSR_COMPILER_VERSION 1 |
72 | | - |
73 | 71 | namespace scripts { |
74 | 72 | extern void RegisterEarlyNetworkBinds(asIScriptEngine* engine); |
75 | 73 |
|
@@ -414,7 +412,9 @@ void parseFile(Manager* man, File& fl, const std::string& filename, bool cacheFi |
414 | 412 |
|
415 | 413 |
|
416 | 414 | for(auto iLine = lines.begin(), end = lines.end(); iLine != end; ++iLine) { |
417 | | - const std::string& line = *iLine; |
| 415 | + const std::string& originalLine = *iLine; |
| 416 | + // I'm not actually sure if this amounts to a meaningful optimization... or any optimization. |
| 417 | + std:string& line = originalLine; |
418 | 418 |
|
419 | 419 | auto lineStart = line.find_first_not_of(" \t"); |
420 | 420 | if(lineStart == std::string::npos) { |
@@ -488,12 +488,26 @@ void parseFile(Manager* man, File& fl, const std::string& filename, bool cacheFi |
488 | 488 |
|
489 | 489 | // TODO: Figure out something a little better-optimized than always running |
490 | 490 | // three regexes on every line of code? |
| 491 | + // On the bright side, we're only running them if we're in the right section... |
491 | 492 | if(reg_match(line, match, pre_osr_single_line)) { |
492 | 493 | const std::string prefix = reg_str(line, match, 1); |
493 | 494 | const std::string postfix = reg_str(line, match, 4); |
494 | | - // TODO: Actually evaluate this bit here. The goal is to replace line with prefix+postfix if the spec matches. |
495 | 495 | if(matchesCompilerVersion(reg_str(line, match, 2), reg_str(line, match, 3))) { |
496 | | - |
| 496 | + line = prefix + postfix; |
| 497 | + } |
| 498 | + } |
| 499 | + if(reg_match(line, match, pre_osr_multi_open)) { |
| 500 | + const std::string prefix = reg_str(line, match, 1); |
| 501 | + const std::string postfix = reg_str(line, match, 4); |
| 502 | + if(matchesCompilerVersion(reg_str(line, match, 2), reg_str(line, match, 3))) { |
| 503 | + line = prefix + postfix; |
| 504 | + } |
| 505 | + } |
| 506 | + if(reg_match(line, match, pre_osr_multi_close)) { |
| 507 | + const std::string prefix = reg_str(line, match, 1); |
| 508 | + const std::string postfix = reg_str(line, match, 4); |
| 509 | + if(matchesCompilerVersion(reg_str(line, match, 2), reg_str(line, match, 3))) { |
| 510 | + line = prefix + postfix; |
497 | 511 | } |
498 | 512 | } |
499 | 513 |
|
|
0 commit comments