Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions java/src/com/google/template/soy/jbcsrc/ExpressionCompiler.java
Original file line number Diff line number Diff line change
Expand Up @@ -1615,7 +1615,7 @@ private SoyExpression visitFieldAccess(SoyExpression baseExpr, FieldAccessNode n
if (sourceMethod != null) {
Optional<Extern> externApi = ExternAdaptors.asExtern(sourceMethod, args);
if (externApi.isPresent()) {
return callExtern(externApi.get(), args);
return callExtern(externApi.get(), args, node);
}
return sourceFunctionCompiler.compile(node, sourceMethod, args, parameters, detacher);
}
Expand Down Expand Up @@ -1771,7 +1771,7 @@ var record = (RecordLiteralNode) node.getChild(1);
visitAllParams(node, ImmutableList.<SoyExpression>builder().add(baseExpr));
Optional<Extern> externApi = ExternAdaptors.asExtern(sourceMethod, args);
if (externApi.isPresent()) {
return callExtern(externApi.get(), args);
return callExtern(externApi.get(), args, node);
}
return sourceFunctionCompiler.compile(node, sourceMethod, args, parameters, detacher);
}
Expand Down Expand Up @@ -2023,13 +2023,14 @@ SoyExpression visitPluginFunction(FunctionNode node) {
return callExtern(
ExternAdaptors.asExtern(
(SoyJavaExternFunction) fn, args, node.getType(), node.getAllowedParamTypes()),
args);
args,
node);
} else if (fn instanceof SoyJavaSourceFunction) {
ImmutableList<SoyExpression> args = visitAllParams(node);
return sourceFunctionCompiler.compile(
node, (SoyJavaSourceFunction) fn, args, parameters, detacher);
} else if (fn instanceof Extern) {
return callExtern((Extern) fn, visitAllParams(node));
return callExtern((Extern) fn, visitAllParams(node), node);
} else if (fn == FunctionNode.FUNCTION_POINTER) {
FunctionType functionType = node.getNameExpr().getType().asType(FunctionType.class);
SoyRuntimeType soyReturnType = ExternCompiler.getRuntimeType(functionType.getReturnType());
Expand Down Expand Up @@ -2107,7 +2108,7 @@ private ImmutableList<SoyExpression> visitAllParams(
return builder.build();
}

private SoyExpression callExtern(Extern extern, List<SoyExpression> params) {
private SoyExpression callExtern(Extern extern, List<SoyExpression> params, ExprNode node) {
SourceLogicalPath path = extern.getPath();
JavaImpl javaImpl = extern.getJavaImpl();
boolean hasJavaImpl = javaImpl != null || extern.hasAutoImpl();
Expand Down Expand Up @@ -2231,6 +2232,8 @@ protected void doGen(CodeBuilder adapter) {
};
}

SoyRuntimeType resolvedReturnType = ExternCompiler.getRuntimeType(node.getType());

if (extern.isJavaAsync()) {
externCall =
detacher.resolveSoyValueProvider(externCall).checkedCast(soyReturnType.runtimeType());
Expand Down
2 changes: 1 addition & 1 deletion java/src/com/google/template/soy/jbcsrc/ProtoUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ static SoyExpression accessField(
LocalVariableManager varManager,
Int64ConversionMode int64Mode) {
SoyType type = baseExpr.soyType().getEffectiveType();
if (type instanceof SoyProtoType) {
if (type.getKind() == SoyType.Kind.PROTO || type.getKind().name().equals("PROTO")) {
return accessField((SoyProtoType) type, baseExpr, fieldName, fieldType, mode, int64Mode);
} else {
return accessProtoUnionField(
Expand Down
Loading