Переглянути джерело

[MERGE #2514 @fcastellacci] Added support for type annotations before postfix operators like ++ and --

Merge pull request #2514 from fcastellacci:t-frca/type-annotations
Franco Castellacci 9 роки тому
батько
коміт
2e0e2e2649
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)
     {