Пример #1
0
void CompilerLogic :: injectNewOperation(SNode node, _CompilerScope& scope, int operation, ref_t elementType, ref_t targetRef)
{
   SNode operationNode = node.injectNode((LexicalType)operation, targetRef);

   int size = defineStructSize(scope, targetRef, elementType, false);
   if (size != 0)
      operationNode.appendNode(lxSize, size);
}
Пример #2
0
void CompilerLogic :: injectOperation(SNode node, _CompilerScope& scope, _Compiler& compiler, int operator_id, int operationType, ref_t& reference, ref_t type)
{
   int size = 0;
   if (operationType == lxBinArrOp) {
      // HOTFIX : define an item size for the binary array operations
      size = -defineStructSize(scope, V_BINARYARRAY, type);
   }

   if (reference == V_BINARY && type != 0) {
      reference = scope.attributeHints.get(type);
   }
   else if (reference == V_OBJECT && type != 0) {
      reference = scope.attributeHints.get(type);
   }

   bool inverting = IsInvertedOperator(operator_id);

   SNode operationNode = node.injectNode((LexicalType)operationType, operator_id);
   if (size != 0) {
      // HOTFIX : inject an item size for the binary array operations
      operationNode.appendNode(lxSize, size);
   }

   if (reference == V_FLAG) {      
      if (!scope.branchingInfo.reference) {
         // HOTFIX : resolve boolean symbols
         ref_t dummy;
         resolveBranchOperation(scope, compiler, IF_MESSAGE_ID, scope.boolReference, dummy);
      }

      reference = scope.branchingInfo.reference;
      if (inverting) {
         operationNode.appendNode(lxIfValue, scope.branchingInfo.falseRef);
         operationNode.appendNode(lxElseValue, scope.branchingInfo.trueRef);
      }
      else {
         operationNode.appendNode(lxIfValue, scope.branchingInfo.trueRef);
         operationNode.appendNode(lxElseValue, scope.branchingInfo.falseRef);
      }
   }
}