-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Vincent Rasquier
committed
Dec 14, 2017
1 parent
96bf68c
commit fc95a96
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package asm | ||
|
||
import "github.com/leaklessgfy/asm/asm/typed" | ||
|
||
type Type struct { | ||
sort int | ||
valueBuffer []rune | ||
valueOffset int | ||
valueLength int | ||
} | ||
|
||
func getObjectType(internalName string) *Type { | ||
valueBuffer := []rune(internalName) | ||
typ := typed.INTERNAL | ||
if valueBuffer[0] == '[' { | ||
typ = typed.ARRAY | ||
} | ||
return &Type{ | ||
sort: typ, | ||
valueBuffer: valueBuffer, | ||
valueOffset: 0, | ||
valueLength: len(valueBuffer), | ||
} | ||
} | ||
|
||
func getMethodType(methodDescriptor string) *Type { | ||
valueBuffer := []rune(methodDescriptor) | ||
return &Type{ | ||
typed.METHOD, | ||
valueBuffer, | ||
0, | ||
len(valueBuffer), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package typed | ||
|
||
const ( | ||
VOID = 0 | ||
BOOLEAN = 1 | ||
CHAR = 2 | ||
BYTE = 3 | ||
SHORT = 4 | ||
INT = 5 | ||
FLOAT = 6 | ||
LONG = 7 | ||
DOUBLE = 8 | ||
ARRAY = 9 | ||
OBJECT = 10 | ||
METHOD = 11 | ||
INTERNAL = 12 | ||
) | ||
|
||
var PRIMITIVE_DESCRIPTORS = []rune{'V', 'Z', 'C', 'B', 'S', 'I', 'F', 'J', 'D'} | ||
|