Skip to content

Commit f38dcf7

Browse files
Progress of development (#150)
* fix for vscode template * adding code for installing built folder * progress of implementing installation default lib logic * fixes to default lib install process * update * added checks for file presence * progress of implementing install for default lib * update compile for linux * update build script for linux * update launch.json file * update launch.json * updated launch.json * fixed issue with not detecting error in call statements * added more to d.ts file * progress of testing * progress of implementing boxing/unboxing * progress of implementing unboxing * reworked unbox * fix for typeof * some fixes * more fixes to unboxing * fixes to unboxing * fixed issue with box cast * added boxing/unboxing class test * updated test * updating test * update any test * refactoring unboxing * update after testing * removing embeded type Array * removed reference to Array type * more fixes to Array type * some fixes * more fixes * fixed issue with using spread in generic calls * update * updated test for typed arrays * fixes * rrefactored type alias to reduce compilcation time * update build script * fixes * added sourceFile to generic objects * improved code * fixed issue with incorrect filename in errors
1 parent 719a444 commit f38dcf7

29 files changed

+769
-156
lines changed

tag.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
git tag -a v0.0-pre-alpha63 -m "pre alpha v0.0-63"
1+
git tag -a v0.0-pre-alpha64 -m "pre alpha v0.0-64"
22
git push origin --tags

tag_del.bat

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
git push --delete origin v0.0-pre-alpha63
2-
git tag -d v0.0-pre-alpha63
1+
git push --delete origin v0.0-pre-alpha64
2+
git tag -d v0.0-pre-alpha64

tsc/include/TypeScript/Config.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@
5151
//#define ENABLE_DEBUGINFO_PATCH_INFO true
5252

5353
#define ENABLE_JS_BUILTIN_TYPES true
54-
#define ENABLE_JS_TYPEDARRAYS true
55-
#define ENABLE_JS_TYPEDARRAYS_NOBUILTINS true
54+
//#define ENABLE_JS_TYPEDARRAYS true
55+
//#define ENABLE_JS_TYPEDARRAYS_NOBUILTINS true
5656
#define ENABLE_NATIVE_TYPES true
5757
#define NO_DEFAULT_LIB true
5858

tsc/include/TypeScript/LowerToLLVM/CastLogicHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1024,6 +1024,7 @@ class CastLogicHelper
10241024
return boxedValue;
10251025
}
10261026

1027+
// TODO: should be casted from MLIRGen
10271028
mlir::Value castFromAny(mlir::Value in, mlir::Type resType)
10281029
{
10291030
LLVM_DEBUG(llvm::dbgs() << "\n!! cast from any: " << in << " to " << resType << "\n";);

tsc/include/TypeScript/LowerToLLVM/TypeOfOpHelper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ class TypeOfOpHelper
3636
if (type.isIntOrIndex() && !type.isIndex())
3737
{
3838
std::stringstream val;
39-
val << "i" << type.getIntOrFloatBitWidth();
39+
val << (type.isSignlessInteger() ? "i" : type.isSignedInteger() ? "s" : "u")
40+
<< type.getIntOrFloatBitWidth();
4041
auto typeOfValue = strValue(loc, val.str());
4142
return typeOfValue;
4243
}

tsc/include/TypeScript/MLIRLogic/MLIRGenStore.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ struct GenericFunctionInfo
3434

3535
llvm::StringMap<std::pair<TypeParameterDOM::TypePtr, mlir::Type>> typeParamsWithArgs;
3636

37+
SourceFile sourceFile;
38+
StringRef fileName;
39+
3740
bool processing;
3841
bool processed;
3942

@@ -540,6 +543,9 @@ struct GenericInterfaceInfo
540543

541544
InterfaceDeclaration interfaceDeclaration;
542545

546+
SourceFile sourceFile;
547+
StringRef fileName;
548+
543549
GenericInterfaceInfo()
544550
{
545551
}
@@ -555,12 +561,16 @@ struct ImplementInfo
555561
enum class ProcessingStages : int {
556562
NotSet = 0,
557563
ErrorInStorageClass = 1,
558-
Processing = 2,
559-
ProcessingStorageClass = 3,
560-
ProcessedStorageClass = 4,
561-
ProcessingBody = 5,
562-
ProcessedBody = 6,
563-
Processed = 7,
564+
ErrorInMembers = 2,
565+
ErrorInBaseInterfaces = 3,
566+
ErrorInHeritageClauseImplements = 4,
567+
ErrorInVTable = 5,
568+
Processing = 6,
569+
ProcessingStorageClass = 7,
570+
ProcessedStorageClass = 8,
571+
ProcessingBody = 9,
572+
ProcessedBody = 10,
573+
Processed = 11,
564574
};
565575

566576
struct EnumInfo
@@ -949,6 +959,9 @@ struct GenericClassInfo
949959

950960
ClassLikeDeclaration classDeclaration;
951961

962+
SourceFile sourceFile;
963+
StringRef fileName;
964+
952965
GenericClassInfo()
953966
{
954967
}
@@ -977,7 +990,7 @@ struct NamespaceInfo
977990

978991
llvm::StringMap<llvm::SmallVector<mlir::typescript::FieldInfo>> localVarsInThisContextMap;
979992

980-
llvm::StringMap<mlir::Type> typeAliasMap;
993+
llvm::StringMap<std::pair<mlir::Type, TypeNode>> typeAliasMap;
981994

982995
llvm::StringMap<std::pair<llvm::SmallVector<TypeParameterDOM::TypePtr>, TypeNode>> genericTypeAliasMap;
983996

tsc/include/TypeScript/MLIRLogic/MLIRPrinter.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,9 @@ class MLIRPrinter
351351
.template Case<mlir_ts::NullType>([&](auto) {
352352
out << "null";
353353
})
354+
.template Case<mlir_ts::BigIntType>([&](auto) {
355+
out << "bigint";
356+
})
354357
.template Case<mlir_ts::NamespaceType>([&](auto t) {
355358
out << t.getName().getValue().str().c_str();
356359
})

tsc/include/TypeScript/MLIRLogic/MLIRTypeHelper.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,13 @@ class MLIRTypeHelper
255255
}
256256
else if (typeIn.isIntOrIndex())
257257
{
258-
return mlir::StringAttr::get(context, std::string("i") + std::to_string(typeIn.getIntOrFloatBitWidth()));
258+
return mlir::StringAttr::get(
259+
context,
260+
std::string((typeIn.isSignlessInteger()
261+
? "i"
262+
: typeIn.isSignedInteger()
263+
? "s"
264+
: "u")) + std::to_string(typeIn.getIntOrFloatBitWidth()));
259265
}
260266
else if (typeIn.isIntOrFloat())
261267
{

tsc/include/TypeScript/MLIRLogic/MLIRTypeIterator.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,6 +384,9 @@ class MLIRTypeIterator
384384
.Case<mlir_ts::NullType>([&](auto) {
385385
return true;
386386
})
387+
.Case<mlir_ts::BigIntType>([&](auto) {
388+
return true;
389+
})
387390
.Case<mlir::NoneType>([&](auto) {
388391
return true;
389392
})

tsc/include/TypeScript/MLIRLogic/TypeOfOpHelper.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class TypeOfOpHelper
3737
if (type.isIntOrIndex() && !type.isIndex())
3838
{
3939
std::stringstream val;
40-
val << "i" << type.getIntOrFloatBitWidth();
40+
val << (type.isSignlessInteger() ? "i" : type.isSignedInteger() ? "s" : "u") << type.getIntOrFloatBitWidth();
4141
auto typeOfValue = strValue(loc, val.str());
4242
return typeOfValue;
4343
}

0 commit comments

Comments
 (0)