当前位置: 首页>>代码示例>>Java>>正文


Java StaticScope类代码示例

本文整理汇总了Java中com.google.javascript.rhino.jstype.StaticScope的典型用法代码示例。如果您正苦于以下问题:Java StaticScope类的具体用法?Java StaticScope怎么用?Java StaticScope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StaticScope类属于com.google.javascript.rhino.jstype包,在下文中一共展示了StaticScope类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getDescriptionForThrownType

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/**
 * Returns the description for the given thrown type, if it
 * exists.
 */
public String getDescriptionForThrownType(JSType type,
    StaticScope<JSType> scope) {
  if (documentation == null || documentation.throwsDescriptions == null) {
    return null;
  }

  for (JSTypeExpression typeExpr :
           documentation.throwsDescriptions.keySet()) {
    if (type.canAssignTo(typeExpr.evaluate(scope))) {
      return documentation.throwsDescriptions.get(typeExpr);
    }
  }

  return null;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:20,代码来源:JSDocInfo.java

示例2: createFunctionScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
@Override
public StaticScope<ConcreteType> createFunctionScope(
    Node decl, StaticScope<ConcreteType> parent) {
  ConcreteScope scope = new ConcreteScope((ConcreteScope) parent);
  scope.declareSlot(ConcreteFunctionType.CALL_SLOT_NAME, decl);
  scope.declareSlot(ConcreteFunctionType.THIS_SLOT_NAME, decl);
  scope.declareSlot(ConcreteFunctionType.RETURN_SLOT_NAME, decl);
  for (Node n = decl.getFirstChild().getNext().getFirstChild();
       n != null;
       n = n.getNext()) {
    scope.declareSlot(n.getString(), n);
  }
  // TODO(user): Create an 'arguments' variable that returns the union
  //     of the concrete types of all parameters.
  scope.initForScopeRoot(decl.getLastChild());
  return scope;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:18,代码来源:TightenTypes.java

示例3: createInstanceScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** @inheritDoc */
public StaticScope<ConcreteType> createInstanceScope(
    ObjectType instanceType) {
  FakeScope parentScope = null;
  if (instanceType.getImplicitPrototype() != null) {
    ConcreteInstanceType prototype =
        createConcreteInstance(instanceType.getImplicitPrototype());
    parentScope = (FakeScope) prototype.getScope();
  }

  FakeScope scope = new FakeScope(parentScope);
  for (String propName : instanceType.getOwnPropertyNames()) {
    scope.addSlot(propName);
  }
  return scope;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:17,代码来源:ConcreteTypeTest.java

示例4: createInstanceScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** {@inheritDoc} */
public StaticScope<ConcreteType> createInstanceScope(
    ObjectType instanceType) {
  FakeScope parentScope = null;
  if (instanceType.getImplicitPrototype() != null) {
    ConcreteInstanceType prototype =
        createConcreteInstance(instanceType.getImplicitPrototype());
    parentScope = (FakeScope) prototype.getScope();
  }

  FakeScope scope = new FakeScope(parentScope);
  for (String propName : instanceType.getOwnPropertyNames()) {
    scope.addSlot(propName);
  }
  return scope;
}
 
开发者ID:ehsan,项目名称:js-symbolic-executor,代码行数:17,代码来源:ConcreteTypeTest.java

示例5: createInstanceScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public StaticScope<ConcreteType> createInstanceScope(
    ObjectType instanceType) {
  FakeScope parentScope = null;
  if (instanceType.getImplicitPrototype() != null) {
    ConcreteInstanceType prototype =
        createConcreteInstance(instanceType.getImplicitPrototype());
    parentScope = (FakeScope) prototype.getScope();
  }

  FakeScope scope = new FakeScope(parentScope);
  for (String propName : instanceType.getOwnPropertyNames()) {
    scope.addSlot(propName);
  }
  return scope;
}
 
开发者ID:SpoonLabs,项目名称:astor,代码行数:18,代码来源:ConcreteTypeTest.java

示例6: evaluate

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/**
 * Evaluates the type expression into a {@code JSType} object.
 */
public JSType evaluate(StaticScope<JSType> scope) {
  JSType type = registry.createFromTypeNodes(root, sourceName, scope);
  if (root.getBooleanProp(Node.BRACELESS_TYPE)) {
    type.forgiveUnknownNames();
  }
  return type;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:11,代码来源:JSTypeExpression.java

示例7: assertValidResolve

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** @return The resolved type */
public static JSType assertValidResolve(
    JSType type, StaticScope<JSType> scope) {
  ErrorReporter t = TestErrorReporter.forNoExpectedReports();
  JSType resolvedType = type.resolve(t, scope);
  Assert.assertEquals("JSType#resolve should not affect object equality",
      type, resolvedType);
  Assert.assertEquals("JSType#resolve should not affect hash codes",
      type.hashCode(), resolvedType.hashCode());
  return resolvedType;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:12,代码来源:Asserts.java

示例8: ConcreteFunctionType

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
ConcreteFunctionType(Factory factory,
                     Node declaration,
                     StaticScope<ConcreteType> parentScope) {
  this.factory = factory;
  this.declaration = declaration;
  this.parentScope = parentScope;

  Preconditions.checkArgument(declaration.getType() == Token.FUNCTION);
  Preconditions.checkArgument(declaration.getJSType() != null);
  Preconditions.checkArgument(declaration.getJSType().isFunctionType());
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:12,代码来源:ConcreteType.java

示例9: getScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** Returns the scope for the body of this function. */
@Override StaticScope<ConcreteType> getScope() {
  if (bodyScope == null) {
    bodyScope = factory.createFunctionScope(declaration, parentScope);
  }
  return bodyScope;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:8,代码来源:ConcreteType.java

示例10: createConcreteFunction

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
@Override
public ConcreteFunctionType createConcreteFunction(
    Node decl, StaticScope<ConcreteType> parent) {
  ConcreteFunctionType funType = functionFromDeclaration.get(decl);
  if (funType == null) {
    functionFromDeclaration.put(decl,
        funType = new ConcreteFunctionType(this, decl, parent));
    if (decl.getJSType() != null) {
      functionFromJSType.put((FunctionType) decl.getJSType(), funType);
    }
  }
  return funType;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:14,代码来源:TightenTypes.java

示例11: createInstanceScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
@Override
public StaticScope<ConcreteType> createInstanceScope(
    ObjectType instanceType) {
  ConcreteScope parentScope = null;
  if (instanceType.getImplicitPrototype() != null) {
    ConcreteInstanceType prototype =
        createConcreteInstance(instanceType.getImplicitPrototype());
    parentScope = (ConcreteScope) prototype.getScope();
  }
  ConcreteScope scope = new ConcreteScope(parentScope);
  for (String propName : instanceType.getOwnPropertyNames()) {
    scope.declareSlot(propName, null);
  }
  return scope;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:16,代码来源:TightenTypes.java

示例12: process

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
public void process(Node externs, Node root) {
  for (TypeMismatch mis : compiler.getTypeValidator().getMismatches()) {
    addInvalidatingType(mis.typeA);
    addInvalidatingType(mis.typeB);
  }

  StaticScope<T> scope = typeSystem.getRootScope();
  NodeTraversal.traverse(compiler, externs, new FindExternProperties());
  NodeTraversal.traverse(compiler, root, new FindRenameableProperties());
  renameProperties();
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:12,代码来源:DisambiguateProperties.java

示例13: getType

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
@Override public JSType getType(
    StaticScope<JSType> scope, Node node, String prop) {
  if (node.getJSType() == null) {
    return registry.getNativeType(JSTypeNative.UNKNOWN_TYPE);
  }
  return node.getJSType();
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:8,代码来源:DisambiguateProperties.java

示例14: createConcreteFunction

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** @inheritDoc */
public ConcreteFunctionType createConcreteFunction(
    Node decl, StaticScope<ConcreteType> parent) {
  ConcreteFunctionType funcType = functionByDeclaration.get(decl);
  if (funcType == null) {
    functionByDeclaration.put(decl, funcType =
        new ConcreteFunctionType(this, decl, parent));
    if (decl.getJSType() != null) {
      functionByJSType.put((FunctionType) decl.getJSType(), funcType);
    }
  }
  return funcType;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:14,代码来源:ConcreteTypeTest.java

示例15: createFunctionScope

import com.google.javascript.rhino.jstype.StaticScope; //导入依赖的package包/类
/** @inheritDoc */
public StaticScope<ConcreteType> createFunctionScope(
    Node decl, StaticScope<ConcreteType> parent) {
  FakeScope scope = new FakeScope((FakeScope) parent);
  scope.addSlot(ConcreteFunctionType.CALL_SLOT_NAME);
  scope.addSlot(ConcreteFunctionType.THIS_SLOT_NAME);
  scope.addSlot(ConcreteFunctionType.RETURN_SLOT_NAME);
  for (Node n = decl.getFirstChild().getNext().getFirstChild();
       n != null;
       n = n.getNext()) {
    scope.addSlot(n.getString());
  }
  return scope;
}
 
开发者ID:andyjko,项目名称:feedlack,代码行数:15,代码来源:ConcreteTypeTest.java


注:本文中的com.google.javascript.rhino.jstype.StaticScope类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。