Documentation
¶
Overview ¶
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Copyright Consensys Software Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
SPDX-License-Identifier: Apache-2.0
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Flatten ¶
Flatten flattens all block-level statements (IfElse, Switch, While, For, Break, Continue) in each function of the program into the flat if-goto form expected by subsequent validation and code generation passes. Source map entries for generated nodes are inherited from the original block node.
func FlattenFixedArrays ¶
FlattenFixedArrays expands fixed-size array variables into individual scalar variables. A variable arrayName of type [uM;n] is replaced by n scalars arrayName$0 .. arrayName$(n-1), each of type uM. Corresponding expr.ArrayAccess and lval.Array nodes are rewritten to plain LocalAccess / lval.Variable references.
Types ¶
type PcMapping ¶
type PcMapping struct {
// contains filtered or unexported fields
}
PcMapping records that `shift` statements were inserted at the PC `pivotPC` during fixed-array expansion. When remapping branch targets, any PC strictly greater than `pivotPC` is shifted forward by `shift` statements.
type Rewriter ¶
type Rewriter struct {
// contains filtered or unexported fields
}
Rewriter encapsulates a statement / expression rewriter currently targeted towards array expressions.
type VarMapping ¶
type VarMapping struct {
// contains filtered or unexported fields
}
VarMapping records how an old variable ID maps into the expanded variable list. For scalar variables newBase is the single new ID. For fixed arrays newBase..newBase+size-1 are the individual element variables and elemType is the canonical element type used by the lowering helpers. elemType is nil for non-array entries.