当前位置: 首页>>代码示例>>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;未经允许,请勿转载。