inline void _startGlobalScope( ) { _identifiers["type"] = nullptr; _RegisterIdentifier("int", TypeInfo(_identifiers["type"], false, true)); }
Structure* StructureRareData::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info()); }
Structure* WebAssemblyTableConstructor::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
Structure* IntlCollatorPrototype::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
Structure* JSString::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(StringType, StructureFlags), info()); }
Structure* JSCallbackObject<JSGlobalObject>::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(GlobalObjectType, StructureFlags), info()); }
TypeInfo Context::getTypeInfo(const std::string &typeDecl) { return TypeInfo(this, typeDecl); }
Structure* ClonedArguments::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
Structure* IntlDateTimeFormatConstructor::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
Structure* SparseArrayValueMap::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info()); }
static PassRefPtr<Structure> createStructure(JSValue prototype) { return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); }
Structure* InferredTypeTable::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(CellType, StructureFlags), info()); }
void TypeDefaultGen::buildVoidCast(par::ComplexType& _type, NaReTi::Module& _module) { ComplexType& voidT = g_module->getBasicType(BasicType::Void); // void -> this type voidT.typeCasts.emplace_back(new Function(g_module->getAllocator(), "", InstructionType::Nop, TypeInfo(_type,true), TypeInfo(voidT,true))); // this type -> void _type.typeCasts.emplace_back(new Function(_module.getAllocator(), "", InstructionType::Mov, TypeInfo(voidT, true), TypeInfo(_type, true))); _type.typeCasts.back()->intrinsicType = Function::StaticCast; }
Structure* JSWebAssemblyMemory::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
ASTNode::Link XMLParser::parseXMLNode(rapidxml::xml_node<>* node) { auto safeAttr = [node](std::string what, std::string defaultValue = "") -> std::string { auto attr = node->first_attribute(what.c_str()); if (attr != nullptr) return attr->value(); else return defaultValue; }; auto requiredAttr = [node](std::string what) -> std::string { auto attr = node->first_attribute(what.c_str()); if (attr != nullptr) return attr->value(); else throw XMLParseError("Can't find required attribute", { METADATA_PAIRS, {"missing attribute", what} }); }; auto funArgs = [node, &safeAttr]() -> FunctionSignature::Arguments { FunctionSignature::Arguments args {}; std::vector<std::string> stringArgs = split(safeAttr("args"), ','); for (auto& arg : stringArgs) { std::vector<std::string> namePlusTypes = split(arg, ':'); std::vector<std::string> types = split(namePlusTypes[1], ' '); args.push_back(std::make_pair(namePlusTypes[0], TypeList(ALL(types)))); } return args; }; auto funRet = [node, &safeAttr]() -> TypeInfo { std::vector<std::string> returnTypes = split(safeAttr("return"), ' '); return returnTypes.size() == 0 ? nullptr : TypeInfo(TypeList(ALL(returnTypes))); }; auto funBlock = [=](Node<FunctionNode>::Link f) { if (!f->isForeign()) { auto codeBlock = node->first_node("block"); if (codeBlock == nullptr) throw XMLParseError("Method missing code block", {METADATA_PAIRS}); f->setCode(Node<BlockNode>::staticPtrCast(parseXMLNode(codeBlock))); } }; auto getVisibility = [node, &safeAttr]() -> Visibility { return fromString(safeAttr("visibility", "private")); }; auto boolAttr = [node, &safeAttr](std::string what) -> bool { return safeAttr(what, "false") == "true"; }; if (node == nullptr) throw XMLParseError("Null node", {METADATA_PAIRS}); std::string name = node->name(); if (name == "block") { std::string type = safeAttr("type", "code"); BlockType bt = type == "root" ? ROOT_BLOCK : type == "if" ? IF_BLOCK : type == "function" ? FUNCTION_BLOCK : CODE_BLOCK; auto block = Node<BlockNode>::make(bt); parseChildren(node, block); return block; } else if (name == "return") { auto retNode = Node<ReturnNode>::make(); auto val = node->first_node("expr"); if (val != nullptr) retNode->setValue(Node<ExpressionNode>::dynPtrCast(parseXMLNode(val))); return retNode; } else if (name == "expr") { TokenType tokenType = TT::findByPrettyName(requiredAttr("type")); std::string data = requiredAttr("value"); std::unique_ptr<Token> content; if (tokenType == TT::OPERATOR) { content = std::make_unique<Token>(tokenType, Operator::find(data), defaultTrace); } else { content = std::make_unique<Token>(tokenType, data, defaultTrace); } auto expr = Node<ExpressionNode>::make(*content); parseChildren(node, expr); return expr; } else if (name == "decl") { Node<DeclarationNode>::Link decl; std::string ident = requiredAttr("ident"); bool isDynamic = boolAttr("dynamic"); if (isDynamic) { decl = Node<DeclarationNode>::make(ident, TypeList {}); } else { std::string tlValue = requiredAttr("types"); auto vec = split(tlValue, ' '); decl = Node<DeclarationNode>::make(ident, TypeList(ALL(vec))); } auto expr = node->first_node("expr"); if (expr != nullptr) { decl->setInit(Node<ExpressionNode>::dynPtrCast(parseXMLNode(expr))); } return decl; } else if (name == "branch") { auto branch = Node<BranchNode>::make(); auto cond = node->first_node(); if (cond == nullptr) throw XMLParseError("Missing condition in branch", {METADATA_PAIRS}); branch->setCondition(Node<ExpressionNode>::dynPtrCast(parseXMLNode(cond))); auto success = cond->next_sibling(); if (success == nullptr) throw XMLParseError("Missing success node in branch", {METADATA_PAIRS}); branch->setSuccessBlock(Node<BlockNode>::dynPtrCast(parseXMLNode(success))); auto blockFailiure = success->next_sibling("block"); if (blockFailiure != nullptr) { branch->setFailiureBlock(Node<BlockNode>::dynPtrCast(parseXMLNode(blockFailiure))); } auto branchFailiure = success->next_sibling("branch"); if (branchFailiure != nullptr) { branch->setFailiureBlock(Node<BranchNode>::dynPtrCast(parseXMLNode(branchFailiure))); } return branch; } else if (name == "loop") { auto loop = Node<LoopNode>::make(); auto init = node->first_node("loop_init"); if (init != nullptr) { loop->setInit(Node<DeclarationNode>::dynPtrCast(parseXMLNode(init))); } auto cond = node->first_node("loop_condition"); if (cond != nullptr) { loop->setCondition(Node<ExpressionNode>::dynPtrCast(parseXMLNode(cond))); } auto update = node->first_node("loop_update"); if (update != nullptr) { loop->setUpdate(Node<ExpressionNode>::dynPtrCast(parseXMLNode(update))); } auto code = node->first_node("block"); if (code != nullptr) { loop->setCode(Node<BlockNode>::dynPtrCast(parseXMLNode(code))); } return loop; } else if (name == "loop_init" || name == "loop_condition" || name == "loop_update") { return parseXMLNode(node->first_node()); } else if (name == "break") { return Node<BreakLoopNode>::make(); } else if (name == "function") { std::string ident = safeAttr("ident"); bool isForeign = boolAttr("foreign"); auto n = Node<FunctionNode>::make(ident, FunctionSignature(funRet(), funArgs()), isForeign); funBlock(n); if (isForeign && ident.empty()) throw XMLParseError("Can't have anonymous foreign function", {METADATA_PAIRS}); return n; } else if (name == "type") { std::string typeName = requiredAttr("name"); std::vector<std::string> inheritTypes = split(safeAttr("inherits"), ' '); auto typeNode = Node<TypeNode>::make(typeName, TypeList(ALL(inheritTypes))); parseChildren(node, typeNode); return typeNode; } else if (name == "member") { std::string ident = requiredAttr("ident"); std::vector<std::string> types = split(safeAttr("types"), ' '); auto member = Node<MemberNode>::make(ident, TypeList(ALL(types)), boolAttr("static"), getVisibility()); auto init = node->first_node("expr"); if (init != nullptr) { member->setInit(Node<ExpressionNode>::staticPtrCast(parseXMLNode(init))); } return member; } else if (name == "method") { std::string ident = safeAttr("ident"); bool isForeign = boolAttr("foreign"); auto method = Node<MethodNode>::make(ident, FunctionSignature(funRet(), funArgs()), getVisibility(), boolAttr("static"), isForeign); funBlock(method); if (isForeign && ident.empty()) throw XMLParseError("Can't have anonymous foreign method", {METADATA_PAIRS}); return method; } else if (name == "constructor") { auto constructor = Node<ConstructorNode>::make(funArgs(), getVisibility()); funBlock(constructor); return constructor; } throw XMLParseError("Unknown type of node", {METADATA_PAIRS, {"node name", name}}); }
Structure* JSArrayBufferPrototype::createStructure( VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create( vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
void TimeSeries::describeParamsAndColumns(UDRInvocationInfo &info) { InternalColumns internalCols(info); // create PARTITION BY output columns, one passthru column // for every column that appears in PARTITION BY const PartitionInfo &part = info.in().getQueryPartitioning(); int numPartCols = part.getNumEntries(); for (int pc=0; pc<numPartCols; pc++) info.addPassThruColumns(0, part.getColumnNum(pc), part.getColumnNum(pc)); // since we work locally in a partition, set the function type // of this TMUDF to REDUCER info.setFuncType(UDRInvocationInfo::REDUCER); // produce the time column, it has the same type as the // ORDER BY column that defines the input time value // and its name is specified by parameter 0 const TypeInfo &timeType = info.in().getColumn(internalCols.getTimeSliceInColNum()).getType(); info.out().addColumn(ColumnInfo(info.par().getString(0).c_str(), timeType)); // produce aggregate columns for (int a=0; a<internalCols.getNumAggrCols(); a++) { TimeSeriesAggregate tsa = internalCols.getAggrColumn(a); std::string outColName(info.par().getString(2*a + 2)); TypeInfo inColType( info.in().getColumn(tsa.getInputColNum()).getType()); // append suffix to input column name to form the output column // name, make those all capitals to avoid delimited identifiers outColName += "_"; if (tsa.isFirstVal()) outColName += "F"; else outColName += "L"; if (tsa.isConstInterpol()) outColName += "C"; else outColName += "L"; if (tsa.isIgnoreNulls()) outColName += "I"; if (tsa.isConstInterpol()) { // add a column with the same data type as the original // column, but make it nullable if it isn't already inColType.setNullable(true); info.out().addColumn(ColumnInfo(outColName.c_str(), inColType)); } else // add a "DOUBLE" output column to allow interpolation info.out().addColumn(ColumnInfo( outColName.c_str(), TypeInfo(TypeInfo::DOUBLE_PRECISION, 0, true))); } // add formal parameters with types that match the actual ones for (int p=0; p<info.par().getNumColumns(); p++) { char parName[20]; snprintf(parName, sizeof(parName), "PAR_%d", p); info.addFormalParameter(ColumnInfo(parName, info.par().getColumn(p).getType())); } }
Structure* WebAssemblyModuleConstructor::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(InternalFunctionType, StructureFlags), info()); }
Structure* JSTypedArrayViewConstructor::createStructure( VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
Structure* JSByteArray::createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype, const JSC::ClassInfo* classInfo) { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), classInfo); }
bool ClassifyType( location_context *lc, type_handle *th, dip_type_info *info ) { TypeInfo( th, lc, info ); return( DefaultTypeInfo( info ) ); }
Structure* NativeExecutable::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue proto) { return Structure::create(vm, globalObject, proto, TypeInfo(CellType, StructureFlags), info()); }
void LRValue( stack_entry *entry ) { location_list ll; item_mach tmp; bool extend; mad_type_info mti; DIPHDL( type, th ); ExprResolve( entry ); if( entry->flags & SF_LOCATION ) { if( entry->info.kind == TK_FUNCTION || entry->info.kind == TK_CODE ) { /* rvalue of procedure is its address */ entry->v.addr = entry->v.loc.e[0].u.addr; ExprSetAddrInfo( entry, FALSE ); entry->info.kind = TK_ADDRESS; } else if( !AddressExpression( entry ) ) { extend = FALSE; switch( entry->info.kind ) { case TK_ARRAY: /* rvalue of array is its address */ entry->v.addr = entry->v.loc.e[0].u.addr; if( entry->th != NULL ) { /* change typing from "array of..." to "pointer to..." */ GetMADTypeDefaultAt( entry->v.addr, MTK_ADDRESS, &mti ); TypeBase( entry->th, th, NULL, NULL ); TypePointer( th, TM_FAR, mti.b.bits / BITS_PER_BYTE, entry->th ); TypeInfo( entry->th, entry->lc, &entry->info ); } else { ExprSetAddrInfo( entry, FALSE ); } break; case TK_STRING: _ChkAlloc( entry->v.string.allocated, entry->info.size, LIT( ERR_NO_MEMORY_FOR_EXPR ) ); LocationCreate( &ll, LT_INTERNAL, entry->v.string.allocated ); if( LocationAssign( &ll, &entry->v.loc, entry->info.size, FALSE ) != DS_OK ) { _Free( entry->v.string.allocated ); Error( ERR_NONE, LIT( ERR_NO_ACCESS ) ); } entry->v.string.loc = ll; break; case TK_BOOL: case TK_CHAR: case TK_ENUM: case TK_INTEGER: if( (entry->info.modifier & TM_MOD_MASK) == TM_SIGNED ) extend = TRUE; /* fall through */ default: LocationCreate( &ll, LT_INTERNAL, &tmp ); if( LocationAssign( &ll, &entry->v.loc, entry->info.size, extend ) != DS_OK ) { Error( ERR_NONE, LIT( ERR_NO_ACCESS ) ); } FromItem( &tmp, entry ); break; } } entry->flags &= ~(SF_LOCATION | SF_IMP_ADDR); } if( entry->info.kind == TK_POINTER && (entry->info.modifier & TM_MOD_MASK) == TM_NEAR ) { NearToFar( entry ); } }
Structure* JSInternalPromise::createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info()); }
PassRefPtr<Structure> AJArrayArray::createStructure(AJValue prototype) { PassRefPtr<Structure> result = Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount); return result; }
TypeInfo TypeBuilder::CreateType() const { return TypeInfo(m_pImpl->m_parameters); }
static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype) { return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info); }