public override void Prepare(Generator generator, TypeReference inferredType) { base.Prepare(generator, inferredType); parent.Prepare(generator, null); TypeReference parentType = parent.TypeReference; // if (parentType.IsNullable) // parentType = ((NullableTypeReference)parentType).Parent; FieldExpression field = new FieldExpression(this, new Identifier(this, name)); field.SetParentDoNotGenerate(parent); call = new CallExpression(this, field); call.AddParameter(argument); call.ParametersPreResolved(); call.Resolve(generator); call.Prepare(generator, null); type = call.TypeReference; string signature = parentType.TypeName.Data + ":" + name + ":" + argument.TypeReference.TypeName.Data; // unassign call if it is build in if ((signature == "pluk.base.Int:OperatorEquals:pluk.base.Int") || (signature == "pluk.base.Int:OperatorNotEquals:pluk.base.Int") || (signature == "pluk.base.Int:OperatorGreaterThan:pluk.base.Int") || (signature == "pluk.base.Int:OperatorLessThan:pluk.base.Int") || (signature == "pluk.base.Int:OperatorGreaterEquals:pluk.base.Int") || (signature == "pluk.base.Int:OperatorLessEquals:pluk.base.Int") || (signature == "pluk.base.Int:OperatorAdd:pluk.base.Int") || (signature == "pluk.base.Int:OperatorSubtract:pluk.base.Int") || (signature == "pluk.base.Int:OperatorLeft:pluk.base.Int") || (signature == "pluk.base.Int:OperatorRight:pluk.base.Int") || (signature == "pluk.base.Int:OperatorMultiply:pluk.base.Int") || (signature == "pluk.base.Int:OperatorModulo:pluk.base.Int") || (signature == "pluk.base.Int:OperatorDivide:pluk.base.Int") || (signature == "pluk.base.Bool:OperatorEquals:pluk.base.Bool") || (signature == "pluk.base.Bool:OperatorNotEquals:pluk.base.Bool") || (signature == "pluk.base.Byte:OperatorEquals:pluk.base.Byte") || (signature == "pluk.base.Byte:OperatorNotEquals:pluk.base.Byte") || (signature == "pluk.base.Byte:OperatorGreaterThan:pluk.base.Byte") || (signature == "pluk.base.Byte:OperatorLessThan:pluk.base.Byte") || (signature == "pluk.base.Byte:OperatorGreaterEquals:pluk.base.Byte") || (signature == "pluk.base.Byte:OperatorLessEquals:pluk.base.Byte") ) { call = null; } }
public override void Prepare(Generator generator, TypeReference inferredType) { base.Prepare(generator, inferredType); left.Prepare(generator, null); TypeReference leftType = left.TypeReference; if (leftType.TypeName.Data == "pluk.base.Bool") { right.Prepare(generator, leftType); type = leftType; } else { FieldExpression field = new FieldExpression(this, new Identifier(this, "OperatorOr")); field.SetParentDoNotGenerate(left); call = new CallExpression(this, field); call.AddParameter(right); call.Resolve(generator); call.Prepare(generator, inferredType); type = call.TypeReference; } }
public override void Prepare(Generator generator, TypeReference inferredType) { base.Prepare(generator, inferredType); call.Prepare(generator, inferredType); }