Просмотр исходного кода

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

Franco Castellacci 9 лет назад
Родитель
Сommit
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.
     // 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.
+   
+    if (CONFIG_FLAG(TypeAnnotations) && lhs->typeHint != Js::TypeHint::Unknown)
+    {
+        funcInfo->GetParsedFunctionBody()->AddBytecodeOffsetTypeAnnotation(byteCodeGenerator->Writer()->GetCurrentOffset(), lhs->location, lhs->typeHint);
+    }
     switch (lhs->nop)
     {