mirror of
https://github.com/tinygo-org/tinygo.git
synced 2026-08-19 20:14:04 +00:00
Simplify a bit of code
This commit is contained in:
+1
-6
@@ -240,12 +240,7 @@ func (c *Compiler) Parse(mainPath string, buildTags []string) error {
|
|||||||
// Declare all globals. These will get an initializer when parsing "package
|
// Declare all globals. These will get an initializer when parsing "package
|
||||||
// initializer" functions.
|
// initializer" functions.
|
||||||
for _, g := range c.ir.Globals {
|
for _, g := range c.ir.Globals {
|
||||||
typ := g.g.Type()
|
typ := g.g.Type().(*types.Pointer).Elem()
|
||||||
if typPtr, ok := typ.(*types.Pointer); ok {
|
|
||||||
typ = typPtr.Elem()
|
|
||||||
} else {
|
|
||||||
return errors.New("global is not a pointer")
|
|
||||||
}
|
|
||||||
llvmType, err := c.getLLVMType(typ)
|
llvmType, err := c.getLLVMType(typ)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
|||||||
Reference in New Issue
Block a user