| Index: frog/frogsh
|
| diff --git a/frog/frogsh b/frog/frogsh
|
| index a119fe0f7441944aceb9b74ce58e37caa6ac79d1..e594c48ddb3d29799b05db4db7da8fde347f7430 100755
|
| --- a/frog/frogsh
|
| +++ b/frog/frogsh
|
| @@ -13940,7 +13940,20 @@ MethodGenerator.prototype.visitBinaryExpression = function(node) {
|
| var x = this.visitValue(node.x);
|
| var y = this.visitValue(node.y);
|
| if ($notnull_bool(x.get$isConst()) && $notnull_bool(y.get$isConst())) {
|
| - var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(x.get$actualValue(), y.get$actualValue()) : $ne(x.get$actualValue(), y.get$actualValue());
|
| + var xVal = x.get$actualValue();
|
| + var yVal = y.get$actualValue();
|
| + if ($notnull_bool(x.get$type().get$isString()) && $notnull_bool(y.get$type().get$isString()) && $notnull_bool($ne(xVal.$index(0), yVal.$index(0)))) {
|
| + if ($notnull_bool($eq(xVal.$index(0), '"'))) {
|
| + xVal = xVal.substring$2(1, xVal.length - 1);
|
| + yVal = toDoubleQuote($assert_String(yVal.substring$2(1, yVal.length - 1)));
|
| + }
|
| + else {
|
| + xVal = toDoubleQuote($assert_String(xVal.substring$2(1, xVal.length - 1)));
|
| + yVal = yVal.substring$2(1, yVal.length - 1);
|
| + }
|
| + }
|
| + print(("" + xVal + " vs " + yVal));
|
| + var value = kind == 50/*TokenKind.EQ_STRICT*/ ? $eq(xVal, yVal) : $ne(xVal, yVal);
|
| return EvaluatedValue.EvaluatedValue$factory($globals.world.nonNullBool, value, ("" + value), node.span);
|
| }
|
| if ($notnull_bool($eq(x.get$code(), 'null')) || $notnull_bool($eq(y.get$code(), 'null'))) {
|
| @@ -14336,7 +14349,7 @@ MethodGenerator.prototype._isUnaryIncrement = function(item) {
|
| MethodGenerator.prototype.visitLiteralExpression = function(node) {
|
| var $0;
|
| var type = node.type.type;
|
| - $assert($ne(type, null), "type != null", "gen.dart", 2250, 12);
|
| + $assert($ne(type, null), "type != null", "gen.dart", 2265, 12);
|
| if (!!(($0 = node.value) && $0.is$List)) {
|
| var items = [];
|
| var $list = node.value;
|
| @@ -14363,7 +14376,7 @@ MethodGenerator.prototype.visitLiteralExpression = function(node) {
|
| else if ($notnull_bool(isMultilineString($assert_String(text)))) {
|
| text = parseStringLiteral($assert_String(text));
|
| text = text.replaceAll$2('\n', '\\n');
|
| - text = text.replaceAll$2('"', '\\"');
|
| + text = toDoubleQuote($assert_String(text));
|
| text = ('"' + text + '"');
|
| }
|
| if (text !== node.text) {
|
| @@ -16183,13 +16196,26 @@ MethodMember.prototype._invokeBuiltin = function(context, node, target, args, ar
|
| else if (this.name == '\$add') {
|
| if ($notnull_bool(allConst)) {
|
| var val0 = target.get$dynamic().get$actualValue();
|
| + var quote0 = val0.$index(0);
|
| val0 = val0.substring$2(1, val0.length - 1);
|
| var val1 = args.values.$index(0).get$dynamic().get$actualValue();
|
| + var quote1 = null;
|
| if ($notnull_bool(args.values.$index(0).get$type().get$isString())) {
|
| + quote1 = val1.$index(0);
|
| val1 = val1.substring$2(1, val1.length - 1);
|
| }
|
| - var value = ('' + val0 + val1);
|
| - value = '"' + value.replaceAll$2('"', '\\"') + '"';
|
| + var value;
|
| + if ($notnull_bool($eq(quote0, quote1)) || $notnull_bool(quote1 == null)) {
|
| + value = ('' + quote0 + val0 + val1 + quote0);
|
| + }
|
| + else if ($notnull_bool($eq(quote0, '"'))) {
|
| + $assert($eq(quote1, "'"), "quote1 == \"'\"", "member.dart", 1197, 20);
|
| + value = ('' + quote0 + val0 + toDoubleQuote($assert_String(val1)) + quote0);
|
| + }
|
| + else {
|
| + $assert($eq(quote1, '"'), "quote1 == '\"'", "member.dart", 1200, 20);
|
| + value = ('' + quote1 + toDoubleQuote($assert_String(val0)) + val1 + quote1);
|
| + }
|
| return EvaluatedValue.EvaluatedValue$factory($globals.world.stringType, value, $assert_String(value), node.span);
|
| }
|
| return new Value(this.declaringType, ('' + target.code + ' + ' + argsCode.$index(0)), node.span, true);
|
| @@ -23621,6 +23647,9 @@ function isMultilineString(text) {
|
| function isRawMultilineString(text) {
|
| return text.startsWith('@"""') || text.startsWith("@'''");
|
| }
|
| +function toDoubleQuote(s) {
|
| + return s.replaceAll('"', '\\"').replaceAll("\\'", "'");
|
| +}
|
| function parseStringLiteral(lit) {
|
| if (lit.startsWith('@')) {
|
| if ($notnull_bool(isRawMultilineString(lit))) {
|
|
|