Skip to content

Commit

Permalink
stack optimisation, bytecode header, debug binary
Browse files Browse the repository at this point in the history
  • Loading branch information
marcj committed Jun 15, 2022
1 parent a9730b7 commit 3cee56f
Show file tree
Hide file tree
Showing 8 changed files with 439 additions and 242 deletions.
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ add_subdirectory(tests)
add_library(typescript utf.h utf.cpp core.h core.cpp utilities.h utilities.cpp node_test.h node_test.cpp
syntax_cursor.h syntax_cursor.cpp parser2.h parser2.cpp types.h types.cpp path.h path.cpp
factory.h factory.cpp parenthesizer.h parenthesizer.cpp scanner.h scanner.cpp
checker/vm.h checker/vm.cpp checker/instructions.h checker/compiler.h checker/type_objects.h checker/utils.h checker/checks.h)
checker/vm.h checker/vm.cpp checker/instructions.h checker/compiler.h checker/type_objects.h checker/utils.h checker/checks.h checker/debug.h)
# ${CMAKE_CURRENT_SOURCE_DIR}/../libs/tracy/TracyClient.cpp

target_link_libraries(typescript fmt)
8 changes: 4 additions & 4 deletions src/checker/checks.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ namespace ts::vm {
if (left->kind == TypeKind::Literal) return to<TypeLiteral>(left)->type == TypeLiteralType::Number;
}

if (left->kind == TypeKind::Literal && left->kind == TypeKind::Literal) {
return to<TypeLiteral>(left)->type == to<TypeLiteral>(left)->type &&
to<TypeLiteral>(right)->text() == to<TypeLiteral>(left)->text();
if (left->kind == TypeKind::Literal && right->kind == TypeKind::Literal) {
return to<TypeLiteral>(left)->type == to<TypeLiteral>(right)->type &&
to<TypeLiteral>(left)->text() == to<TypeLiteral>(right)->text();
}

if (right->kind == TypeKind::Tuple && left->kind == TypeKind::Tuple) {
Expand All @@ -43,7 +43,7 @@ namespace ts::vm {
if (right->kind == TypeKind::Union) {
if (left->kind != TypeKind::Union) {
for (auto &&l: to<TypeUnion>(right)->types) {
if (isExtendable(l, left)) return true;
if (isExtendable(left, l)) return true;
}
return false;
} else {
Expand Down
Loading

0 comments on commit 3cee56f

Please sign in to comment.