本文整理汇总了TypeScript中op/Op.opEach函数的典型用法代码示例。如果您正苦于以下问题:TypeScript opEach函数的具体用法?TypeScript opEach怎么用?TypeScript opEach使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了opEach函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: withMethods
withMethods(() => {
for (const _ of statics)
verifyMethodImplLike(_)
opEach(opConstructor, _ => verifyConstructor(_, opSuperClass !== null))
for (const _ of methods)
verifyMethodImplLike(_)
})
示例2: verifyImport
function verifyImport({imported, opImportDefault}: Import): void {
// Since Uses are always in the outermost scope, don't have to worry about shadowing.
// So we mutate `locals` directly.
for (const _ of imported)
addImportedLocal(_)
opEach(opImportDefault, addImportedLocal)
}
示例3: verifyPoly
export default function verifyPoly({value}: Poly): void {
if (value instanceof FunBlock)
// value always has opDeclareThis
makeUseOptional(orThrow(value.opDeclareThis))
value.args.forEach(makeUseOptional)
opEach(value.opRestArg, makeUseOptional)
verifyMethodValue(value)
// name set by AssignSingle
}
示例4: verifyTrait
export default function verifyTrait({superTraits, opDo, statics, methods}: Trait): void {
verifyEachVal(superTraits)
opEach(opDo, verifyClassTraitDo)
withMethods(() => {
for (const _ of statics)
verifyMethodImplLike(_)
for (const _ of methods)
verifyMethodImplLike(_)
})
// name set by AssignSingle
}
示例5: verifyExcept
export function verifyExcept(_: Except, sk: SK): void {
const {loc, tried, typedCatches, opCatchAll, allCatches, opElse, opFinally} = _
caseOp(
opElse,
_ => {
plusLocals(verifyBlockDo(tried), () => verifyBlockSK(_, sk))
if (isEmpty(allCatches))
warn(loc, _ => _.elseRequiresCatch)
},
() => verifyBlockSK(tried, sk))
if (isEmpty(allCatches) && opFinally === null)
warn(loc, _ => _.uselessExcept)
for (const _ of typedCatches)
verifyCatch(_, sk)
opEach(opCatchAll, _ => verifyCatch(_, sk))
opEach(opFinally, verifyBlockDo)
}
示例6: verifyClass
export default function verifyClass(_: Class): void {
const {opFields, opSuperClass, traits, opDo, statics, opConstructor, methods} = _
opEach(opFields, fields => {
for (const _ of fields)
verifyField(_)
})
verifyOpVal(opSuperClass)
verifyEachVal(traits)
opEach(opDo, verifyClassTraitDo)
// Class acts like a Fun: loop/generator context is lost and we get block locals.
withMethods(() => {
for (const _ of statics)
verifyMethodImplLike(_)
opEach(opConstructor, _ => verifyConstructor(_, opSuperClass !== null))
for (const _ of methods)
verifyMethodImplLike(_)
})
// name set by AssignSingle
}
示例7: opEach
() => {
if (token instanceof GroupSpace) {
const tokens = Tokens.of(token)
// Take leading dots.
let rest = tokens
const parts: Array<string> = []
const head = rest.head()
opEach(tryTakeNDots(head), n => {
parts.push('.')
for (let i = 1; i < n; i = i + 1)
parts.push('..')
rest = rest.tail()
while (!rest.isEmpty()) {
const n = tryTakeNDots(rest.head())
if (n === null)
break
else {
for (let i = 0; i < n; i = i + 1)
parts.push('..')
rest = rest.tail()
}
}
})
// Take name, then any number of dot-then-name (`.x`)
while (true) {
checkNonEmpty(rest, _ => _.expectedImportModuleName)
parts.push(parseName(rest.head()))
rest = rest.tail()
if (rest.isEmpty())
break
// If there's something left, it should be a dot, followed by a name.
checkKeyword(Kw.Dot, rest.head())
rest = rest.tail()
}
return {path: parts.join('/'), name: parts[parts.length - 1]}
} else
fail(token.loc, _ => _.invalidImportModule)
})
示例8: verifyLocalDeclare
export function verifyLocalDeclare({loc, name, opType}: LocalDeclare): void {
opEach(compileOptions.opBuiltinPath(name), path => {
warn(loc, _ => _.overriddenBuiltin(name, path))
})
opEach(opType, verifyVal)
}
示例9: verifyFunAbstract
function verifyFunAbstract({args, opRestArg, opReturnType}: FunAbstract): void {
for (const _ of args)
verifyLocalDeclare(_)
opEach(opRestArg, verifyLocalDeclare)
verifyOpVal(opReturnType)
}
示例10: verifyCasePart
const doIt = () => {
for (const _ of parts)
verifyCasePart(_, sk)
opEach(opElse, _ => verifyBlockSK(_, sk))
}