@Override public Optional<InternalConstructorDefinition> findConstructor(List<ActualParam> actualParams) { ensureIsInitialized(symbolResolver()); for (InternalConstructorDefinition constructor : constructors) { if (constructor.match(symbolResolver(), actualParams)) { return Optional.of(constructor); } } return Optional.empty(); }
@Override public Optional<Symbol> findSymbol(String name, SymbolResolver resolver) { // TODO support references to methods for (Property property : this.getAllProperties(resolver)) { if (property.getName().equals(name)) { return Optional.of(property); } } return super.findSymbol(name, resolver); }
@Override public Optional<Invokable> getMethod( String method, boolean staticContext, Map<String, TypeUsage> typeParams) { ensureIsInitialized(symbolResolver()); Set<InternalMethodDefinition> methods = Collections.emptySet(); if (methodsByName.containsKey(method)) { methods = methodsByName .get(method) .stream() .filter((m) -> m.getJvmMethodDefinition().isStatic() == staticContext) .collect(Collectors.toSet()); } if (methods.isEmpty()) { return Optional.empty(); } else { return Optional.of(new MethodSetAsInvokableType(methods, typeParams)); } }
public void setBaseType(TypeUsageNode baseType) { baseType.setParent(this); this.baseType = Optional.of(baseType); }