Putting pointers in interfaces is incredibly stupid
This commit is contained in:
parent
dbbe0198d5
commit
689200085a
@ -48,7 +48,7 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
argument.kind = ArgumentKindIdentifier
|
argument.kind = ArgumentKindIdentifier
|
||||||
argument.value = &identifier
|
argument.value = identifier
|
||||||
}
|
}
|
||||||
|
|
||||||
case lexer.TokenKindInt:
|
case lexer.TokenKindInt:
|
||||||
@ -77,13 +77,10 @@ func (parser *ParsingOperation) parseArgument () (argument Argument, err error)
|
|||||||
parser.nextToken()
|
parser.nextToken()
|
||||||
|
|
||||||
case lexer.TokenKindLBracket:
|
case lexer.TokenKindLBracket:
|
||||||
argument.kind = ArgumentKindPhrase
|
argument.kind = ArgumentKindPhrase
|
||||||
var phrase Phrase
|
argument.value, err = parser.parseArgumentLevelPhrase()
|
||||||
phrase, err = parser.parseArgumentLevelPhrase()
|
|
||||||
argument.value = &phrase
|
|
||||||
parser.nextToken()
|
parser.nextToken()
|
||||||
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
panic (
|
panic (
|
||||||
"unimplemented argument kind " +
|
"unimplemented argument kind " +
|
||||||
|
@ -73,7 +73,7 @@ func (parser *ParsingOperation) parseInitializationValues (
|
|||||||
var initializationValues ObjectInitializationValues
|
var initializationValues ObjectInitializationValues
|
||||||
initializationValues, err = parser.parseObjectInitializationValues()
|
initializationValues, err = parser.parseObjectInitializationValues()
|
||||||
initializationArgument.kind = ArgumentKindObjectInitializationValues
|
initializationArgument.kind = ArgumentKindObjectInitializationValues
|
||||||
initializationArgument.value = &initializationValues
|
initializationArgument.value = initializationValues
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ func (parser *ParsingOperation) parseInitializationValues (
|
|||||||
var initializationValues ArrayInitializationValues
|
var initializationValues ArrayInitializationValues
|
||||||
initializationValues, err = parser.parseArrayInitializationValues()
|
initializationValues, err = parser.parseArrayInitializationValues()
|
||||||
initializationArgument.kind = ArgumentKindArrayInitializationValues
|
initializationArgument.kind = ArgumentKindArrayInitializationValues
|
||||||
initializationArgument.value = &initializationValues
|
initializationArgument.value = initializationValues
|
||||||
}
|
}
|
||||||
|
|
||||||
return
|
return
|
||||||
|
@ -78,7 +78,7 @@ func (tree *SyntaxTree) ToString (indent int) (output string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (identifier *Identifier) ToString () (output string) {
|
func (identifier Identifier) ToString () (output string) {
|
||||||
for index, trailItem := range identifier.trail {
|
for index, trailItem := range identifier.trail {
|
||||||
if index > 0 {
|
if index > 0 {
|
||||||
output += "."
|
output += "."
|
||||||
@ -115,13 +115,13 @@ func (what *Type) ToString () (output string) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (declaration *Declaration) ToString () (output string) {
|
func (declaration Declaration) ToString () (output string) {
|
||||||
output += declaration.name + ":"
|
output += declaration.name + ":"
|
||||||
output += declaration.what.ToString()
|
output += declaration.what.ToString()
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (attributes *ObjectInitializationValues) ToString (
|
func (attributes ObjectInitializationValues) ToString (
|
||||||
indent int,
|
indent int,
|
||||||
) (
|
) (
|
||||||
output string,
|
output string,
|
||||||
@ -141,7 +141,7 @@ func (attributes *ObjectInitializationValues) ToString (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (values *ArrayInitializationValues) ToString (
|
func (values ArrayInitializationValues) ToString (
|
||||||
indent int,
|
indent int,
|
||||||
) (
|
) (
|
||||||
output string,
|
output string,
|
||||||
@ -153,7 +153,7 @@ func (values *ArrayInitializationValues) ToString (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func (phrase *Phrase) ToString (indent int, ownLine bool) (output string) {
|
func (phrase Phrase) ToString (indent int, ownLine bool) (output string) {
|
||||||
if ownLine {
|
if ownLine {
|
||||||
output += doIndent(indent)
|
output += doIndent(indent)
|
||||||
}
|
}
|
||||||
@ -187,30 +187,30 @@ func (argument *Argument) ToString (indent int, breakLine bool) (output string)
|
|||||||
|
|
||||||
switch argument.kind {
|
switch argument.kind {
|
||||||
case ArgumentKindPhrase:
|
case ArgumentKindPhrase:
|
||||||
output += argument.value.(*Phrase).ToString (
|
output += argument.value.(Phrase).ToString (
|
||||||
indent,
|
indent,
|
||||||
breakLine)
|
breakLine)
|
||||||
|
|
||||||
case ArgumentKindObjectInitializationValues:
|
case ArgumentKindObjectInitializationValues:
|
||||||
// this should only appear in contexts where breakLine is true
|
// this should only appear in contexts where breakLine is true
|
||||||
output += argument.value.(*ObjectInitializationValues).
|
output += argument.value.(ObjectInitializationValues).
|
||||||
ToString(indent)
|
ToString(indent)
|
||||||
|
|
||||||
case ArgumentKindArrayInitializationValues:
|
case ArgumentKindArrayInitializationValues:
|
||||||
// this should only appear in contexts where breakLine is true
|
// this should only appear in contexts where breakLine is true
|
||||||
output += argument.value.(*ArrayInitializationValues).
|
output += argument.value.(ArrayInitializationValues).
|
||||||
ToString(indent)
|
ToString(indent)
|
||||||
|
|
||||||
case ArgumentKindIdentifier:
|
case ArgumentKindIdentifier:
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
indent,
|
indent,
|
||||||
argument.value.(*Identifier).ToString())
|
argument.value.(Identifier).ToString())
|
||||||
if breakLine { output += "\n" }
|
if breakLine { output += "\n" }
|
||||||
|
|
||||||
case ArgumentKindDeclaration:
|
case ArgumentKindDeclaration:
|
||||||
output += doIndent (
|
output += doIndent (
|
||||||
indent,
|
indent,
|
||||||
argument.value.(*Declaration).ToString())
|
argument.value.(Declaration).ToString())
|
||||||
if breakLine { output += "\n" }
|
if breakLine { output += "\n" }
|
||||||
|
|
||||||
case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat:
|
case ArgumentKindInt, ArgumentKindUInt, ArgumentKindFloat:
|
||||||
|
Reference in New Issue
Block a user