本文整理匯總了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))
}