commit
30b5b4fc83
|
@ -102,7 +102,7 @@ class Analyzer extends PainlessParserBaseVisitor<Void> {
|
|||
metadata.scorerValueSlot = utility.addVariable(null, "#scorer", definition.objectType).slot;
|
||||
// doc parameter passed to the script.
|
||||
// TODO: currently working as a def type, should be smapType...
|
||||
metadata.docValueSlot = utility.addVariable(null, "doc", definition.defType).slot;
|
||||
metadata.docValueSlot = utility.addVariable(null, "doc", definition.smapType).slot;
|
||||
//
|
||||
// reserved words implemented as local variables
|
||||
//
|
||||
|
|
|
@ -238,14 +238,6 @@ class AnalyzerExternal {
|
|||
definition.getType(parentemd.current.struct, parentemd.current.type.getDimensions() - 1);
|
||||
analyzeLoadStoreExternal(ctx);
|
||||
parentemd.current = braceenmd.type;
|
||||
|
||||
if (dotctx != null) {
|
||||
metadata.createExtNodeMetadata(parent, dotctx);
|
||||
analyzer.visit(dotctx);
|
||||
} else if (bracectx != null) {
|
||||
metadata.createExtNodeMetadata(parent, bracectx);
|
||||
analyzer.visit(bracectx);
|
||||
}
|
||||
} else {
|
||||
final boolean store = braceenmd.last && parentemd.storeExpr != null;
|
||||
final boolean get = parentemd.read || parentemd.token > 0 || !braceenmd.last;
|
||||
|
@ -319,6 +311,14 @@ class AnalyzerExternal {
|
|||
throw new IllegalArgumentException(AnalyzerUtility.error(ctx) +
|
||||
"Attempting to address a non-array type [" + parentemd.current.name + "] as an array.");
|
||||
}
|
||||
|
||||
if (dotctx != null) {
|
||||
metadata.createExtNodeMetadata(parent, dotctx);
|
||||
analyzer.visit(dotctx);
|
||||
} else if (bracectx != null) {
|
||||
metadata.createExtNodeMetadata(parent, bracectx);
|
||||
analyzer.visit(bracectx);
|
||||
}
|
||||
}
|
||||
|
||||
void processExtdot(final ExtdotContext ctx) {
|
||||
|
@ -449,7 +449,7 @@ class AnalyzerExternal {
|
|||
}
|
||||
|
||||
// special cases: reserved words
|
||||
if ("_score".equals(id) || "doc".equals(id)) {
|
||||
if (varenmd.last && ("_score".equals(id) || "doc".equals(id))) {
|
||||
// read-only: don't allow stores
|
||||
if (parentemd.storeExpr != null) {
|
||||
throw new IllegalArgumentException(AnalyzerUtility.error(ctx) + "Variable [" + id + "] is read-only.");
|
||||
|
|
|
@ -306,18 +306,14 @@ class WriterExternal {
|
|||
final boolean cat = utility.containsStrings(parentemd.storeExpr);
|
||||
|
||||
if (cat) {
|
||||
if (field || name || shortcut) {
|
||||
execute.dupX1();
|
||||
} else if (array) {
|
||||
execute.dup2X1();
|
||||
}
|
||||
|
||||
if (maplist) {
|
||||
if (constant != null) {
|
||||
if (maplist && constant != null) {
|
||||
utility.writeConstant(source, constant);
|
||||
}
|
||||
|
||||
execute.dupX2();
|
||||
if (field || name || (shortcut && !maplist)) {
|
||||
execute.dupX1();
|
||||
} else if (array || maplist) {
|
||||
execute.dup2X1();
|
||||
}
|
||||
|
||||
writeLoadStoreInstruction(source, false, variable, field, name, array, shortcut);
|
||||
|
@ -340,18 +336,14 @@ class WriterExternal {
|
|||
} else if (parentemd.token > 0) {
|
||||
final int token = parentemd.token;
|
||||
|
||||
if (field || name || shortcut) {
|
||||
execute.dup();
|
||||
} else if (array) {
|
||||
execute.dup2();
|
||||
}
|
||||
|
||||
if (maplist) {
|
||||
if (constant != null) {
|
||||
if (maplist && constant != null) {
|
||||
utility.writeConstant(source, constant);
|
||||
}
|
||||
|
||||
execute.dupX1();
|
||||
if (field || name || (shortcut && !maplist)) {
|
||||
execute.dup();
|
||||
} else if (array || maplist) {
|
||||
execute.dup2();
|
||||
}
|
||||
|
||||
writeLoadStoreInstruction(source, false, variable, field, name, array, shortcut);
|
||||
|
|
Loading…
Reference in New Issue