Skip to content

Commit aabb7a6

Browse files
committed
Merge branch 'master' into add-more-string-methods
2 parents 9e1364f + 6268b92 commit aabb7a6

File tree

13 files changed

+503
-440
lines changed

13 files changed

+503
-440
lines changed

dist/asc.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/asc.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/assemblyscript.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/program.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1994,6 +1994,17 @@ export class Program extends DiagnosticEmitter {
19941994
case NodeKind.IDENTIFIER: {
19951995
return this.resolveIdentifier(<IdentifierExpression>expression, contextualFunction);
19961996
}
1997+
case NodeKind.LITERAL: {
1998+
switch ((<LiteralExpression>expression).literalKind) {
1999+
case LiteralKind.STRING: {
2000+
this.resolvedThisExpression = expression;
2001+
this.resolvedElementExpression = null;
2002+
return this.stringInstance;
2003+
}
2004+
// case LiteralKind.ARRAY: // TODO
2005+
}
2006+
break;
2007+
}
19972008
case NodeKind.PROPERTYACCESS: {
19982009
return this.resolvePropertyAccess(
19992010
<PropertyAccessExpression>expression,

std/assembly/string.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,9 @@ export class String {
113113

114114
@operator("==")
115115
private static __eq(left: String, right: String): bool {
116+
if (left === right) return true;
116117
if (left === null) return right === null;
117-
else if (right === null) return false;
118+
if (right === null) return false;
118119

119120
var leftLength = left.length;
120121
if (leftLength != right.length) return false;

tests/compiler/std/array-access.optimized.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
(call $abort
126126
(i32.const 0)
127127
(i32.const 8)
128-
(i32.const 234)
128+
(i32.const 235)
129129
(i32.const 4)
130130
)
131131
(unreachable)

tests/compiler/std/array-access.untouched.wat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@
195195
(call $abort
196196
(i32.const 0)
197197
(i32.const 8)
198-
(i32.const 234)
198+
(i32.const 235)
199199
(i32.const 4)
200200
)
201201
(unreachable)

0 commit comments

Comments
 (0)