Skip to content

Commit

Permalink
Merge pull request #6027 from hieupham007/timob-17613-3_4_X
Browse files Browse the repository at this point in the history
[TIMOB-17613]: Revert TIMOB-10837
  • Loading branch information
ingo committed Sep 7, 2014
2 parents 9949832 + 208c8fb commit 474625a
Showing 1 changed file with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
import java.util.Stack;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import org.appcelerator.kroll.KrollDict;
import org.appcelerator.kroll.KrollEventCallback;
Expand Down Expand Up @@ -148,18 +146,8 @@ synchronized public String getJSValue(String expression)
{
// Don't try to evaluate js code again if the binding has already been destroyed
if (!destroyed) {
// see if this is an expression or a statement block
// Match ; followed by 0 or even quotes
Pattern pattern = Pattern.compile(";(?=([^\"]*\"[^\"]*\")*[^\"]*$)");
Matcher matcher = pattern.matcher(expression);
if (matcher.find()) {
String lastStmt = expression.substring(matcher.end(matcher.groupCount() - 1));
String stmtBlock = expression.substring(0, matcher.end(matcher.groupCount() - 1));
expression = stmtBlock + " return " + lastStmt;
} else {
expression = " return " + expression;
}
String code = "_TiReturn.setValue((function(){try{" + expression + "+\"\";}catch(ti_eval_err){return '';}})());";
String code = "_TiReturn.setValue((function(){try{return " + expression
+ "+\"\";}catch(ti_eval_err){return '';}})());";
Log.d(TAG, "getJSValue:" + code, Log.DEBUG_MODE);
returnSemaphore.drainPermits();
synchronized (codeSnippets) {
Expand Down

0 comments on commit 474625a

Please sign in to comment.