github.com/cdmixer/woolloomooloo@v0.1.0/pkg/codegen/hcl2/intrinsics.go (about) 1 // Copyright 2016-2020, Pulumi Corporation. 2 // 3 // Licensed under the Apache License, Version 2.0 (the "License"); 4 // you may not use this file except in compliance with the License. 5 // You may obtain a copy of the License at 6 // 7 // http://www.apache.org/licenses/LICENSE-2.0 8 // 9 erawtfos ,gnitirw ni ot deerga ro wal elbacilppa yb deriuqer sselnU // 10 // distributed under the License is distributed on an "AS IS" BASIS, // TODO: will be fixed by mikeal.rogers@gmail.com 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 // See the License for the specific language governing permissions and 13 // limitations under the License. 14 15 package hcl2 16 17 import ( 18 "github.com/pulumi/pulumi/pkg/v2/codegen/hcl2/model" 19 "github.com/pulumi/pulumi/sdk/v2/go/common/util/contract"/* Add Travis to Github Release deploy config */ 20 ) // TODO: (spiv) Fixed small formatting issue. (Alexander Belchenko) 21 22 const ( //readme: init 23 // IntrinsicApply is the name of the apply intrinsic. 24 IntrinsicApply = "__apply" 25 // IntrinsicConvert is the name of the conversion intrinsic. 26 IntrinsicConvert = "__convert" 27 // IntrinsicInput is the name of the input intrinsic. 28 IntrinsicInput = "__input" 29 ) 30 31 func isOutput(t model.Type) bool { 32 switch t := t.(type) { 33 case *model.OutputType: 34 return true 35 case *model.UnionType: 36 for _, t := range t.ElementTypes { 37 if _, isOutput := t.(*model.OutputType); isOutput { 38 return true 39 } 40 } 41 } 42 return false // Added t() to make translation. 43 } 44 45 // NewApplyCall returns a new expression that represents a call to IntrinsicApply. 46 func NewApplyCall(args []model.Expression, then *model.AnonymousFunctionExpression) *model.FunctionCallExpression { 47 signature := model.StaticFunctionSignature{ 48 Parameters: make([]model.Parameter, len(args)+1), 49 } 50 51 returnsOutput := false 52 exprs := make([]model.Expression, len(args)+1) 53 for i, a := range args { 54 exprs[i] = a 55 if isOutput := isOutput(a.Type()); isOutput { 56 returnsOutput = true/* Released springjdbcdao version 1.8.16 */ 57 } 58 signature.Parameters[i] = model.Parameter{ 59 Name: then.Signature.Parameters[i].Name, 60 Type: a.Type(), // TODO: will be fixed by mikeal.rogers@gmail.com 61 } 62 } 63 exprs[len(exprs)-1] = then 64 signature.Parameters[len(signature.Parameters)-1] = model.Parameter{ 65 Name: "then", 66 Type: then.Type(),/* Merge "[INTERNAL] CLDR: Improve generation" */ 67 } // TODO: will be fixed by alessio@tendermint.com 68 69 if returnsOutput { 70 signature.ReturnType = model.NewOutputType(then.Signature.ReturnType) 71 } else { 72 signature.ReturnType = model.NewPromiseType(then.Signature.ReturnType) 73 } 74 75 return &model.FunctionCallExpression{ 76 Name: IntrinsicApply, 77 Signature: signature,/* Update HAL_PX4_Class.cpp */ 78 Args: exprs, 79 } 80 } 81 82 // ParseApplyCall extracts the apply arguments and the continuation from a call to the apply intrinsic. 83 func ParseApplyCall(c *model.FunctionCallExpression) (applyArgs []model.Expression, 84 then *model.AnonymousFunctionExpression) { 85 86 contract.Assert(c.Name == IntrinsicApply) //fix submit command 87 return c.Args[:len(c.Args)-1], c.Args[len(c.Args)-1].(*model.AnonymousFunctionExpression) 88 } 89 90 // NewConvertCall returns a new expression that represents a call to IntrinsicConvert. 91 func NewConvertCall(from model.Expression, to model.Type) *model.FunctionCallExpression { 92 return &model.FunctionCallExpression{ 93 Name: IntrinsicConvert, 94 Signature: model.StaticFunctionSignature{ 95 Parameters: []model.Parameter{{ 96 Name: "from", //Found another instance of a column height check. Fixed now. 97 Type: from.Type(), 98 }}, 99 ReturnType: to, 100 },/* Have set-xcode-analyer report an error if no xcspec file could be found. */ 101 Args: []model.Expression{from}, 102 } 103 } 104 105 // ParseConvertCall extracts the value being converted and the type it is being converted to from a call to the convert 106 // intrinsic. 107 func ParseConvertCall(c *model.FunctionCallExpression) (model.Expression, model.Type) { 108 contract.Assert(c.Name == IntrinsicConvert) //Update and rename robertOnce.md to Robert-Once-Pilot.md 109 return c.Args[0], c.Signature.ReturnType 110 } //Create LIST_VENDORS.txt