Lines 74-100
Link Here
|
74 |
* @param T |
74 |
* @param T |
75 |
* @author Dmitriy Ivanov, Vladimir Kvashin |
75 |
* @author Dmitriy Ivanov, Vladimir Kvashin |
76 |
*/ |
76 |
*/ |
77 |
public class FunctionImpl<T> extends OffsetableDeclarationBase<T> |
77 |
public class FunctionImpl<T> extends OffsetableDeclarationBase<T> |
78 |
implements CsmFunction, Disposable, RawNamable, CsmTemplate { |
78 |
implements CsmFunction, Disposable, RawNamable, CsmTemplate { |
79 |
|
79 |
|
80 |
private static final String OPERATOR = "operator"; // NOI18N; |
80 |
private static final String OPERATOR = "operator"; // NOI18N; |
81 |
|
81 |
|
82 |
private final CharSequence name; |
82 |
private final CharSequence name; |
83 |
private final CsmType returnType; |
83 |
private final CsmType returnType; |
84 |
// private final Collection<CsmUID<CsmParameter>> parameters; |
84 |
// private final Collection<CsmUID<CsmParameter>> parameters; |
85 |
private final FunctionParameterListImpl parameterList; |
85 |
private final FunctionParameterListImpl parameterList; |
86 |
private CharSequence signature; |
86 |
private CharSequence signature; |
87 |
|
87 |
|
88 |
// only one of scopeRef/scopeAccessor must be used |
88 |
// only one of scopeRef/scopeAccessor must be used |
89 |
private /*final*/ CsmScope scopeRef;// can be set in onDispose or contstructor only |
89 |
private /*final*/ CsmScope scopeRef;// can be set in onDispose or contstructor only |
90 |
private CsmUID<CsmScope> scopeUID; |
90 |
private CsmUID<CsmScope> scopeUID; |
91 |
|
91 |
|
92 |
private final CharSequence[] rawName; |
92 |
private final CharSequence[] rawName; |
93 |
|
93 |
|
94 |
private TemplateDescriptor templateDescriptor = null; |
94 |
private TemplateDescriptor templateDescriptor = null; |
95 |
|
95 |
|
96 |
protected final CharSequence classTemplateSuffix; |
96 |
protected final CharSequence classTemplateSuffix; |
97 |
|
97 |
|
98 |
private static final byte FLAGS_VOID_PARMLIST = 1 << 0; |
98 |
private static final byte FLAGS_VOID_PARMLIST = 1 << 0; |
99 |
private static final byte FLAGS_STATIC = 1 << 1; |
99 |
private static final byte FLAGS_STATIC = 1 << 1; |
100 |
private static final byte FLAGS_CONST = 1 << 2; |
100 |
private static final byte FLAGS_CONST = 1 << 2; |
Lines 102-108
Link Here
|
102 |
private static final byte FLAGS_INVALID = 1 << 4; |
102 |
private static final byte FLAGS_INVALID = 1 << 4; |
103 |
protected static final int LAST_USED_FLAG_INDEX = 4; |
103 |
protected static final int LAST_USED_FLAG_INDEX = 4; |
104 |
private byte flags; |
104 |
private byte flags; |
105 |
|
105 |
|
106 |
private static final boolean CHECK_SCOPE = false; |
106 |
private static final boolean CHECK_SCOPE = false; |
107 |
|
107 |
|
108 |
public FunctionImpl(AST ast, CsmFile file, CsmScope scope, boolean register, boolean global) throws AstRendererException { |
108 |
public FunctionImpl(AST ast, CsmFile file, CsmScope scope, boolean register, boolean global) throws AstRendererException { |
Lines 113-119
Link Here
|
113 |
|
113 |
|
114 |
super(ast, file); |
114 |
super(ast, file); |
115 |
assert !CHECK_SCOPE || (scope != null); |
115 |
assert !CHECK_SCOPE || (scope != null); |
116 |
|
116 |
|
117 |
name = QualifiedNameCache.getManager().getString(initName(ast)); |
117 |
name = QualifiedNameCache.getManager().getString(initName(ast)); |
118 |
if (name.length()==0) { |
118 |
if (name.length()==0) { |
119 |
throw new AstRendererException((FileImpl)file, this.getStartOffset(), "Empty function name."); // NOI18N |
119 |
throw new AstRendererException((FileImpl)file, this.getStartOffset(), "Empty function name."); // NOI18N |
Lines 123-129
Link Here
|
123 |
if (child != null) { |
123 |
if (child != null) { |
124 |
setStatic(child.getType() == CPPTokenTypes.LITERAL_static); |
124 |
setStatic(child.getType() == CPPTokenTypes.LITERAL_static); |
125 |
} else { |
125 |
} else { |
126 |
System.err.println("function ast " + ast.getText() + " without childs in file " + file.getAbsolutePath()); |
126 |
System.err.println("function ast " + ast.getText() + " without childs in file " + file.getAbsolutePath()); |
127 |
} |
127 |
} |
128 |
if (!isStatic()) { |
128 |
if (!isStatic()) { |
129 |
CsmFilter filter = CsmSelect.getFilterBuilder().createNameFilter( |
129 |
CsmFilter filter = CsmSelect.getFilterBuilder().createNameFilter( |
Lines 134-146
Link Here
|
134 |
if( name.equals(fun.getName()) ) { |
134 |
if( name.equals(fun.getName()) ) { |
135 |
// we don't check signature here since file-level statics |
135 |
// we don't check signature here since file-level statics |
136 |
// is C-style construct |
136 |
// is C-style construct |
137 |
setStatic(true); |
137 |
setStatic(true); |
138 |
break; |
138 |
break; |
139 |
} |
139 |
} |
140 |
} |
140 |
} |
141 |
} |
141 |
} |
142 |
|
142 |
|
143 |
// change scope to file for static methods, but only to prevent |
143 |
// change scope to file for static methods, but only to prevent |
144 |
// registration in global namespace |
144 |
// registration in global namespace |
145 |
if(scope instanceof CsmNamespace) { |
145 |
if(scope instanceof CsmNamespace) { |
146 |
if( !NamespaceImpl.isNamespaceScope(this) ) { |
146 |
if( !NamespaceImpl.isNamespaceScope(this) ) { |
Lines 173-179
Link Here
|
173 |
} else { |
173 |
} else { |
174 |
setFlags(FLAGS_VOID_PARMLIST, false); |
174 |
setFlags(FLAGS_VOID_PARMLIST, false); |
175 |
} |
175 |
} |
176 |
if (name.toString().startsWith(OPERATOR) && |
176 |
if (name.toString().startsWith(OPERATOR) && |
177 |
(name.length() > OPERATOR.length()) && |
177 |
(name.length() > OPERATOR.length()) && |
178 |
!Character.isJavaIdentifierPart(name.charAt(OPERATOR.length()))) { // NOI18N |
178 |
!Character.isJavaIdentifierPart(name.charAt(OPERATOR.length()))) { // NOI18N |
179 |
setFlags(FLAGS_OPERATOR, true); |
179 |
setFlags(FLAGS_OPERATOR, true); |
Lines 203-209
Link Here
|
203 |
assert (scopeUID != null || scope == null); |
203 |
assert (scopeUID != null || scope == null); |
204 |
} else { |
204 |
} else { |
205 |
this.scopeRef = scope; |
205 |
this.scopeRef = scope; |
206 |
} |
206 |
} |
207 |
} |
207 |
} |
208 |
|
208 |
|
209 |
/** |
209 |
/** |
Lines 222-244
Link Here
|
222 |
protected boolean hasFlags(byte mask) { |
222 |
protected boolean hasFlags(byte mask) { |
223 |
return (flags & mask) == mask; |
223 |
return (flags & mask) == mask; |
224 |
} |
224 |
} |
225 |
|
225 |
|
226 |
protected final void setFlags(byte mask, boolean value) { |
226 |
protected final void setFlags(byte mask, boolean value) { |
227 |
if (value) { |
227 |
if (value) { |
228 |
flags |= mask; |
228 |
flags |= mask; |
229 |
} else { |
229 |
} else { |
230 |
flags &= ~mask; |
230 |
flags &= ~mask; |
231 |
} |
231 |
} |
232 |
} |
232 |
} |
233 |
|
233 |
|
234 |
public final boolean isStatic() { |
234 |
public final boolean isStatic() { |
235 |
return hasFlags(FLAGS_STATIC); |
235 |
return hasFlags(FLAGS_STATIC); |
236 |
} |
236 |
} |
237 |
|
237 |
|
238 |
protected final void setStatic(boolean value) { |
238 |
protected final void setStatic(boolean value) { |
239 |
setFlags(FLAGS_STATIC, value); |
239 |
setFlags(FLAGS_STATIC, value); |
240 |
} |
240 |
} |
241 |
|
241 |
|
242 |
private AST findParameterNode(AST node) { |
242 |
private AST findParameterNode(AST node) { |
243 |
AST ast = AstUtil.findChildOfType(node, CPPTokenTypes.CSM_PARMLIST); |
243 |
AST ast = AstUtil.findChildOfType(node, CPPTokenTypes.CSM_PARMLIST); |
244 |
if (ast != null) { |
244 |
if (ast != null) { |
Lines 250-256
Link Here
|
250 |
} |
250 |
} |
251 |
return ast; |
251 |
return ast; |
252 |
} |
252 |
} |
253 |
|
253 |
|
254 |
protected CharSequence getScopeSuffix() { |
254 |
protected CharSequence getScopeSuffix() { |
255 |
return classTemplateSuffix != null ? classTemplateSuffix : CharSequences.empty(); |
255 |
return classTemplateSuffix != null ? classTemplateSuffix : CharSequences.empty(); |
256 |
} |
256 |
} |
Lines 262-275
Link Here
|
262 |
protected final CharSequence[] initRawName(AST node) { |
262 |
protected final CharSequence[] initRawName(AST node) { |
263 |
return findFunctionRawName(node); |
263 |
return findFunctionRawName(node); |
264 |
} |
264 |
} |
265 |
|
265 |
|
266 |
public CharSequence getDisplayName() { |
266 |
public CharSequence getDisplayName() { |
267 |
return (templateDescriptor != null) ? CharSequences.create((getName().toString() + templateDescriptor.getTemplateSuffix())) : getName(); // NOI18N |
267 |
return (templateDescriptor != null) ? CharSequences.create((getName().toString() + templateDescriptor.getTemplateSuffix())) : getName(); // NOI18N |
268 |
} |
268 |
} |
269 |
|
269 |
|
270 |
public List<CsmTemplateParameter> getTemplateParameters() { |
270 |
public List<CsmTemplateParameter> getTemplateParameters() { |
271 |
return (templateDescriptor != null) ? templateDescriptor.getTemplateParameters() : Collections.<CsmTemplateParameter>emptyList(); |
271 |
return (templateDescriptor != null) ? templateDescriptor.getTemplateParameters() : Collections.<CsmTemplateParameter>emptyList(); |
272 |
} |
272 |
} |
273 |
|
273 |
|
274 |
public List<CsmTemplateParameter> getInheritedTemplateParameters() { |
274 |
public List<CsmTemplateParameter> getInheritedTemplateParameters() { |
275 |
List<CsmTemplateParameter> allTemplateParams = getTemplateParameters(); |
275 |
List<CsmTemplateParameter> allTemplateParams = getTemplateParameters(); |
Lines 307-313
Link Here
|
307 |
public boolean isVoidParameterList(){ |
307 |
public boolean isVoidParameterList(){ |
308 |
return hasFlags(FLAGS_VOID_PARMLIST); |
308 |
return hasFlags(FLAGS_VOID_PARMLIST); |
309 |
} |
309 |
} |
310 |
|
310 |
|
311 |
private static String extractName(AST token){ |
311 |
private static String extractName(AST token){ |
312 |
int type = token.getType(); |
312 |
int type = token.getType(); |
313 |
if( type == CPPTokenTypes.ID ) { |
313 |
if( type == CPPTokenTypes.ID ) { |
Lines 363-369
Link Here
|
363 |
} |
363 |
} |
364 |
return ""; |
364 |
return ""; |
365 |
} |
365 |
} |
366 |
|
366 |
|
367 |
private static String findFunctionName(AST ast) { |
367 |
private static String findFunctionName(AST ast) { |
368 |
if( CastUtils.isCast(ast) ) { |
368 |
if( CastUtils.isCast(ast) ) { |
369 |
return CastUtils.getFunctionName(ast); |
369 |
return CastUtils.getFunctionName(ast); |
Lines 380-391
Link Here
|
380 |
return CastUtils.getFunctionRawName(ast); |
380 |
return CastUtils.getFunctionRawName(ast); |
381 |
} |
381 |
} |
382 |
return AstUtil.getRawNameInChildren(ast); |
382 |
return AstUtil.getRawNameInChildren(ast); |
383 |
} |
383 |
} |
384 |
|
384 |
|
385 |
protected boolean isCStyleStatic() { |
385 |
protected boolean isCStyleStatic() { |
386 |
return isStatic() && CsmKindUtilities.isFile(getScope()); |
386 |
return isStatic() && CsmKindUtilities.isFile(getScope()); |
387 |
} |
387 |
} |
388 |
|
388 |
|
389 |
protected void registerInProject() { |
389 |
protected void registerInProject() { |
390 |
if (isCStyleStatic()) { |
390 |
if (isCStyleStatic()) { |
391 |
// do NOT register in project C-style static funcions! |
391 |
// do NOT register in project C-style static funcions! |
Lines 397-403
Link Here
|
397 |
((ProjectBase) project).registerDeclaration(this); |
397 |
((ProjectBase) project).registerDeclaration(this); |
398 |
} |
398 |
} |
399 |
} |
399 |
} |
400 |
|
400 |
|
401 |
private void unregisterInProject() { |
401 |
private void unregisterInProject() { |
402 |
CsmProject project = getContainingFile().getProject(); |
402 |
CsmProject project = getContainingFile().getProject(); |
403 |
if( project instanceof ProjectBase ) { |
403 |
if( project instanceof ProjectBase ) { |
Lines 405-419
Link Here
|
405 |
this.cleanUID(); |
405 |
this.cleanUID(); |
406 |
} |
406 |
} |
407 |
} |
407 |
} |
408 |
|
408 |
|
409 |
|
409 |
|
410 |
/** Gets this element name |
410 |
/** Gets this element name |
411 |
* @return name |
411 |
* @return name |
412 |
*/ |
412 |
*/ |
413 |
public CharSequence getName() { |
413 |
public CharSequence getName() { |
414 |
return name; |
414 |
return name; |
415 |
} |
415 |
} |
416 |
|
416 |
|
417 |
public CharSequence getQualifiedName() { |
417 |
public CharSequence getQualifiedName() { |
418 |
CsmScope scope = getScope(); |
418 |
CsmScope scope = getScope(); |
419 |
if( (scope instanceof CsmNamespace) || (scope instanceof CsmClass) || (scope instanceof CsmNamespaceDefinition) ) { |
419 |
if( (scope instanceof CsmNamespace) || (scope instanceof CsmClass) || (scope instanceof CsmNamespaceDefinition) ) { |
Lines 424-434
Link Here
|
424 |
} |
424 |
} |
425 |
return getName(); |
425 |
return getName(); |
426 |
} |
426 |
} |
427 |
|
427 |
|
428 |
public CharSequence[] getRawName() { |
428 |
public CharSequence[] getRawName() { |
429 |
return rawName; |
429 |
return rawName; |
430 |
} |
430 |
} |
431 |
|
431 |
|
432 |
@Override |
432 |
@Override |
433 |
public CharSequence getUniqueNameWithoutPrefix() { |
433 |
public CharSequence getUniqueNameWithoutPrefix() { |
434 |
return getQualifiedName().toString() + getSignature().toString().substring(getName().length()); |
434 |
return getQualifiedName().toString() + getSignature().toString().substring(getName().length()); |
Lines 437-443
Link Here
|
437 |
public Kind getKind() { |
437 |
public Kind getKind() { |
438 |
return CsmDeclaration.Kind.FUNCTION; |
438 |
return CsmDeclaration.Kind.FUNCTION; |
439 |
} |
439 |
} |
440 |
|
440 |
|
441 |
/** Gets this function's declaration text |
441 |
/** Gets this function's declaration text |
442 |
* @return declaration text |
442 |
* @return declaration text |
443 |
*/ |
443 |
*/ |
Lines 509-515
Link Here
|
509 |
} |
509 |
} |
510 |
return def; |
510 |
return def; |
511 |
} |
511 |
} |
512 |
|
512 |
|
513 |
// method try to find definition in case cast operator definition is declared without scope |
513 |
// method try to find definition in case cast operator definition is declared without scope |
514 |
private CsmDeclaration fixCastOperator(CsmProject prj, String uname) { |
514 |
private CsmDeclaration fixCastOperator(CsmProject prj, String uname) { |
515 |
int i = uname.indexOf("operator "); // NOI18N |
515 |
int i = uname.indexOf("operator "); // NOI18N |
Lines 524-533
Link Here
|
524 |
return null; |
524 |
return null; |
525 |
} |
525 |
} |
526 |
|
526 |
|
|
|
527 |
public static boolean isObjectVisibleInFile(CsmFile currentFile, CsmOffsetableDeclaration item) { |
528 |
CsmFile file = item.getContainingFile(); |
529 |
if (file.equals(currentFile)) { |
530 |
return true; |
531 |
} |
532 |
return ((ProjectBase) currentFile.getProject()).getGraphStorage().isFileIncluded(currentFile, file); |
533 |
} |
534 |
|
527 |
private CsmFunctionDefinition findDefinition(CsmProject prj, String uname){ |
535 |
private CsmFunctionDefinition findDefinition(CsmProject prj, String uname){ |
528 |
CsmDeclaration res = prj.findDeclaration(uname); |
536 |
Collection<CsmOffsetableDeclaration> defs = prj.findDeclarations(uname); |
529 |
if (res == null && this.isOperator()) { |
537 |
CsmDeclaration res = null; |
530 |
res = fixCastOperator(prj, uname); |
538 |
if (defs.isEmpty()) { |
|
|
539 |
if (isOperator()) { |
540 |
res = fixCastOperator(prj, uname); |
541 |
} |
542 |
} else if (defs.size() == 1) { |
543 |
res = defs.iterator().next(); |
544 |
} else { |
545 |
for(CsmOffsetableDeclaration decl : defs) { |
546 |
if (decl instanceof CsmFunctionDefinition) { |
547 |
if (isObjectVisibleInFile(decl.getContainingFile(), this)) { |
548 |
res = decl; |
549 |
break; |
550 |
} |
551 |
if (res == null) { |
552 |
res = decl; |
553 |
} |
554 |
} |
555 |
} |
531 |
} |
556 |
} |
532 |
if (res instanceof CsmFunctionDefinition) { |
557 |
if (res instanceof CsmFunctionDefinition) { |
533 |
return (CsmFunctionDefinition)res; |
558 |
return (CsmFunctionDefinition)res; |
Lines 559-565
Link Here
|
559 |
} |
584 |
} |
560 |
return null; |
585 |
return null; |
561 |
} |
586 |
} |
562 |
|
587 |
|
563 |
/** |
588 |
/** |
564 |
* Returns true if this class is template, otherwise false. |
589 |
* Returns true if this class is template, otherwise false. |
565 |
* @return flag indicated if function is template |
590 |
* @return flag indicated if function is template |
Lines 567-573
Link Here
|
567 |
public boolean isTemplate() { |
592 |
public boolean isTemplate() { |
568 |
return templateDescriptor != null; |
593 |
return templateDescriptor != null; |
569 |
} |
594 |
} |
570 |
|
595 |
|
571 |
/** |
596 |
/** |
572 |
* Gets this function body. |
597 |
* Gets this function body. |
573 |
* The same as the following call: |
598 |
* The same as the following call: |
Lines 579-589
Link Here
|
579 |
public CsmCompoundStatement getBody() { |
604 |
public CsmCompoundStatement getBody() { |
580 |
return null; |
605 |
return null; |
581 |
} |
606 |
} |
582 |
|
607 |
|
583 |
public boolean isInline() { |
608 |
public boolean isInline() { |
584 |
return false; |
609 |
return false; |
585 |
} |
610 |
} |
586 |
|
611 |
|
587 |
// public boolean isVirtual() { |
612 |
// public boolean isVirtual() { |
588 |
// return false; |
613 |
// return false; |
589 |
// } |
614 |
// } |
Lines 591-597
Link Here
|
591 |
// public boolean isExplicit() { |
616 |
// public boolean isExplicit() { |
592 |
// return false; |
617 |
// return false; |
593 |
// } |
618 |
// } |
594 |
|
619 |
|
595 |
private CsmType initReturnType(AST node) { |
620 |
private CsmType initReturnType(AST node) { |
596 |
CsmType ret = null; |
621 |
CsmType ret = null; |
597 |
AST token = getTypeToken(node); |
622 |
AST token = getTypeToken(node); |
Lines 603-613
Link Here
|
603 |
} |
628 |
} |
604 |
return TemplateUtils.checkTemplateType(ret, FunctionImpl.this); |
629 |
return TemplateUtils.checkTemplateType(ret, FunctionImpl.this); |
605 |
} |
630 |
} |
606 |
|
631 |
|
607 |
public CsmType getReturnType() { |
632 |
public CsmType getReturnType() { |
608 |
return returnType; |
633 |
return returnType; |
609 |
} |
634 |
} |
610 |
|
635 |
|
611 |
private static AST getTypeToken(AST node) { |
636 |
private static AST getTypeToken(AST node) { |
612 |
for( AST token = node.getFirstChild(); token != null; token = token.getNextSibling() ) { |
637 |
for( AST token = node.getFirstChild(); token != null; token = token.getNextSibling() ) { |
613 |
int type = token.getType(); |
638 |
int type = token.getType(); |
Lines 631-637
Link Here
|
631 |
private FunctionParameterListImpl createParameterList(AST funAST, boolean isLocal) { |
656 |
private FunctionParameterListImpl createParameterList(AST funAST, boolean isLocal) { |
632 |
return FunctionParameterListImpl.create(getContainingFile(), funAST, this, isLocal); |
657 |
return FunctionParameterListImpl.create(getContainingFile(), funAST, this, isLocal); |
633 |
} |
658 |
} |
634 |
|
659 |
|
635 |
private boolean isVoidParameter(AST node) { |
660 |
private boolean isVoidParameter(AST node) { |
636 |
AST ast = findParameterNode(node); |
661 |
AST ast = findParameterNode(node); |
637 |
return AstRenderer.isVoidParameter(ast); |
662 |
return AstRenderer.isVoidParameter(ast); |
Lines 644-654
Link Here
|
644 |
public Collection<CsmParameter> getParameters() { |
669 |
public Collection<CsmParameter> getParameters() { |
645 |
return _getParameters(); |
670 |
return _getParameters(); |
646 |
} |
671 |
} |
647 |
|
672 |
|
648 |
public CsmScope getScope() { |
673 |
public CsmScope getScope() { |
649 |
return _getScope(); |
674 |
return _getScope(); |
650 |
} |
675 |
} |
651 |
|
676 |
|
652 |
public CharSequence getSignature() { |
677 |
public CharSequence getSignature() { |
653 |
if( signature == null ) { |
678 |
if( signature == null ) { |
654 |
signature = QualifiedNameCache.getManager().getString(createSignature()); |
679 |
signature = QualifiedNameCache.getManager().getString(createSignature()); |
Lines 659-669
Link Here
|
659 |
public CsmFunction getDeclaration() { |
684 |
public CsmFunction getDeclaration() { |
660 |
return this; |
685 |
return this; |
661 |
} |
686 |
} |
662 |
|
687 |
|
663 |
public boolean isOperator() { |
688 |
public boolean isOperator() { |
664 |
return hasFlags(FLAGS_OPERATOR); |
689 |
return hasFlags(FLAGS_OPERATOR); |
665 |
} |
690 |
} |
666 |
|
691 |
|
667 |
public OperatorKind getOperatorKind() { |
692 |
public OperatorKind getOperatorKind() { |
668 |
OperatorKind out = OperatorKind.NONE; |
693 |
OperatorKind out = OperatorKind.NONE; |
669 |
if (isOperator()) { |
694 |
if (isOperator()) { |
Lines 694-708
Link Here
|
694 |
out = (binaryKind != OperatorKind.NONE) ? binaryKind : nonBinaryKind; |
719 |
out = (binaryKind != OperatorKind.NONE) ? binaryKind : nonBinaryKind; |
695 |
} |
720 |
} |
696 |
} |
721 |
} |
697 |
return out; |
722 |
return out; |
698 |
} |
723 |
} |
699 |
|
724 |
|
700 |
public Collection<CsmScopeElement> getScopeElements() { |
725 |
public Collection<CsmScopeElement> getScopeElements() { |
701 |
Collection<CsmScopeElement> l = new ArrayList<CsmScopeElement>(); |
726 |
Collection<CsmScopeElement> l = new ArrayList<CsmScopeElement>(); |
702 |
l.addAll(getParameters()); |
727 |
l.addAll(getParameters()); |
703 |
return l; |
728 |
return l; |
704 |
} |
729 |
} |
705 |
|
730 |
|
706 |
private CharSequence createSignature() { |
731 |
private CharSequence createSignature() { |
707 |
// TODO: this fake implementation for Deimos only! |
732 |
// TODO: this fake implementation for Deimos only! |
708 |
// we should resolve parameter types and provide |
733 |
// we should resolve parameter types and provide |
Lines 719-725
Link Here
|
719 |
private void appendTemplateSignature(StringBuilder sb) { |
744 |
private void appendTemplateSignature(StringBuilder sb) { |
720 |
InstantiationProviderImpl.appendTemplateParamsSignature(getOwnTemplateParameters(), sb); |
745 |
InstantiationProviderImpl.appendTemplateParamsSignature(getOwnTemplateParameters(), sb); |
721 |
} |
746 |
} |
722 |
|
747 |
|
723 |
@Override |
748 |
@Override |
724 |
public void dispose() { |
749 |
public void dispose() { |
725 |
super.dispose(); |
750 |
super.dispose(); |
Lines 745-751
Link Here
|
745 |
assert (this.scopeRef != null || this.scopeUID == null) : "empty scope for UID " + this.scopeUID; |
770 |
assert (this.scopeRef != null || this.scopeUID == null) : "empty scope for UID " + this.scopeUID; |
746 |
} |
771 |
} |
747 |
} |
772 |
} |
748 |
|
773 |
|
749 |
private static boolean initConst(AST node) { |
774 |
private static boolean initConst(AST node) { |
750 |
AST token = node.getFirstChild(); |
775 |
AST token = node.getFirstChild(); |
751 |
while( token != null && token.getType() != CPPTokenTypes.CSM_QUALIFIED_ID) { |
776 |
while( token != null && token.getType() != CPPTokenTypes.CSM_QUALIFIED_ID) { |
Lines 759-765
Link Here
|
759 |
} |
784 |
} |
760 |
return false; |
785 |
return false; |
761 |
} |
786 |
} |
762 |
|
787 |
|
763 |
/** |
788 |
/** |
764 |
* isConst was originally in MethodImpl; |
789 |
* isConst was originally in MethodImpl; |
765 |
* but this methods needs internally in FunctionDefinitionImpl |
790 |
* but this methods needs internally in FunctionDefinitionImpl |
Lines 769-775
Link Here
|
769 |
protected boolean isConst() { |
794 |
protected boolean isConst() { |
770 |
return hasFlags(FLAGS_CONST); |
795 |
return hasFlags(FLAGS_CONST); |
771 |
} |
796 |
} |
772 |
|
797 |
|
773 |
private synchronized CsmScope _getScope() { |
798 |
private synchronized CsmScope _getScope() { |
774 |
CsmScope scope = this.scopeRef; |
799 |
CsmScope scope = this.scopeRef; |
775 |
if (scope == null) { |
800 |
if (scope == null) { |
Lines 779-785
Link Here
|
779 |
} |
804 |
} |
780 |
return scope; |
805 |
return scope; |
781 |
} |
806 |
} |
782 |
|
807 |
|
783 |
private Collection<CsmParameter> _getParameters() { |
808 |
private Collection<CsmParameter> _getParameters() { |
784 |
if (this.parameterList == null) { |
809 |
if (this.parameterList == null) { |
785 |
return Collections.<CsmParameter>emptyList(); |
810 |
return Collections.<CsmParameter>emptyList(); |
Lines 795-810
Link Here
|
795 |
return this.parameterList.getNrParameters(); |
820 |
return this.parameterList.getNrParameters(); |
796 |
} |
821 |
} |
797 |
} |
822 |
} |
798 |
|
823 |
|
799 |
private void _disposeParameters() { |
824 |
private void _disposeParameters() { |
800 |
if (this.parameterList != null) { |
825 |
if (this.parameterList != null) { |
801 |
parameterList.dispose(); |
826 |
parameterList.dispose(); |
802 |
} |
827 |
} |
803 |
} |
828 |
} |
804 |
|
829 |
|
805 |
//////////////////////////////////////////////////////////////////////////// |
830 |
//////////////////////////////////////////////////////////////////////////// |
806 |
// iml of SelfPersistent |
831 |
// iml of SelfPersistent |
807 |
|
832 |
|
808 |
@Override |
833 |
@Override |
809 |
public void write(DataOutput output) throws IOException { |
834 |
public void write(DataOutput output) throws IOException { |
810 |
super.write(output); |
835 |
super.write(output); |
Lines 814-824
Link Here
|
814 |
UIDObjectFactory factory = UIDObjectFactory.getDefaultFactory(); |
839 |
UIDObjectFactory factory = UIDObjectFactory.getDefaultFactory(); |
815 |
PersistentUtils.writeParameterList(this.parameterList, output); |
840 |
PersistentUtils.writeParameterList(this.parameterList, output); |
816 |
PersistentUtils.writeStrings(this.rawName, output); |
841 |
PersistentUtils.writeStrings(this.rawName, output); |
817 |
|
842 |
|
818 |
// not null UID |
843 |
// not null UID |
819 |
assert !CHECK_SCOPE || this.scopeUID != null; |
844 |
assert !CHECK_SCOPE || this.scopeUID != null; |
820 |
factory.writeUID(this.scopeUID, output); |
845 |
factory.writeUID(this.scopeUID, output); |
821 |
|
846 |
|
822 |
PersistentUtils.writeUTF(this.signature, output); |
847 |
PersistentUtils.writeUTF(this.signature, output); |
823 |
output.writeByte(flags); |
848 |
output.writeByte(flags); |
824 |
PersistentUtils.writeUTF(getScopeSuffix(), output); |
849 |
PersistentUtils.writeUTF(getScopeSuffix(), output); |
Lines 833-844
Link Here
|
833 |
UIDObjectFactory factory = UIDObjectFactory.getDefaultFactory(); |
858 |
UIDObjectFactory factory = UIDObjectFactory.getDefaultFactory(); |
834 |
this.parameterList = (FunctionParameterListImpl) PersistentUtils.readParameterList(input); |
859 |
this.parameterList = (FunctionParameterListImpl) PersistentUtils.readParameterList(input); |
835 |
this.rawName = PersistentUtils.readStrings(input, NameCache.getManager()); |
860 |
this.rawName = PersistentUtils.readStrings(input, NameCache.getManager()); |
836 |
|
861 |
|
837 |
this.scopeUID = factory.readUID(input); |
862 |
this.scopeUID = factory.readUID(input); |
838 |
// not null UID |
863 |
// not null UID |
839 |
assert !CHECK_SCOPE || this.scopeUID != null; |
864 |
assert !CHECK_SCOPE || this.scopeUID != null; |
840 |
this.scopeRef = null; |
865 |
this.scopeRef = null; |
841 |
|
866 |
|
842 |
this.signature = PersistentUtils.readUTF(input, QualifiedNameCache.getManager()); |
867 |
this.signature = PersistentUtils.readUTF(input, QualifiedNameCache.getManager()); |
843 |
this.flags = input.readByte(); |
868 |
this.flags = input.readByte(); |
844 |
this.classTemplateSuffix = PersistentUtils.readUTF(input, NameCache.getManager()); |
869 |
this.classTemplateSuffix = PersistentUtils.readUTF(input, NameCache.getManager()); |