Add match stub
This commit is contained in:
parent
7e1bc350d1
commit
55dec491eb
@ -115,3 +115,17 @@ func (this *generator) getStructMemberIndex (ty *entity.TypeStruct, name string)
|
||||
}
|
||||
return offset
|
||||
}
|
||||
|
||||
func (this *generator) getUnionTypeFieldLoc (union llvm.Value, irType llvm.Type) llvm.Value {
|
||||
return this.blockManager.NewGetElementPtr (
|
||||
irType, union,
|
||||
llvm.NewConstInt(llvm.I32, 0),
|
||||
llvm.NewConstInt(llvm.I32, 0))
|
||||
}
|
||||
|
||||
func (this *generator) getUnionDataFieldLoc (union llvm.Value, irType llvm.Type) llvm.Value {
|
||||
return this.blockManager.NewGetElementPtr (
|
||||
irType, union,
|
||||
llvm.NewConstInt(llvm.I32, 0),
|
||||
llvm.NewConstInt(llvm.I32, 1))
|
||||
}
|
||||
|
@ -93,6 +93,8 @@ func (this *generator) generateExpressionAny (expression entity.Expression) (reg
|
||||
return this.generateBlock(expression, resultModeAny)
|
||||
case *entity.IfElse:
|
||||
return this.generateIfElse(expression, resultModeAny)
|
||||
case *entity.Match:
|
||||
return this.generateMatch(expression, resultModeAny)
|
||||
case *entity.Loop:
|
||||
return this.generateLoop(expression, resultModeAny)
|
||||
|
||||
@ -148,14 +150,17 @@ func (this *generator) generateExpressionVal (expression entity.Expression) (llv
|
||||
case *entity.Operation:
|
||||
return this.generateOperationVal(expression)
|
||||
case *entity.Block:
|
||||
loc, _, err := this.generateBlock(expression, resultModeVal)
|
||||
return loc, err
|
||||
val, _, err := this.generateBlock(expression, resultModeVal)
|
||||
return val, err
|
||||
case *entity.IfElse:
|
||||
loc, _, err := this.generateIfElse(expression, resultModeVal)
|
||||
return loc, err
|
||||
val, _, err := this.generateIfElse(expression, resultModeVal)
|
||||
return val, err
|
||||
case *entity.Match:
|
||||
val, _, err := this.generateMatch(expression, resultModeVal)
|
||||
return val, err
|
||||
case *entity.Loop:
|
||||
loc, _, err := this.generateLoop(expression, resultModeVal)
|
||||
return loc, err
|
||||
val, _, err := this.generateLoop(expression, resultModeVal)
|
||||
return val, err
|
||||
case *entity.LiteralInt:
|
||||
return this.generateLiteralInt(expression)
|
||||
case *entity.LiteralFloat:
|
||||
@ -222,6 +227,9 @@ func (this *generator) generateExpressionLoc (expression entity.Expression) (llv
|
||||
case *entity.IfElse:
|
||||
loc, _, err := this.generateIfElse(expression, resultModeLoc)
|
||||
return loc, err
|
||||
case *entity.Match:
|
||||
loc, _, err := this.generateMatch(expression, resultModeLoc)
|
||||
return loc, err
|
||||
case *entity.Loop:
|
||||
loc, _, err := this.generateLoop(expression, resultModeLoc)
|
||||
return loc, err
|
||||
|
@ -94,6 +94,10 @@ func (this *generator) generateIfElse (ifelse *entity.IfElse, mode resultMode) (
|
||||
}
|
||||
}
|
||||
|
||||
func (this *generator) generateMatch (match *entity.Match, mode resultMode) llvm.Value, bool, error) {
|
||||
// TODO
|
||||
}
|
||||
|
||||
func (this *generator) generateLoop (loop *entity.Loop, mode resultMode) (llvm.Value, bool, error) {
|
||||
previous := this.blockManager.Block
|
||||
body := this.blockManager.newBlock()
|
||||
|
Loading…
Reference in New Issue
Block a user