01: /*
02: * $Id: ConcatenationAssignmentNode.java,v 1.11 2002/09/16 08:05:04 jkl Exp $
03: *
04: * Copyright (c) 2002 Njet Communications Ltd. All Rights Reserved.
05: *
06: * Use is subject to license terms, as defined in
07: * Anvil Sofware License, Version 1.1. See LICENSE
08: * file, or http://njet.org/license-1.1.txt
09: */
10: package anvil.script.expression;
11:
12: import anvil.Location;
13: import anvil.core.Any;
14: import anvil.codec.Code;
15: import anvil.script.compiler.ByteCompiler;
16: import anvil.script.Context;
17: import java.io.IOException;
18:
19: /**
20: * class ConcatenationAssignmentNode
21: *
22: * @author: Jani Lehtimäki
23: */
24: public class ConcatenationAssignmentNode extends AbstractAssignmentNode {
25:
26: public ConcatenationAssignmentNode(Location location, int childs) {
27: super (location, childs);
28: }
29:
30: public int typeOf() {
31: return Node.EXPR_ASSIGN_CONCAT;
32: }
33:
34: public String getOperator() {
35: return "&=";
36: }
37:
38: protected String getAssignmentMethod() {
39: return "concat";
40: }
41:
42: protected void compileOperation(ByteCompiler context,
43: final Node left, final Node right) {
44: left.compile(context, new Node() {
45: public void compile(ByteCompiler context, int operation) {
46: left.compile(context, GET);
47: right.compile(context, GET);
48: Code code = context.getCode();
49: code.invokevirtual(code.getPool().addMethodRef(
50: context.TYPE_ANY, "concat",
51: "(Lanvil/core/Any;)Lanvil/core/Any;"));
52: }
53: });
54: }
55:
56: }
|