Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion ast/node_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import (
"fmt"
"math"
"regexp"
"strconv"
"strings"
Expand All @@ -39,6 +40,7 @@
stringType *BTypeImpl
floatType *BTypeImpl
decimalType *BTypeImpl
byteType *BTypeImpl
}

func newTypeTable() typeTable {
Expand All @@ -49,6 +51,7 @@
stringType: &BTypeImpl{tag: model.TypeTags_STRING, flags: Flags_READONLY},
floatType: &BTypeImpl{tag: model.TypeTags_FLOAT, flags: Flags_READONLY},
decimalType: &BTypeImpl{tag: model.TypeTags_DECIMAL, flags: Flags_READONLY},
byteType: &BTypeImpl{tag: model.TypeTags_BYTE, flags: Flags_READONLY},
}
}

Expand All @@ -66,6 +69,8 @@
return t.floatType
case model.TypeTags_DECIMAL:
return t.decimalType
case model.TypeTags_BYTE:
return t.byteType
default:
panic("not implemented")
}
Expand Down Expand Up @@ -935,7 +940,14 @@
func parseLong(originalNodeValue, processedNodeValue string, radix int) any {
val, err := strconv.ParseInt(processedNodeValue, radix, 64)
if err != nil {
panic("Unimplemented")
fVal, fErr := strconv.ParseFloat(processedNodeValue, 64)
if fErr != nil {
panic("Unimplemented")

Check warning on line 945 in ast/node_builder.go

View check run for this annotation

Codecov / codecov/patch

ast/node_builder.go#L945

Added line #L945 was not covered by tests
}
if math.IsInf(fVal, 0) {
return originalNodeValue

Check warning on line 948 in ast/node_builder.go

View check run for this annotation

Codecov / codecov/patch

ast/node_builder.go#L948

Added line #L948 was not covered by tests
}
return fVal
}
return val
}
Expand Down
6 changes: 3 additions & 3 deletions ast/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
type BType interface {
model.Type
BTypeGetTag() model.TypeTags
bTypeSetTag(tag model.TypeTags)
BTypeSetTag(tag model.TypeTags)
bTypeGetName() model.Name
bTypeSetName(name model.Name)
bTypeGetFlags() uint64
Expand Down Expand Up @@ -290,7 +290,7 @@
return model.TypeKind_OBJECT
}

func (this *BLangTypeBase) bTypeSetTag(tag model.TypeTags) {
func (this *BLangTypeBase) BTypeSetTag(tag model.TypeTags) {

Check warning on line 293 in ast/types.go

View check run for this annotation

Codecov / codecov/patch

ast/types.go#L293

Added line #L293 was not covered by tests
this.tags = tag
}

Expand Down Expand Up @@ -318,7 +318,7 @@
return this.tag
}

func (this *BTypeImpl) bTypeSetTag(tag model.TypeTags) {
func (this *BTypeImpl) BTypeSetTag(tag model.TypeTags) {
this.tag = tag
}

Expand Down
19 changes: 19 additions & 0 deletions corpus/ast/subset4/04-int/hex-v.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 55 additions & 0 deletions corpus/ast/subset4/04-int/tohex2-v.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions corpus/ast/subset6/06-float/04-v.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

93 changes: 93 additions & 0 deletions corpus/ast/subset6/06-float/06-v.txt

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions corpus/bal/subset4/04-int/hex-v.bal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions corpus/bal/subset4/04-int/tohex1-e.bal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions corpus/bal/subset4/04-int/tohex2-v.bal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions corpus/bal/subset6/06-float/01-e.bal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 22 additions & 0 deletions corpus/bal/subset6/06-float/03-e.bal

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading