|
@@ -1,91 +0,0 @@
|
1
|
|
-/*
|
2
|
|
- * To change this license header, choose License Headers in Project Properties.
|
3
|
|
- * To change this template file, choose Tools | Templates
|
4
|
|
- * and open the template in the editor.
|
5
|
|
- */
|
6
|
|
-package org.openzen.zenscript.codemodel.member.builtin;
|
7
|
|
-
|
8
|
|
-import java.util.Map;
|
9
|
|
-import org.openzen.zenscript.codemodel.CompareType;
|
10
|
|
-import org.openzen.zenscript.codemodel.FunctionHeader;
|
11
|
|
-import org.openzen.zenscript.codemodel.OperatorType;
|
12
|
|
-import org.openzen.zenscript.codemodel.expression.CallArguments;
|
13
|
|
-import org.openzen.zenscript.codemodel.expression.Expression;
|
14
|
|
-import org.openzen.zenscript.codemodel.expression.StringConcatExpression;
|
15
|
|
-import org.openzen.zenscript.codemodel.generic.TypeParameter;
|
16
|
|
-import org.openzen.zenscript.codemodel.member.ICallableMember;
|
17
|
|
-import org.openzen.zenscript.codemodel.member.IDefinitionMember;
|
18
|
|
-import org.openzen.zenscript.codemodel.member.MemberVisitor;
|
19
|
|
-import org.openzen.zenscript.codemodel.type.GlobalTypeRegistry;
|
20
|
|
-import org.openzen.zenscript.codemodel.type.ITypeID;
|
21
|
|
-import org.openzen.zenscript.codemodel.type.member.TypeMemberPriority;
|
22
|
|
-import org.openzen.zenscript.codemodel.type.member.TypeMembers;
|
23
|
|
-import org.openzen.zenscript.shared.CodePosition;
|
24
|
|
-import org.openzen.zenscript.shared.Taggable;
|
25
|
|
-
|
26
|
|
-/**
|
27
|
|
- *
|
28
|
|
- * @author Hoofdgebruiker
|
29
|
|
- */
|
30
|
|
-public class StringConcatMember extends Taggable implements ICallableMember {
|
31
|
|
- private final FunctionHeader header;
|
32
|
|
-
|
33
|
|
- public StringConcatMember(FunctionHeader header) {
|
34
|
|
- this.header = header;
|
35
|
|
- }
|
36
|
|
-
|
37
|
|
- @Override
|
38
|
|
- public boolean isStatic() {
|
39
|
|
- return false;
|
40
|
|
- }
|
41
|
|
-
|
42
|
|
- @Override
|
43
|
|
- public FunctionHeader getHeader() {
|
44
|
|
- return header;
|
45
|
|
- }
|
46
|
|
-
|
47
|
|
- @Override
|
48
|
|
- public Expression call(CodePosition position, Expression target, FunctionHeader instancedHeader, CallArguments arguments) {
|
49
|
|
- return new StringConcatExpression(position, target, arguments.arguments[0]);
|
50
|
|
- }
|
51
|
|
-
|
52
|
|
- @Override
|
53
|
|
- public Expression callWithComparator(CodePosition position, CompareType operator, Expression target, FunctionHeader instancedHeader, CallArguments arguments) {
|
54
|
|
- throw new UnsupportedOperationException("Not comparable");
|
55
|
|
- }
|
56
|
|
-
|
57
|
|
- @Override
|
58
|
|
- public Expression callStatic(CodePosition position, FunctionHeader instancedHeader, CallArguments arguments) {
|
59
|
|
- throw new UnsupportedOperationException("Not static");
|
60
|
|
- }
|
61
|
|
-
|
62
|
|
- @Override
|
63
|
|
- public Expression callStaticWithComparator(CodePosition position, CompareType operator, FunctionHeader instancedHeader, CallArguments arguments) {
|
64
|
|
- throw new UnsupportedOperationException("Not comparable");
|
65
|
|
- }
|
66
|
|
-
|
67
|
|
- @Override
|
68
|
|
- public CodePosition getPosition() {
|
69
|
|
- return CodePosition.BUILTIN;
|
70
|
|
- }
|
71
|
|
-
|
72
|
|
- @Override
|
73
|
|
- public String describe() {
|
74
|
|
- return "concat string";
|
75
|
|
- }
|
76
|
|
-
|
77
|
|
- @Override
|
78
|
|
- public void registerTo(TypeMembers type, TypeMemberPriority priority) {
|
79
|
|
- type.addOperator(OperatorType.CAT, this, priority);
|
80
|
|
- }
|
81
|
|
-
|
82
|
|
- @Override
|
83
|
|
- public IDefinitionMember instance(GlobalTypeRegistry registry, Map<TypeParameter, ITypeID> mapping) {
|
84
|
|
- return this; // only used for basic types
|
85
|
|
- }
|
86
|
|
-
|
87
|
|
- @Override
|
88
|
|
- public <T> T accept(MemberVisitor<T> visitor) {
|
89
|
|
- throw new UnsupportedOperationException("Not a compilable member");
|
90
|
|
- }
|
91
|
|
-}
|