コード例 #1
0
void SimpleAbstractStreamReader::readProperty(AST::UiScriptBinding *uiScriptBinding)
{
    Q_ASSERT(uiScriptBinding);

    setSourceLocation(uiScriptBinding->firstSourceLocation());

    const QString name = toString(uiScriptBinding->qualifiedId);
    const QVariant value = parsePropertyScriptBinding(uiScriptBinding);

    propertyDefinition(name, value);
}
コード例 #2
0
ファイル: Resolve.cpp プロジェクト: ezhangle/rhine
void Resolve::lookupReplaceUse(UnresolvedValue *V, Use &U, BasicBlock *Block) {
  auto Name = V->getName();
  auto K = V->getContext();
  if (auto S = K->Map.get(V, Block)) {
    /// %S = 2;
    ///  ^
    /// Came from here (MallocInst, Argument, or Prototype)
    ///
    /// Foo(%S);
    ///      ^
    ///  UnresolvedValue; replace with %Replacement
    if (auto M = dyn_cast<MallocInst>(S)) {
      if (dyn_cast<StoreInst>(U->getUser()))
        U.set(M);
      else {
        auto Replacement = LoadInst::get(M);
        Replacement->setSourceLocation(V->getSourceLocation());
        U.set(Replacement);
      }
    } else if (isa<BindInst>(S) || isa<Argument>(S)) {
      U.set(S);
    } else if (isa<Prototype>(S)) {
      auto Replacement = Pointer::get(S);
      Replacement->setSourceLocation(S->getSourceLocation());
      U.set(Replacement);
    }
  } else {
    /// %V was not seen earlier (%S not initialized)
    /// Only one possibility: %V(...)
    ///                        ^
    ///                Callee of CallInst
    auto SourceLoc = U->getSourceLocation();
    if (auto Inst = dyn_cast<CallInst>(U->getUser()))
      if (Inst->getCallee() == V) {
        DiagnosticPrinter(SourceLoc) << "unbound function " + Name;
        exit(1);
      }
    DiagnosticPrinter(SourceLoc) << "unbound symbol " + Name;
    exit(1);
  }
}
コード例 #3
0
void SimpleAbstractStreamReader::readChild(AST::UiObjectDefinition *uiObjectDefinition)
{
    Q_ASSERT(uiObjectDefinition);

    setSourceLocation(uiObjectDefinition->firstSourceLocation());

    elementStart(toString(uiObjectDefinition->qualifiedTypeNameId));

    readProperties(uiObjectDefinition);
    readChildren(uiObjectDefinition);

    elementEnd();
}