当前位置: 首页>>代码示例>>Golang>>正文


Golang TypeCheckArgs.Symbols方法代码示例

本文整理汇总了Golang中ql/interfaces.TypeCheckArgs.Symbols方法的典型用法代码示例。如果您正苦于以下问题:Golang TypeCheckArgs.Symbols方法的具体用法?Golang TypeCheckArgs.Symbols怎么用?Golang TypeCheckArgs.Symbols使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ql/interfaces.TypeCheckArgs的用法示例。


在下文中一共展示了TypeCheckArgs.Symbols方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: TypeCheck

func (this VarDecl) TypeCheck(typeCheckArgs interfaces.TypeCheckArgs) {
	// store type for identifier so when we find VarExpr with this VarID we know its real type (used during typechecking)
	typeCheckArgs.Symbols().SetTypeForVarID(this.ValueType(), this.VariableIdentifier())

	// we mark it as known to indicate that earlier references to this VarID are valid
	typeCheckArgs.TypeChecker().MarkVarIDAsKnown(this.VariableIdentifier())
}
开发者ID:software-engineering-amsterdam,项目名称:multi-ql,代码行数:7,代码来源:typecheckvari.go

示例2: checkQuestionForRedeclarationWithDifferentTypes

// checkQuestionForRedeclarationWithDifferentTypes checks if the passed question has been declared before with a different type, and if so, adds an error to the typechecker
func checkQuestionForRedeclarationWithDifferentTypes(question interfaces.Question, typeCheckArgs interfaces.TypeCheckArgs) {
	varDecl := question.VarDecl()
	varID := varDecl.VariableIdentifier()

	if typeCheckArgs.Symbols().IsTypeSetForVarID(varID) && typeCheckArgs.Symbols().TypeForVarID(varID) != varDecl.ValueType() {
		typeCheckArgs.TypeChecker().AddEncounteredError(errors.NewQuestionRedeclaredWithDifferentTypesError(varDecl.ValueType(), typeCheckArgs.Symbols().TypeForVarID(varID)))
	}
}
开发者ID:software-engineering-amsterdam,项目名称:multi-ql,代码行数:9,代码来源:typecheckstmt.go

示例3: TypeCheck

func (this VarExpr) TypeCheck(typeCheckArgs interfaces.TypeCheckArgs) interfaces.ValueType {
	typeCheckArgs.TypeChecker().AddDependencyForVarDecl(this.VarIdentifier(), typeCheckArgs.CurrentVarDeclVisited())

	// Return the true type of the VarExpr; the type of the Expr referred to
	if typeCheckArgs.Symbols().IsTypeSetForVarID(this.VarIdentifier()) {
		return typeCheckArgs.Symbols().TypeForVarID(this.VarIdentifier()).(interfaces.ValueType)
	}

	// We don't already mark it as an error; because there is only one scope, the VarDecl may be simply declared later on
	typeCheckArgs.TypeChecker().MarkVarIDAsUnknown(this.VarIdentifier())

	// No type info in symbol table (reference to undefined question)
	return NewUnknownType()
}
开发者ID:software-engineering-amsterdam,项目名称:multi-ql,代码行数:14,代码来源:typecheckexpr.go


注:本文中的ql/interfaces.TypeCheckArgs.Symbols方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。