當前位置: 首頁>>代碼示例>>Java>>正文


Java ExpressionNode類代碼示例

本文整理匯總了Java中som.interpreter.nodes.ExpressionNode的典型用法代碼示例。如果您正苦於以下問題:Java ExpressionNode類的具體用法?Java ExpressionNode怎麽用?Java ExpressionNode使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ExpressionNode類屬於som.interpreter.nodes包,在下文中一共展示了ExpressionNode類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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


注:本文中的som.interpreter.nodes.ExpressionNode類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。