فهرست منبع

Added support for type annotations before postfix operators like ++ and --

Franco Castellacci 9 سال پیش
والد
کامیت
9d7dd8fc4d
1فایلهای تغییر یافته به همراه5 افزوده شده و 0 حذف شده
  1. 5 0
      lib/Runtime/ByteCode/ByteCodeEmitter.cpp

+ 5 - 0
lib/Runtime/ByteCode/ByteCodeEmitter.cpp

@@ -7056,6 +7056,11 @@ void EmitLoad(
     // in the process.
     // in the process.
     // We usually get here as part of an op-equiv expression: x.y += z;
     // We usually get here as part of an op-equiv expression: x.y += z;
     // In such a case, x has to be emitted first, then the value of x.y loaded (by this function), then z emitted.
     // In such a case, x has to be emitted first, then the value of x.y loaded (by this function), then z emitted.
+   
+    if (CONFIG_FLAG(TypeAnnotations) && lhs->typeHint != Js::TypeHint::Unknown)
+    {
+        funcInfo->GetParsedFunctionBody()->AddBytecodeOffsetTypeAnnotation(byteCodeGenerator->Writer()->GetCurrentOffset(), lhs->location, lhs->typeHint);
+    }
     switch (lhs->nop)
     switch (lhs->nop)
     {
     {