2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package com
.intellij
.codeInsight
.template
.impl
;
19 import com
.intellij
.codeInsight
.lookup
.LookupElement
;
20 import com
.intellij
.codeInsight
.template
.Expression
;
21 import com
.intellij
.codeInsight
.template
.ExpressionContext
;
22 import com
.intellij
.codeInsight
.template
.Macro
;
23 import com
.intellij
.codeInsight
.template
.Result
;
24 import org
.jetbrains
.annotations
.NotNull
;
26 import java
.util
.ArrayList
;
31 public class MacroCallNode
extends Expression
{
32 public Macro
getMacro() {
36 private final Macro myMacro
;
37 private final ArrayList
<Expression
> myParameters
= new ArrayList
<Expression
>();
39 public MacroCallNode(@NotNull Macro macro
) {
43 public void addParameter(Expression node
) {
44 myParameters
.add(node
);
47 public Result
calculateResult(ExpressionContext context
) {
48 Expression
[] parameters
= myParameters
.toArray(new Expression
[myParameters
.size()]);
49 return myMacro
.calculateResult(parameters
, context
);
52 public Result
calculateQuickResult(ExpressionContext context
) {
53 Expression
[] parameters
= myParameters
.toArray(new Expression
[myParameters
.size()]);
54 return myMacro
.calculateQuickResult(parameters
, context
);
57 public LookupElement
[] calculateLookupItems(ExpressionContext context
) {
58 Expression
[] parameters
= myParameters
.toArray(new Expression
[myParameters
.size()]);
59 return myMacro
.calculateLookupItems(parameters
, context
);
62 public Expression
[] getParameters() {
63 return myParameters
.toArray(new Expression
[myParameters
.size()]);