當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Op.opEach函數代碼示例

本文整理匯總了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(_)
	})
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:7,代碼來源:verifyClass.ts

示例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)
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:7,代碼來源:verifyModule.ts

示例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
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:9,代碼來源:verifyPoly.ts

示例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
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:11,代碼來源:verifyTrait.ts

示例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)
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:20,代碼來源:verifyErrors.ts

示例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
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:22,代碼來源:verifyClass.ts

示例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)
		})
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:43,代碼來源:parseModule.ts

示例8: verifyLocalDeclare

export function verifyLocalDeclare({loc, name, opType}: LocalDeclare): void {
	opEach(compileOptions.opBuiltinPath(name), path => {
		warn(loc, _ => _.overriddenBuiltin(name, path))
	})
	opEach(opType, verifyVal)
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:6,代碼來源:verifyLocals.ts

示例9: verifyFunAbstract

function verifyFunAbstract({args, opRestArg, opReturnType}: FunAbstract): void {
	for (const _ of args)
		verifyLocalDeclare(_)
	opEach(opRestArg, verifyLocalDeclare)
	verifyOpVal(opReturnType)
}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:6,代碼來源:verifyPoly.ts

示例10: verifyCasePart

		const doIt = () => {
			for (const _ of parts)
				verifyCasePart(_, sk)
			opEach(opElse, _ => verifyBlockSK(_, sk))
		}
開發者ID:mason-lang,項目名稱:mason-lang.github.io,代碼行數:5,代碼來源:verifyCase.ts


注:本文中的op/Op.opEach函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。