|
@@ -234,7 +234,7 @@ type compiledOptional struct {
|
|
func (e *defaultDeleteExpr) emitGetter(putOnStack bool) {
|
|
func (e *defaultDeleteExpr) emitGetter(putOnStack bool) {
|
|
e.expr.emitGetter(false)
|
|
e.expr.emitGetter(false)
|
|
if putOnStack {
|
|
if putOnStack {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(valueTrue)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(valueTrue)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -373,7 +373,7 @@ func (e *baseCompiledExpr) addSrcMap() {
|
|
func (e *constantExpr) emitGetter(putOnStack bool) {
|
|
func (e *constantExpr) emitGetter(putOnStack bool) {
|
|
if putOnStack {
|
|
if putOnStack {
|
|
e.addSrcMap()
|
|
e.addSrcMap()
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(e.val)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(e.val)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1261,7 +1261,7 @@ func (e *compiledAssignExpr) emitGetter(putOnStack bool) {
|
|
|
|
|
|
func (e *compiledLiteral) emitGetter(putOnStack bool) {
|
|
func (e *compiledLiteral) emitGetter(putOnStack bool) {
|
|
if putOnStack {
|
|
if putOnStack {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(e.val)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(e.val)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@@ -1272,15 +1272,15 @@ func (e *compiledLiteral) constant() bool {
|
|
func (e *compiledTemplateLiteral) emitGetter(putOnStack bool) {
|
|
func (e *compiledTemplateLiteral) emitGetter(putOnStack bool) {
|
|
if e.tag == nil {
|
|
if e.tag == nil {
|
|
if len(e.elements) == 0 {
|
|
if len(e.elements) == 0 {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(stringEmpty)))
|
|
|
|
|
|
+ e.c.emitLiteralString(stringEmpty)
|
|
} else {
|
|
} else {
|
|
tail := e.elements[len(e.elements)-1].Parsed
|
|
tail := e.elements[len(e.elements)-1].Parsed
|
|
if len(e.elements) == 1 {
|
|
if len(e.elements) == 1 {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(stringValueFromRaw(tail))))
|
|
|
|
|
|
+ e.c.emitLiteralString(stringValueFromRaw(tail))
|
|
} else {
|
|
} else {
|
|
stringCount := 0
|
|
stringCount := 0
|
|
if head := e.elements[0].Parsed; head != "" {
|
|
if head := e.elements[0].Parsed; head != "" {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(stringValueFromRaw(head))))
|
|
|
|
|
|
+ e.c.emitLiteralString(stringValueFromRaw(head))
|
|
stringCount++
|
|
stringCount++
|
|
}
|
|
}
|
|
e.expressions[0].emitGetter(true)
|
|
e.expressions[0].emitGetter(true)
|
|
@@ -1288,7 +1288,7 @@ func (e *compiledTemplateLiteral) emitGetter(putOnStack bool) {
|
|
stringCount++
|
|
stringCount++
|
|
for i := 1; i < len(e.elements)-1; i++ {
|
|
for i := 1; i < len(e.elements)-1; i++ {
|
|
if elt := e.elements[i].Parsed; elt != "" {
|
|
if elt := e.elements[i].Parsed; elt != "" {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(stringValueFromRaw(elt))))
|
|
|
|
|
|
+ e.c.emitLiteralString(stringValueFromRaw(elt))
|
|
stringCount++
|
|
stringCount++
|
|
}
|
|
}
|
|
e.expressions[i].emitGetter(true)
|
|
e.expressions[i].emitGetter(true)
|
|
@@ -1296,7 +1296,7 @@ func (e *compiledTemplateLiteral) emitGetter(putOnStack bool) {
|
|
stringCount++
|
|
stringCount++
|
|
}
|
|
}
|
|
if tail != "" {
|
|
if tail != "" {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(stringValueFromRaw(tail))))
|
|
|
|
|
|
+ e.c.emitLiteralString(stringValueFromRaw(tail))
|
|
stringCount++
|
|
stringCount++
|
|
}
|
|
}
|
|
e.c.emit(concatStrings(stringCount))
|
|
e.c.emit(concatStrings(stringCount))
|
|
@@ -2450,7 +2450,7 @@ func (c *compiler) emitThrow(v Value) {
|
|
c.emit(loadDynamic(t))
|
|
c.emit(loadDynamic(t))
|
|
msg := o.self.getStr("message", nil)
|
|
msg := o.self.getStr("message", nil)
|
|
if msg != nil {
|
|
if msg != nil {
|
|
- c.emit(loadVal(c.p.defineLiteralValue(msg)))
|
|
|
|
|
|
+ c.emitLiteralValue(msg)
|
|
c.emit(_new(1))
|
|
c.emit(_new(1))
|
|
} else {
|
|
} else {
|
|
c.emit(_new(0))
|
|
c.emit(_new(0))
|
|
@@ -2467,7 +2467,7 @@ func (c *compiler) emitConst(expr compiledExpr, putOnStack bool) {
|
|
v, ex := c.evalConst(expr)
|
|
v, ex := c.evalConst(expr)
|
|
if ex == nil {
|
|
if ex == nil {
|
|
if putOnStack {
|
|
if putOnStack {
|
|
- c.emit(loadVal(c.p.defineLiteralValue(v)))
|
|
|
|
|
|
+ c.emitLiteralValue(v)
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
c.emitThrow(ex.val)
|
|
c.emitThrow(ex.val)
|
|
@@ -2633,7 +2633,7 @@ func (e *compiledLogicalOr) emitGetter(putOnStack bool) {
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
} else {
|
|
} else {
|
|
if putOnStack {
|
|
if putOnStack {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(v)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(v)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -2674,7 +2674,7 @@ func (e *compiledCoalesce) emitGetter(putOnStack bool) {
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
} else {
|
|
} else {
|
|
if putOnStack {
|
|
if putOnStack {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(v)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(v)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
@@ -2714,7 +2714,7 @@ func (e *compiledLogicalAnd) emitGetter(putOnStack bool) {
|
|
if e.left.constant() {
|
|
if e.left.constant() {
|
|
if v, ex := e.c.evalConst(e.left); ex == nil {
|
|
if v, ex := e.c.evalConst(e.left); ex == nil {
|
|
if !v.ToBoolean() {
|
|
if !v.ToBoolean() {
|
|
- e.c.emit(loadVal(e.c.p.defineLiteralValue(v)))
|
|
|
|
|
|
+ e.c.emitLiteralValue(v)
|
|
} else {
|
|
} else {
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
e.c.emitExpr(e.right, putOnStack)
|
|
}
|
|
}
|