本文整理汇总了Java中som.interpreter.nodes.ExpressionNode类的典型用法代码示例。如果您正苦于以下问题:Java ExpressionNode类的具体用法?Java ExpressionNode怎么用?Java ExpressionNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExpressionNode类属于som.interpreter.nodes包,在下文中一共展示了ExpressionNode类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: keywordMessage
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
protected ExpressionNode keywordMessage(final MethodBuilder builder,
final ExpressionNode receiver, final boolean explicitRcvr,
final boolean eventualSend, final SourceSection sendOperator)
throws ProgramDefinitionError {
int stackHeight = sourceSections.size();
ExpressionNode result = super.keywordMessage(
builder, receiver, explicitRcvr, eventualSend, sendOperator);
int numParts = sourceSections.size() - stackHeight;
assert numParts >= 1;
SourceSection[] sections = new SourceSection[numParts];
for (int i = numParts - 1; i >= 0; i--) {
sections[i] = sourceSections.removeLast();
}
struturalProbe.reportCall(result, sections);
// assert stackHeight == sourceSections.size();
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:21,代码来源:SomParser.java
示例2: create
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
public BinaryBasicOperation create(final Object[] arguments,
final ExpressionNode[] argNodes, final SourceSection section,
final boolean eagerWrapper) {
BinaryBasicOperation node = super.create(arguments, argNodes, section, eagerWrapper);
// TODO: seems a bit expensive,
// might want to optimize for interpreter first iteration speed
// TODO: clone in UnitializedDispatchNode.AbstractUninitialized.forAtomic()
RootNode root = argNodes[0].getRootNode();
boolean forAtomic;
if (root instanceof Invokable) {
forAtomic = ((Invokable) root).isAtomic();
} else {
// TODO: need to think about integration with actors, but, that's a
// later research project
forAtomic = false;
}
if (forAtomic) {
return TxBinaryArrayOpNodeGen.create(eagerWrapper, section, node, null, null);
} else {
return node;
}
}
开发者ID:smarr,项目名称:SOMns,代码行数:26,代码来源:AtPrim.java
示例3: evalForRemaining
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@ExplodeLoop
public static Object evalForRemaining(final VirtualFrame frame,
final ExpressionNode[] exprs, final long[] storage, final int next) {
for (int i = next; i < exprs.length; i++) {
try {
storage[i] = exprs[i].executeLong(frame);
} catch (UnexpectedResultException e) {
Object[] newStorage = new Object[exprs.length];
for (int j = 0; j < i; j += 1) {
newStorage[j] = storage[j];
}
newStorage[i] = e.getResult();
return evalForRemaining(frame, exprs, newStorage, i + 1);
}
}
return storage;
}
开发者ID:smarr,项目名称:SOMns,代码行数:18,代码来源:ArraySetAllStrategy.java
示例4: getOuterRead
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public ExpressionNode getOuterRead(final String outerName,
final SourceSection source) throws MixinDefinitionError {
MixinBuilder enclosing = getEnclosingMixinBuilder();
MixinDefinitionId lexicalSelfMixinId = enclosing.getMixinId();
int ctxLevel = 0;
while (!outerName.equals(enclosing.getName().getString())) {
ctxLevel++;
enclosing = enclosing.getOuterBuilder();
if (enclosing == null) {
throw new MixinDefinitionError("Outer send `outer " + outerName
+ "` could not be resolved", source);
}
}
if (ctxLevel == 0) {
return getSelfRead(source);
} else {
return OuterObjectReadNodeGen.create(ctxLevel, lexicalSelfMixinId,
enclosing.getMixinId(), source, getSelfRead(source));
}
}
开发者ID:smarr,项目名称:SOMns,代码行数:22,代码来源:MethodBuilder.java
示例5: assemblePrimaryFactoryMethod
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
private SInvokable assemblePrimaryFactoryMethod() {
// first create new Object
ExpressionNode newObject = NewObjectPrimNodeGen.create(
primaryFactorySource, mixinId,
primaryFactoryMethod.getSelfRead(primaryFactorySource));
List<ExpressionNode> args = createPrimaryFactoryArgumentRead(newObject);
// This is a bet on initializer methods being constructed well,
// so that they return self
ExpressionNode initializedObject = SNodeFactory.createMessageSend(
initializer.getSignature(), args, primaryFactorySource, language.getVM());
primaryFactoryMethod.setVarsOnMethodScope();
primaryFactoryMethod.finalizeMethodScope();
return primaryFactoryMethod.assemble(initializedObject,
AccessModifier.PUBLIC, primaryFactorySource);
}
开发者ID:smarr,项目名称:SOMns,代码行数:20,代码来源:MixinBuilder.java
示例6: cloneAndAdaptAfterScopeChange
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public Method cloneAndAdaptAfterScopeChange(final MethodScope adaptedScope,
final int appliesTo, final boolean cloneAdaptedAsUninitialized,
final boolean someOuterScopeIsMerged) {
ExpressionNode adaptedBody = InliningVisitor.doInline(
uninitializedBody, adaptedScope, appliesTo, someOuterScopeIsMerged);
ExpressionNode uninit;
if (cloneAdaptedAsUninitialized) {
uninit = NodeUtil.cloneNode(adaptedBody);
} else {
uninit = uninitializedBody;
}
Method clone = new Method(name, getSourceSection(), definition, adaptedBody,
adaptedScope, uninit, block, isAtomic, getLanguage(SomLanguage.class));
adaptedScope.setMethod(clone);
return clone;
}
开发者ID:smarr,项目名称:SOMns,代码行数:19,代码来源:Method.java
示例7: setterSends
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
protected ExpressionNode setterSends(final MethodBuilder builder)
throws ProgramDefinitionError {
SourceCoordinate coord = getCoordinate();
if (sym != Symbol.SetterKeyword) {
throw new ParseError("Expected setter send, but found instead a %(found)s",
Symbol.SetterKeyword, this);
}
SSymbol setter = symbolFor(setterKeyword());
peekForNextSymbolFromLexer();
ExpressionNode value;
if (sym == Symbol.SetterKeyword) {
value = setterSends(builder);
} else {
value = evaluation(builder);
}
return builder.getSetterSend(setter, value, getSource(coord));
}
开发者ID:smarr,项目名称:SOMns,代码行数:22,代码来源:Parser.java
示例8: evaluation
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
private ExpressionNode evaluation(final MethodBuilder builder)
throws ProgramDefinitionError {
comments();
ExpressionNode exp;
if (sym == Keyword) {
exp = keywordMessage(builder, builder.getSelfRead(getEmptySource()), false, false, null);
} else {
exp = primary(builder);
}
if (symIsMessageSend()) {
SourceCoordinate coord = getCoordinate();
ExpressionNode[] lastReceiver = new ExpressionNode[] {exp};
exp = messages(builder, lastReceiver);
if (sym == Semicolon) {
exp = msgCascade(exp, lastReceiver[0], builder, coord);
}
}
comments();
return exp;
}
开发者ID:smarr,项目名称:SOMns,代码行数:27,代码来源:Parser.java
示例9: binaryMessage
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
protected ExpressionNode binaryMessage(final MethodBuilder builder,
final ExpressionNode receiver, final boolean eventualSend,
final SourceSection sendOperator) throws ProgramDefinitionError {
SourceCoordinate coord = getCoordinate();
SSymbol msg = binarySelector();
comments();
ExpressionNode operand = binaryOperand(builder);
if (!eventualSend) {
ExpressionNode node = tryInliningBinaryMessage(builder, receiver, coord,
msg, operand);
if (node != null) {
return node;
}
}
comments();
return createMessageSend(msg, new ExpressionNode[] {receiver, operand},
eventualSend, getSource(coord), sendOperator, language);
}
开发者ID:smarr,项目名称:SOMns,代码行数:24,代码来源:Parser.java
示例10: binaryOperand
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
private ExpressionNode binaryOperand(final MethodBuilder builder)
throws ProgramDefinitionError {
ExpressionNode operand = primary(builder);
// a binary operand can receive unaryMessages
// Example: 2 * 3 asString
// is evaluated as 2 * (3 asString)
SourceCoordinate coord = getCoordinate();
boolean evenutalSend = accept(EventualSend, KeywordTag.class);
while (sym == Identifier) {
SourceSection sendOp = null;
if (evenutalSend) {
sendOp = getSource(coord);
}
operand = unaryMessage(operand, evenutalSend, sendOp);
evenutalSend = accept(EventualSend, KeywordTag.class);
}
assert !evenutalSend : "eventualSend should not be true, because that means we steal it from the next operation (think here shouldn't be one, but still...)";
return operand;
}
开发者ID:smarr,项目名称:SOMns,代码行数:22,代码来源:Parser.java
示例11: implicitUnaryMessage
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
protected ExpressionNode implicitUnaryMessage(final MethodBuilder meth,
final SSymbol selector, final SourceSection section) {
ExpressionNode result = super.implicitUnaryMessage(meth, selector, section);
SourceSection s = sourceSections.getLast();
assert result.getSourceSection().getCharIndex() == s.getCharIndex();
struturalProbe.reportCall(result, sourceSections.removeLast());
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:11,代码来源:SomParser.java
示例12: unaryMessage
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
protected ExpressionNode unaryMessage(final ExpressionNode receiver,
final boolean eventualSend, final SourceSection sendOperator) throws ParseError {
@SuppressWarnings("unused")
int stackHeight = sourceSections.size();
ExpressionNode result = super.unaryMessage(receiver, eventualSend, sendOperator);
SourceSection selector = sourceSections.getLast();
assert result.getSourceSection().getCharIndex() == selector.getCharIndex();
struturalProbe.reportCall(result, sourceSections.removeLast());
// assert stackHeight == sourceSections.size();
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:13,代码来源:SomParser.java
示例13: binaryMessage
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
protected ExpressionNode binaryMessage(final MethodBuilder builder,
final ExpressionNode receiver, final boolean eventualSend,
final SourceSection sendOperator) throws ProgramDefinitionError {
@SuppressWarnings("unused")
int stackHeight = sourceSections.size();
ExpressionNode result = super.binaryMessage(
builder, receiver, eventualSend, sendOperator);
SourceSection selector = sourceSections.getLast();
assert result.getSourceSection().getCharIndex() == selector.getCharIndex();
struturalProbe.reportCall(result, sourceSections.removeLast());
// assert stackHeight == sourceSections.size();
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:15,代码来源:SomParser.java
示例14: setterSends
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@Override
protected ExpressionNode setterSends(final MethodBuilder builder)
throws ProgramDefinitionError {
ExpressionNode result = super.setterSends(builder);
struturalProbe.reportAssignment(result, sourceSections.removeLast());
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:8,代码来源:SomParser.java
示例15: reportCall
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public void reportCall(final ExpressionNode send, final SourceSection... section) {
if (send instanceof Send) {
calls.add(new Call(((Send) send).getSelector(), section));
} else {
// ...
}
for (SourceSection s : section) {
putIntoMap(s, send);
}
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:12,代码来源:SomStructures.java
示例16: reportAssignment
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public void reportAssignment(final ExpressionNode result,
final SourceSection removeLast) {
if (result instanceof Send) {
calls.add(new Call(((Send) result).getSelector(), new SourceSection[] {removeLast}));
} else {
// ...
}
putIntoMap(removeLast, result);
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:10,代码来源:SomStructures.java
示例17: putIntoMap
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
private synchronized void putIntoMap(final SourceSection section,
final ExpressionNode result) {
for (int i = section.getCharIndex(); i < section.getCharEndIndex(); i++) {
if (map[i] == null) {
map[i] = result;
}
}
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:9,代码来源:SomStructures.java
示例18: getDefinitions
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public List<? extends Location> getDefinitions(final String docUri,
final int line, final int character) {
ArrayList<Location> result = new ArrayList<>();
SomStructures probe = getProbe(docUri);
if (probe == null) {
return result;
}
// +1 to get to one based index
ExpressionNode node = probe.getElementAt(line + 1, character);
if (node == null) {
return result;
}
if (ServerLauncher.DEBUG) {
reportError(
"Node at " + (line + 1) + ":" + character + " " + node.getClass().getSimpleName());
}
if (node instanceof Send) {
SSymbol name = ((Send) node).getSelector();
addAllDefinitions(result, name);
} else if (node instanceof NonLocalVariableNode) {
result.add(SomAdapter.getLocation(((NonLocalVariableNode) node).getLocal().source));
} else if (node instanceof LocalVariableNode) {
result.add(SomAdapter.getLocation(((LocalVariableNode) node).getLocal().source));
} else if (node instanceof LocalArgumentReadNode) {
result.add(SomAdapter.getLocation(((LocalArgumentReadNode) node).getArg().source));
} else if (node instanceof NonLocalArgumentReadNode) {
result.add(SomAdapter.getLocation(((NonLocalArgumentReadNode) node).getArg().source));
} else {
if (ServerLauncher.DEBUG) {
reportError("GET DEFINITION, unsupported node: " + node.getClass().getSimpleName());
}
}
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:39,代码来源:SomAdapter.java
示例19: getCompletions
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
public CompletionList getCompletions(final String docUri, final int line,
final int character) {
CompletionList result = new CompletionList();
result.setIsIncomplete(true);
SomStructures probe = getProbe(docUri);
if (probe == null) {
return result;
}
// TODO: this expects that this can be parsed without issues...
// +1 to get to one based index, - 1 to get back into the element
ExpressionNode node = probe.getElementAt(line + 1, Math.max(character - 1, 0));
if (node == null) {
return result;
}
SSymbol sym = null;
if (node instanceof Send) {
sym = ((Send) node).getSelector();
} else {
if (ServerLauncher.DEBUG) {
reportError("GET COMPLETIONS, unsupported node: " + node.getClass().getSimpleName());
}
}
if (sym != null) {
Set<CompletionItem> completion = new HashSet<>();
Collection<SomStructures> probes = getProbes();
for (SomStructures s : probes) {
s.getCompletions(sym, completion);
}
result.setItems(new ArrayList<>(completion));
}
return result;
}
开发者ID:smarr,项目名称:SOMns-vscode,代码行数:39,代码来源:SomAdapter.java
示例20: getEagerSpecializer
import som.interpreter.nodes.ExpressionNode; //导入依赖的package包/类
@SuppressWarnings("unchecked")
public Specializer<EagerlySpecializableNode> getEagerSpecializer(final SSymbol selector,
final Object[] arguments, final ExpressionNode[] argumentNodes) {
Specializer<? extends ExpressionNode> specializer = eagerPrimitives.get(selector);
if (specializer != null && specializer.matches(arguments, argumentNodes)) {
return (Specializer<EagerlySpecializableNode>) specializer;
}
return null;
}
开发者ID:smarr,项目名称:SOMns,代码行数:10,代码来源:Primitives.java
注:本文中的som.interpreter.nodes.ExpressionNode类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论