repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeUtils.java | FlowTypeUtils.extractAssignedVariable | public static Expr.VariableAccess extractAssignedVariable(LVal lval) {
if (lval instanceof Expr.VariableAccess) {
return (Expr.VariableAccess) lval;
} else if (lval instanceof Expr.RecordAccess) {
Expr.RecordAccess e = (Expr.RecordAccess) lval;
return extractAssignedVariable((LVal) e.getOperand());
} els... | java | public static Expr.VariableAccess extractAssignedVariable(LVal lval) {
if (lval instanceof Expr.VariableAccess) {
return (Expr.VariableAccess) lval;
} else if (lval instanceof Expr.RecordAccess) {
Expr.RecordAccess e = (Expr.RecordAccess) lval;
return extractAssignedVariable((LVal) e.getOperand());
} els... | [
"public",
"static",
"Expr",
".",
"VariableAccess",
"extractAssignedVariable",
"(",
"LVal",
"lval",
")",
"{",
"if",
"(",
"lval",
"instanceof",
"Expr",
".",
"VariableAccess",
")",
"{",
"return",
"(",
"Expr",
".",
"VariableAccess",
")",
"lval",
";",
"}",
"else"... | Determine the modified variable for a given LVal. Almost all lvals modify
exactly one variable, though dereferences don't.
@param lval
@param scope
@return | [
"Determine",
"the",
"modified",
"variable",
"for",
"a",
"given",
"LVal",
".",
"Almost",
"all",
"lvals",
"modify",
"exactly",
"one",
"variable",
"though",
"dereferences",
"don",
"t",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeUtils.java#L222-L237 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeUtils.java | FlowTypeUtils.isPure | public static boolean isPure(SyntacticItem item) {
// Examine expression to determine whether this expression is impure.
if (item instanceof Expr.StaticVariableAccess || item instanceof Expr.Dereference || item instanceof Expr.New) {
return false;
} else if (item instanceof Expr.Invoke) {
Expr.Invoke e = (E... | java | public static boolean isPure(SyntacticItem item) {
// Examine expression to determine whether this expression is impure.
if (item instanceof Expr.StaticVariableAccess || item instanceof Expr.Dereference || item instanceof Expr.New) {
return false;
} else if (item instanceof Expr.Invoke) {
Expr.Invoke e = (E... | [
"public",
"static",
"boolean",
"isPure",
"(",
"SyntacticItem",
"item",
")",
"{",
"// Examine expression to determine whether this expression is impure.",
"if",
"(",
"item",
"instanceof",
"Expr",
".",
"StaticVariableAccess",
"||",
"item",
"instanceof",
"Expr",
".",
"Derefe... | Determine whether a given expression calls an impure method, dereferences a
reference or accesses a static variable. This is done by exploiting the
uniform nature of syntactic items. Essentially, we just traverse the entire
tree representing the syntactic item looking for expressions of any kind.
@param item
@return | [
"Determine",
"whether",
"a",
"given",
"expression",
"calls",
"an",
"impure",
"method",
"dereferences",
"a",
"reference",
"or",
"accesses",
"a",
"static",
"variable",
".",
"This",
"is",
"done",
"by",
"exploiting",
"the",
"uniform",
"nature",
"of",
"syntactic",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeUtils.java#L252-L276 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateConstantDeclaration | private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) {
if (decl.hasInitialiser()) {
// The environments are needed to prevent clashes between variable
// versions across verification conditions, and also to type variables
// used in verification conditions.
GlobalEnvironment global... | java | private void translateConstantDeclaration(WyilFile.Decl.StaticVariable decl) {
if (decl.hasInitialiser()) {
// The environments are needed to prevent clashes between variable
// versions across verification conditions, and also to type variables
// used in verification conditions.
GlobalEnvironment global... | [
"private",
"void",
"translateConstantDeclaration",
"(",
"WyilFile",
".",
"Decl",
".",
"StaticVariable",
"decl",
")",
"{",
"if",
"(",
"decl",
".",
"hasInitialiser",
"(",
")",
")",
"{",
"// The environments are needed to prevent clashes between variable",
"// versions acros... | Translate a constant declaration into WyAL. At the moment, this does nothing
because constant declarations are not supported in WyAL files.
@param declaration
The type declaration being translated.
@param wyalFile
The WyAL file being constructed | [
"Translate",
"a",
"constant",
"declaration",
"into",
"WyAL",
".",
"At",
"the",
"moment",
"this",
"does",
"nothing",
"because",
"constant",
"declarations",
"are",
"not",
"supported",
"in",
"WyAL",
"files",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L164-L180 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateTypeDeclaration | private void translateTypeDeclaration(WyilFile.Decl.Type declaration) {
WyilFile.Tuple<WyilFile.Expr> invariants = declaration.getInvariant();
WyalFile.Stmt.Block[] invariant = new WyalFile.Stmt.Block[invariants.size()];
WyalFile.Type type = convert(declaration.getType(), declaration);
WyalFile.VariableDeclarat... | java | private void translateTypeDeclaration(WyilFile.Decl.Type declaration) {
WyilFile.Tuple<WyilFile.Expr> invariants = declaration.getInvariant();
WyalFile.Stmt.Block[] invariant = new WyalFile.Stmt.Block[invariants.size()];
WyalFile.Type type = convert(declaration.getType(), declaration);
WyalFile.VariableDeclarat... | [
"private",
"void",
"translateTypeDeclaration",
"(",
"WyilFile",
".",
"Decl",
".",
"Type",
"declaration",
")",
"{",
"WyilFile",
".",
"Tuple",
"<",
"WyilFile",
".",
"Expr",
">",
"invariants",
"=",
"declaration",
".",
"getInvariant",
"(",
")",
";",
"WyalFile",
... | Transform a type declaration into verification conditions as necessary. In
particular, the type should be "inhabitable". This means, for example, that
the invariant does not contradict itself. Furthermore, we need to translate
the type invariant into a macro block.
@param declaration
The type declaration being transla... | [
"Transform",
"a",
"type",
"declaration",
"into",
"verification",
"conditions",
"as",
"necessary",
".",
"In",
"particular",
"the",
"type",
"should",
"be",
"inhabitable",
".",
"This",
"means",
"for",
"example",
"that",
"the",
"invariant",
"does",
"not",
"contradic... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L193-L214 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateFunctionOrMethodDeclaration | private void translateFunctionOrMethodDeclaration(WyilFile.Decl.FunctionOrMethod declaration) {
// Create the prototype for this function or method. This is the
// function or method declaration which can be used within verification
// conditions to refer to this function or method. This does not include
// a b... | java | private void translateFunctionOrMethodDeclaration(WyilFile.Decl.FunctionOrMethod declaration) {
// Create the prototype for this function or method. This is the
// function or method declaration which can be used within verification
// conditions to refer to this function or method. This does not include
// a b... | [
"private",
"void",
"translateFunctionOrMethodDeclaration",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
")",
"{",
"// Create the prototype for this function or method. This is the",
"// function or method declaration which can be used within verification",
"// co... | Transform a function or method declaration into verification conditions as
necessary. This is done by traversing the control-flow graph of the function
or method in question. Verifications are emitted when conditions are
encountered which must be checked. For example, that the preconditions are
met at a function invoca... | [
"Transform",
"a",
"function",
"or",
"method",
"declaration",
"into",
"verification",
"conditions",
"as",
"necessary",
".",
"This",
"is",
"done",
"by",
"traversing",
"the",
"control",
"-",
"flow",
"graph",
"of",
"the",
"function",
"or",
"method",
"in",
"questio... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L248-L285 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translatePreconditionMacros | private void translatePreconditionMacros(WyilFile.Decl.FunctionOrMethod declaration) {
Tuple<WyilFile.Expr> invariants = declaration.getRequires();
//
for (int i = 0; i != invariants.size(); ++i) {
// Construct fresh environment for this macro. This is necessary to
// avoid name clashes with subsequent macr... | java | private void translatePreconditionMacros(WyilFile.Decl.FunctionOrMethod declaration) {
Tuple<WyilFile.Expr> invariants = declaration.getRequires();
//
for (int i = 0; i != invariants.size(); ++i) {
// Construct fresh environment for this macro. This is necessary to
// avoid name clashes with subsequent macr... | [
"private",
"void",
"translatePreconditionMacros",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
")",
"{",
"Tuple",
"<",
"WyilFile",
".",
"Expr",
">",
"invariants",
"=",
"declaration",
".",
"getRequires",
"(",
")",
";",
"//",
"for",
"(",... | Translate the sequence of invariant expressions which constitute the
precondition of a function or method into corresponding macro declarations.
@param declaration
@param environment
@param wyalFile | [
"Translate",
"the",
"sequence",
"of",
"invariant",
"expressions",
"which",
"constitute",
"the",
"precondition",
"of",
"a",
"function",
"or",
"method",
"into",
"corresponding",
"macro",
"declarations",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L295-L314 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAssert | private Context translateAssert(WyilFile.Stmt.Assert stmt, Context context) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr condition = p.first();
context = p.second();
//
VerificationCondition verificationCondition = new VerificationCondition("assertion faile... | java | private Context translateAssert(WyilFile.Stmt.Assert stmt, Context context) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr condition = p.first();
context = p.second();
//
VerificationCondition verificationCondition = new VerificationCondition("assertion faile... | [
"private",
"Context",
"translateAssert",
"(",
"WyilFile",
".",
"Stmt",
".",
"Assert",
"stmt",
",",
"Context",
"context",
")",
"{",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p",
"=",
"translateExpressionWithChecks",
"(",
"stmt",
".",
"getCondition",
"(",
")"... | Translate an assert statement. This emits a verification condition which
ensures the assert condition holds, given the current context.
@param stmt
@param wyalFile | [
"Translate",
"an",
"assert",
"statement",
".",
"This",
"emits",
"a",
"verification",
"condition",
"which",
"ensures",
"the",
"assert",
"condition",
"holds",
"given",
"the",
"current",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L474-L484 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAssign | private Context translateAssign(WyilFile.Stmt.Assign stmt, Context context) {
Tuple<WyilFile.LVal> lhs = stmt.getLeftHandSide();
Tuple<WyilFile.Expr> rhs = stmt.getRightHandSide();
WyilFile.LVal[][] lvals = new LVal[rhs.size()][];
Expr[][] rvals = new Expr[rhs.size()][];
// First, generate bundles
for (int ... | java | private Context translateAssign(WyilFile.Stmt.Assign stmt, Context context) {
Tuple<WyilFile.LVal> lhs = stmt.getLeftHandSide();
Tuple<WyilFile.Expr> rhs = stmt.getRightHandSide();
WyilFile.LVal[][] lvals = new LVal[rhs.size()][];
Expr[][] rvals = new Expr[rhs.size()][];
// First, generate bundles
for (int ... | [
"private",
"Context",
"translateAssign",
"(",
"WyilFile",
".",
"Stmt",
".",
"Assign",
"stmt",
",",
"Context",
"context",
")",
"{",
"Tuple",
"<",
"WyilFile",
".",
"LVal",
">",
"lhs",
"=",
"stmt",
".",
"getLeftHandSide",
"(",
")",
";",
"Tuple",
"<",
"WyilF... | Translate an assign statement. This updates the version number of the
underlying assigned variable.
@param stmt
@param wyalFile
@throws ResolutionError | [
"Translate",
"an",
"assign",
"statement",
".",
"This",
"updates",
"the",
"version",
"number",
"of",
"the",
"underlying",
"assigned",
"variable",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L494-L514 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAssign | private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) {
Expr[] ls = new Expr[lval.length];
for (int i = 0; i != ls.length; ++i) {
WyilFile.LVal lhs = lval[i];
generateTypeInvariantCheck(lhs.getType(), rval[i], context);
context = translateSingleAssignment(lval[i], rval[i], con... | java | private Context translateAssign(WyilFile.LVal[] lval, Expr[] rval, Context context) {
Expr[] ls = new Expr[lval.length];
for (int i = 0; i != ls.length; ++i) {
WyilFile.LVal lhs = lval[i];
generateTypeInvariantCheck(lhs.getType(), rval[i], context);
context = translateSingleAssignment(lval[i], rval[i], con... | [
"private",
"Context",
"translateAssign",
"(",
"WyilFile",
".",
"LVal",
"[",
"]",
"lval",
",",
"Expr",
"[",
"]",
"rval",
",",
"Context",
"context",
")",
"{",
"Expr",
"[",
"]",
"ls",
"=",
"new",
"Expr",
"[",
"lval",
".",
"length",
"]",
";",
"for",
"(... | Translate an individual assignment from one rval to one or more lvals. If
there are multiple lvals, then a tuple is created to represent the left-hand
side.
@param lval
One or more expressions representing the left-hand side
@param rval
A single expression representing the right-hand side
@param context
@return
@throw... | [
"Translate",
"an",
"individual",
"assignment",
"from",
"one",
"rval",
"to",
"one",
"or",
"more",
"lvals",
".",
"If",
"there",
"are",
"multiple",
"lvals",
"then",
"a",
"tuple",
"is",
"created",
"to",
"represent",
"the",
"left",
"-",
"hand",
"side",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L565-L573 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateSingleAssignment | private Context translateSingleAssignment(WyilFile.LVal lval, Expr rval, Context context) {
// FIXME: this method is a bit of a kludge. It would be nicer,
// eventually, to have all right-hand side expression represented in
// WyTP directly. This could potentially be done by including an update
// operation in... | java | private Context translateSingleAssignment(WyilFile.LVal lval, Expr rval, Context context) {
// FIXME: this method is a bit of a kludge. It would be nicer,
// eventually, to have all right-hand side expression represented in
// WyTP directly. This could potentially be done by including an update
// operation in... | [
"private",
"Context",
"translateSingleAssignment",
"(",
"WyilFile",
".",
"LVal",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"// FIXME: this method is a bit of a kludge. It would be nicer,",
"// eventually, to have all right-hand side expression represented in... | Translate an individual assignment from one rval to exactly one lval.
@param lval
A single location representing the left-hand side
@param rval
A single expression representing the right-hand side
@param context
@return | [
"Translate",
"an",
"individual",
"assignment",
"from",
"one",
"rval",
"to",
"exactly",
"one",
"lval",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L585-L608 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateRecordAssign | private Context translateRecordAssign(WyilFile.Expr.RecordAccess lval, Expr rval, Context context) {
// Translate src expression
Pair<Expr, Context> p1 = translateExpressionWithChecks(lval.getOperand(), null, context);
Expr source = p1.first();
WyalFile.Identifier field = new WyalFile.Identifier(lval.getField()... | java | private Context translateRecordAssign(WyilFile.Expr.RecordAccess lval, Expr rval, Context context) {
// Translate src expression
Pair<Expr, Context> p1 = translateExpressionWithChecks(lval.getOperand(), null, context);
Expr source = p1.first();
WyalFile.Identifier field = new WyalFile.Identifier(lval.getField()... | [
"private",
"Context",
"translateRecordAssign",
"(",
"WyilFile",
".",
"Expr",
".",
"RecordAccess",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"// Translate src expression",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p1",
"=",
"translateExpr... | Translate an assignment to a field.
@param lval
The field access expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"assignment",
"to",
"a",
"field",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L621-L629 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateArrayAssign | private Context translateArrayAssign(WyilFile.Expr.ArrayAccess lval, Expr rval, Context context) {
// Translate src and index expressions
Pair<Expr, Context> p1 = translateExpressionWithChecks(lval.getFirstOperand(), null, context);
Pair<Expr, Context> p2 = translateExpressionWithChecks(lval.getSecondOperand(), n... | java | private Context translateArrayAssign(WyilFile.Expr.ArrayAccess lval, Expr rval, Context context) {
// Translate src and index expressions
Pair<Expr, Context> p1 = translateExpressionWithChecks(lval.getFirstOperand(), null, context);
Pair<Expr, Context> p2 = translateExpressionWithChecks(lval.getSecondOperand(), n... | [
"private",
"Context",
"translateArrayAssign",
"(",
"WyilFile",
".",
"Expr",
".",
"ArrayAccess",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"// Translate src and index expressions",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p1",
"=",
"tran... | Translate an assignment to an array element.
@param lval
The array assignment expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"assignment",
"to",
"an",
"array",
"element",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L642-L653 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateDereference | private Context translateDereference(WyilFile.Expr.Dereference lval, Expr rval, Context context) {
Expr e = translateDereference(lval, context.getEnvironment());
return context.assume(new Expr.Equal(e, rval));
} | java | private Context translateDereference(WyilFile.Expr.Dereference lval, Expr rval, Context context) {
Expr e = translateDereference(lval, context.getEnvironment());
return context.assume(new Expr.Equal(e, rval));
} | [
"private",
"Context",
"translateDereference",
"(",
"WyilFile",
".",
"Expr",
".",
"Dereference",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"Expr",
"e",
"=",
"translateDereference",
"(",
"lval",
",",
"context",
".",
"getEnvironment",
"(",... | Translate an indirect assignment through a reference.
@param lval
The array assignment expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"indirect",
"assignment",
"through",
"a",
"reference",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L666-L669 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateVariableAssign | private Context translateVariableAssign(WyilFile.Expr.VariableAccess lval, Expr rval, Context context) {
WyilFile.Decl.Variable decl = lval.getVariableDeclaration();
context = context.havoc(decl);
WyalFile.VariableDeclaration nVersionedVar = context.read(decl);
Expr.VariableAccess var = new Expr.VariableAccess(... | java | private Context translateVariableAssign(WyilFile.Expr.VariableAccess lval, Expr rval, Context context) {
WyilFile.Decl.Variable decl = lval.getVariableDeclaration();
context = context.havoc(decl);
WyalFile.VariableDeclaration nVersionedVar = context.read(decl);
Expr.VariableAccess var = new Expr.VariableAccess(... | [
"private",
"Context",
"translateVariableAssign",
"(",
"WyilFile",
".",
"Expr",
".",
"VariableAccess",
"lval",
",",
"Expr",
"rval",
",",
"Context",
"context",
")",
"{",
"WyilFile",
".",
"Decl",
".",
"Variable",
"decl",
"=",
"lval",
".",
"getVariableDeclaration",
... | Translate an assignment to a variable
@param lval
The array assignment expression
@param result
The value being assigned to the given array element
@param context
The enclosing context
@return | [
"Translate",
"an",
"assignment",
"to",
"a",
"variable"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L682-L688 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.extractAssignedVariable | private WyilFile.Expr.VariableAccess extractAssignedVariable(WyilFile.LVal lval) {
//
switch (lval.getOpcode()) {
case WyilFile.EXPR_arrayaccess:
case WyilFile.EXPR_arrayborrow:
Expr.ArrayAccess ae = (Expr.ArrayAccess) lval;
return extractAssignedVariable((LVal) ae.getSource());
case WyilFile.EXPR_deref... | java | private WyilFile.Expr.VariableAccess extractAssignedVariable(WyilFile.LVal lval) {
//
switch (lval.getOpcode()) {
case WyilFile.EXPR_arrayaccess:
case WyilFile.EXPR_arrayborrow:
Expr.ArrayAccess ae = (Expr.ArrayAccess) lval;
return extractAssignedVariable((LVal) ae.getSource());
case WyilFile.EXPR_deref... | [
"private",
"WyilFile",
".",
"Expr",
".",
"VariableAccess",
"extractAssignedVariable",
"(",
"WyilFile",
".",
"LVal",
"lval",
")",
"{",
"//",
"switch",
"(",
"lval",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"WyilFile",
".",
"EXPR_arrayaccess",
":",
"case",... | Determine the variable at the root of a given sequence of assignments, or
return null if there is no statically determinable variable.
@param lval
@return | [
"Determine",
"the",
"variable",
"at",
"the",
"root",
"of",
"a",
"given",
"sequence",
"of",
"assignments",
"or",
"return",
"null",
"if",
"there",
"is",
"no",
"statically",
"determinable",
"variable",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L697-L717 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateBreak | private Context translateBreak(WyilFile.Stmt.Break stmt, Context context) {
LoopScope enclosingLoop = context.getEnclosingLoopScope();
enclosingLoop.addBreakContext(context);
return null;
} | java | private Context translateBreak(WyilFile.Stmt.Break stmt, Context context) {
LoopScope enclosingLoop = context.getEnclosingLoopScope();
enclosingLoop.addBreakContext(context);
return null;
} | [
"private",
"Context",
"translateBreak",
"(",
"WyilFile",
".",
"Stmt",
".",
"Break",
"stmt",
",",
"Context",
"context",
")",
"{",
"LoopScope",
"enclosingLoop",
"=",
"context",
".",
"getEnclosingLoopScope",
"(",
")",
";",
"enclosingLoop",
".",
"addBreakContext",
"... | Translate a break statement. This takes the current context and pushes it
into the enclosing loop scope. It will then be extracted later and used.
@param stmt
@param wyalFile | [
"Translate",
"a",
"break",
"statement",
".",
"This",
"takes",
"the",
"current",
"context",
"and",
"pushes",
"it",
"into",
"the",
"enclosing",
"loop",
"scope",
".",
"It",
"will",
"then",
"be",
"extracted",
"later",
"and",
"used",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L744-L748 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateContinue | private Context translateContinue(WyilFile.Stmt.Continue stmt, Context context) {
LoopScope enclosingLoop = context.getEnclosingLoopScope();
enclosingLoop.addContinueContext(context);
return null;
} | java | private Context translateContinue(WyilFile.Stmt.Continue stmt, Context context) {
LoopScope enclosingLoop = context.getEnclosingLoopScope();
enclosingLoop.addContinueContext(context);
return null;
} | [
"private",
"Context",
"translateContinue",
"(",
"WyilFile",
".",
"Stmt",
".",
"Continue",
"stmt",
",",
"Context",
"context",
")",
"{",
"LoopScope",
"enclosingLoop",
"=",
"context",
".",
"getEnclosingLoopScope",
"(",
")",
";",
"enclosingLoop",
".",
"addContinueCont... | Translate a continue statement. This takes the current context and pushes it
into the enclosing loop scope. It will then be extracted later and used.
@param stmt
@param wyalFile | [
"Translate",
"a",
"continue",
"statement",
".",
"This",
"takes",
"the",
"current",
"context",
"and",
"pushes",
"it",
"into",
"the",
"enclosing",
"loop",
"scope",
".",
"It",
"will",
"then",
"be",
"extracted",
"later",
"and",
"used",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L757-L761 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateDoWhile | private Context translateDoWhile(WyilFile.Stmt.DoWhile stmt, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
// Translate the loop invariant and generate appropriate macro
translateLoopInvariantMacros(... | java | private Context translateDoWhile(WyilFile.Stmt.DoWhile stmt, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
// Translate the loop invariant and generate appropriate macro
translateLoopInvariantMacros(... | [
"private",
"Context",
"translateDoWhile",
"(",
"WyilFile",
".",
"Stmt",
".",
"DoWhile",
"stmt",
",",
"Context",
"context",
")",
"{",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
"=",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
")... | Translate a DoWhile statement.
@param stmt
@param context
@return | [
"Translate",
"a",
"DoWhile",
"statement",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L770-L814 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateFail | private Context translateFail(WyilFile.Stmt.Fail stmt, Context context) {
Expr condition = new Expr.Constant(new Value.Bool(false));
//
VerificationCondition verificationCondition = new VerificationCondition("possible panic", context.assumptions,
condition, stmt.getParent(WyilFile.Attribute.Span.class));
co... | java | private Context translateFail(WyilFile.Stmt.Fail stmt, Context context) {
Expr condition = new Expr.Constant(new Value.Bool(false));
//
VerificationCondition verificationCondition = new VerificationCondition("possible panic", context.assumptions,
condition, stmt.getParent(WyilFile.Attribute.Span.class));
co... | [
"private",
"Context",
"translateFail",
"(",
"WyilFile",
".",
"Stmt",
".",
"Fail",
"stmt",
",",
"Context",
"context",
")",
"{",
"Expr",
"condition",
"=",
"new",
"Expr",
".",
"Constant",
"(",
"new",
"Value",
".",
"Bool",
"(",
"false",
")",
")",
";",
"//"... | Translate a fail statement. Execution should never reach such a statement.
Hence, we need to emit a verification condition to ensure this is the case.
@param stmt
@param context
@return | [
"Translate",
"a",
"fail",
"statement",
".",
"Execution",
"should",
"never",
"reach",
"such",
"a",
"statement",
".",
"Hence",
"we",
"need",
"to",
"emit",
"a",
"verification",
"condition",
"to",
"ensure",
"this",
"is",
"the",
"case",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L824-L832 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateIf | private Context translateIf(WyilFile.Stmt.IfElse stmt, Context context) {
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr trueCondition = p.first();
// FIXME: this is broken as includes assumptions propagated through
// logical &&'s
context = p.second();
... | java | private Context translateIf(WyilFile.Stmt.IfElse stmt, Context context) {
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr trueCondition = p.first();
// FIXME: this is broken as includes assumptions propagated through
// logical &&'s
context = p.second();
... | [
"private",
"Context",
"translateIf",
"(",
"WyilFile",
".",
"Stmt",
".",
"IfElse",
"stmt",
",",
"Context",
"context",
")",
"{",
"//",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p",
"=",
"translateExpressionWithChecks",
"(",
"stmt",
".",
"getCondition",
"(",
... | Translate an if statement. This translates the true and false branches and
then recombines them together to form an updated environment. This is
challenging when the environments are updated independently in both branches.
@param stmt
@param wyalFile | [
"Translate",
"an",
"if",
"statement",
".",
"This",
"translates",
"the",
"true",
"and",
"false",
"branches",
"and",
"then",
"recombines",
"them",
"together",
"to",
"form",
"an",
"updated",
"environment",
".",
"This",
"is",
"challenging",
"when",
"the",
"environ... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L842-L861 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateNamedBlock | private Context translateNamedBlock(WyilFile.Stmt.NamedBlock stmt, Context context) {
return translateStatementBlock(stmt.getBlock(), context);
} | java | private Context translateNamedBlock(WyilFile.Stmt.NamedBlock stmt, Context context) {
return translateStatementBlock(stmt.getBlock(), context);
} | [
"private",
"Context",
"translateNamedBlock",
"(",
"WyilFile",
".",
"Stmt",
".",
"NamedBlock",
"stmt",
",",
"Context",
"context",
")",
"{",
"return",
"translateStatementBlock",
"(",
"stmt",
".",
"getBlock",
"(",
")",
",",
"context",
")",
";",
"}"
] | Translate a named block
@param stmt
@param wyalFile | [
"Translate",
"a",
"named",
"block"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L869-L871 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateReturn | private Context translateReturn(WyilFile.Stmt.Return stmt, Context context) {
//
Tuple<WyilFile.Expr> returns = stmt.getReturns();
//
if (returns.size() > 0) {
// There is at least one return value. Therefore, we need to check
// any preconditions for those return expressions and, potentially,
// ensur... | java | private Context translateReturn(WyilFile.Stmt.Return stmt, Context context) {
//
Tuple<WyilFile.Expr> returns = stmt.getReturns();
//
if (returns.size() > 0) {
// There is at least one return value. Therefore, we need to check
// any preconditions for those return expressions and, potentially,
// ensur... | [
"private",
"Context",
"translateReturn",
"(",
"WyilFile",
".",
"Stmt",
".",
"Return",
"stmt",
",",
"Context",
"context",
")",
"{",
"//",
"Tuple",
"<",
"WyilFile",
".",
"Expr",
">",
"returns",
"=",
"stmt",
".",
"getReturns",
"(",
")",
";",
"//",
"if",
"... | Translate a return statement. If a return value is given, then this must
ensure that the post-condition of the enclosing function or method is met
@param stmt
@param wyalFile | [
"Translate",
"a",
"return",
"statement",
".",
"If",
"a",
"return",
"value",
"is",
"given",
"then",
"this",
"must",
"ensure",
"that",
"the",
"post",
"-",
"condition",
"of",
"the",
"enclosing",
"function",
"or",
"method",
"is",
"met"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L880-L899 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generateReturnTypeInvariantCheck | private void generateReturnTypeInvariantCheck(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
Tuple<WyilFile.Type> returnTypes = declaration.getType().getReturns(... | java | private void generateReturnTypeInvariantCheck(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
Tuple<WyilFile.Type> returnTypes = declaration.getType().getReturns(... | [
"private",
"void",
"generateReturnTypeInvariantCheck",
"(",
"WyilFile",
".",
"Stmt",
".",
"Return",
"stmt",
",",
"Expr",
"[",
"]",
"exprs",
",",
"Context",
"context",
")",
"{",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
"=",
"(",
"WyilFil... | Generate a return type check in the case that it is necessary. For example,
if the return type contains a type invariant then it is likely to be
necessary. However, in the special case that the value being returned is
already of appropriate type, then it is not.
@param stmt
@param exprs
@param context
@throws ResolveE... | [
"Generate",
"a",
"return",
"type",
"check",
"in",
"the",
"case",
"that",
"it",
"is",
"necessary",
".",
"For",
"example",
"if",
"the",
"return",
"type",
"contains",
"a",
"type",
"invariant",
"then",
"it",
"is",
"likely",
"to",
"be",
"necessary",
".",
"How... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L912-L924 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generatePostconditionChecks | private void generatePostconditionChecks(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
WyilFile.Tuple<WyilFile.Expr> postcondition = declaration.getEnsures();
... | java | private void generatePostconditionChecks(WyilFile.Stmt.Return stmt, Expr[] exprs, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
WyilFile.Tuple<WyilFile.Expr> postcondition = declaration.getEnsures();
... | [
"private",
"void",
"generatePostconditionChecks",
"(",
"WyilFile",
".",
"Stmt",
".",
"Return",
"stmt",
",",
"Expr",
"[",
"]",
"exprs",
",",
"Context",
"context",
")",
"{",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
"=",
"(",
"WyilFile",
... | Generate the post-condition checks necessary at a return statement in a
function or method.
@param stmt
@param exprs
@param context | [
"Generate",
"the",
"post",
"-",
"condition",
"checks",
"necessary",
"at",
"a",
"return",
"statement",
"in",
"a",
"function",
"or",
"method",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L943-L977 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateSwitch | private Context translateSwitch(WyilFile.Stmt.Switch stmt, Context context) {
Tuple<WyilFile.Stmt.Case> cases = stmt.getCases();
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr value = p.first();
context = p.second();
//
WyalFile.Stmt defaultValue = null;... | java | private Context translateSwitch(WyilFile.Stmt.Switch stmt, Context context) {
Tuple<WyilFile.Stmt.Case> cases = stmt.getCases();
//
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getCondition(), null, context);
Expr value = p.first();
context = p.second();
//
WyalFile.Stmt defaultValue = null;... | [
"private",
"Context",
"translateSwitch",
"(",
"WyilFile",
".",
"Stmt",
".",
"Switch",
"stmt",
",",
"Context",
"context",
")",
"{",
"Tuple",
"<",
"WyilFile",
".",
"Stmt",
".",
"Case",
">",
"cases",
"=",
"stmt",
".",
"getCases",
"(",
")",
";",
"//",
"Pai... | Translate a switch statement.
@param stmt
@param wyalFile | [
"Translate",
"a",
"switch",
"statement",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L995-L1036 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateWhile | private Context translateWhile(WyilFile.Stmt.While stmt, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
// Translate the loop invariant and generate appropriate macro
translateLoopInvariantMacros(stmt... | java | private Context translateWhile(WyilFile.Stmt.While stmt, Context context) {
WyilFile.Decl.FunctionOrMethod declaration = (WyilFile.Decl.FunctionOrMethod) context.getEnvironment()
.getParent().enclosingDeclaration;
// Translate the loop invariant and generate appropriate macro
translateLoopInvariantMacros(stmt... | [
"private",
"Context",
"translateWhile",
"(",
"WyilFile",
".",
"Stmt",
".",
"While",
"stmt",
",",
"Context",
"context",
")",
"{",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
"=",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
")",
... | Translate a While statement.
@param stmt
@param context
@return | [
"Translate",
"a",
"While",
"statement",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1045-L1077 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateLoopInvariantMacros | private void translateLoopInvariantMacros(Stmt.Loop stmt, WyilFile.Decl.FunctionOrMethod declaration,
WyalFile wyalFile) {
//
Identifier[] prefix = declaration.getQualifiedName().toName().getAll();
Tuple<WyilFile.Expr> loopInvariant = stmt.getInvariant();
//
for (int i = 0; i != loopInvariant.size(); ++i) ... | java | private void translateLoopInvariantMacros(Stmt.Loop stmt, WyilFile.Decl.FunctionOrMethod declaration,
WyalFile wyalFile) {
//
Identifier[] prefix = declaration.getQualifiedName().toName().getAll();
Tuple<WyilFile.Expr> loopInvariant = stmt.getInvariant();
//
for (int i = 0; i != loopInvariant.size(); ++i) ... | [
"private",
"void",
"translateLoopInvariantMacros",
"(",
"Stmt",
".",
"Loop",
"stmt",
",",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
",",
"WyalFile",
"wyalFile",
")",
"{",
"//",
"Identifier",
"[",
"]",
"prefix",
"=",
"declaration",
".",
"... | Translate the sequence of invariant expressions which constitute the loop
invariant of a loop into one or more macros
@param loopInvariant
The clauses making up the loop invariant
@param environment
@param wyalFile | [
"Translate",
"the",
"sequence",
"of",
"invariant",
"expressions",
"which",
"constitute",
"the",
"loop",
"invariant",
"of",
"a",
"loop",
"into",
"one",
"or",
"more",
"macros"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1088-L1106 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateVariableDeclaration | private Context translateVariableDeclaration(WyilFile.Decl.Variable stmt, Context context) {
if (stmt.hasInitialiser()) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getInitialiser(), null, context);
context = p.second();
generateTypeInvariantCheck(stmt.getType(), p.first(), context);
conte... | java | private Context translateVariableDeclaration(WyilFile.Decl.Variable stmt, Context context) {
if (stmt.hasInitialiser()) {
Pair<Expr, Context> p = translateExpressionWithChecks(stmt.getInitialiser(), null, context);
context = p.second();
generateTypeInvariantCheck(stmt.getType(), p.first(), context);
conte... | [
"private",
"Context",
"translateVariableDeclaration",
"(",
"WyilFile",
".",
"Decl",
".",
"Variable",
"stmt",
",",
"Context",
"context",
")",
"{",
"if",
"(",
"stmt",
".",
"hasInitialiser",
"(",
")",
")",
"{",
"Pair",
"<",
"Expr",
",",
"Context",
">",
"p",
... | Translate a variable declaration.
@param stmt
@param context
@return | [
"Translate",
"a",
"variable",
"declaration",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1170-L1179 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.translateAsUnknown | private Expr translateAsUnknown(WyilFile.Expr expr, LocalEnvironment environment) {
// What we're doing here is creating a completely fresh variable to
// represent the return value. This is basically saying the return value
// could be anything, and we don't care what.
String name = "r" + Integer.toString(expr... | java | private Expr translateAsUnknown(WyilFile.Expr expr, LocalEnvironment environment) {
// What we're doing here is creating a completely fresh variable to
// represent the return value. This is basically saying the return value
// could be anything, and we don't care what.
String name = "r" + Integer.toString(expr... | [
"private",
"Expr",
"translateAsUnknown",
"(",
"WyilFile",
".",
"Expr",
"expr",
",",
"LocalEnvironment",
"environment",
")",
"{",
"// What we're doing here is creating a completely fresh variable to",
"// represent the return value. This is basically saying the return value",
"// could ... | Translating as unknown basically means we're not representing the operation
in question at the verification level. This could be something that we'll
implement in the future, or maybe not.
@param expr
@param environment
@return | [
"Translating",
"as",
"unknown",
"basically",
"means",
"we",
"re",
"not",
"representing",
"the",
"operation",
"in",
"question",
"at",
"the",
"verification",
"level",
".",
"This",
"could",
"be",
"something",
"that",
"we",
"ll",
"implement",
"in",
"the",
"future"... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1639-L1651 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generateQuantifierTypePattern | private WyalFile.VariableDeclaration[] generateQuantifierTypePattern(WyilFile.Expr.Quantifier expr,
LocalEnvironment environment) {
//
Tuple<WyilFile.Decl.Variable> params = expr.getParameters();
WyalFile.VariableDeclaration[] vardecls = new WyalFile.VariableDeclaration[params.size()];
for (int i = 0; i != p... | java | private WyalFile.VariableDeclaration[] generateQuantifierTypePattern(WyilFile.Expr.Quantifier expr,
LocalEnvironment environment) {
//
Tuple<WyilFile.Decl.Variable> params = expr.getParameters();
WyalFile.VariableDeclaration[] vardecls = new WyalFile.VariableDeclaration[params.size()];
for (int i = 0; i != p... | [
"private",
"WyalFile",
".",
"VariableDeclaration",
"[",
"]",
"generateQuantifierTypePattern",
"(",
"WyilFile",
".",
"Expr",
".",
"Quantifier",
"expr",
",",
"LocalEnvironment",
"environment",
")",
"{",
"//",
"Tuple",
"<",
"WyilFile",
".",
"Decl",
".",
"Variable",
... | Generate a type pattern representing the type and name of all quantifier
variables described by this quantifier.
@param expr
@return | [
"Generate",
"a",
"type",
"pattern",
"representing",
"the",
"type",
"and",
"name",
"of",
"all",
"quantifier",
"variables",
"described",
"by",
"this",
"quantifier",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1660-L1670 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.implies | private WyalFile.Stmt implies(WyalFile.Stmt antecedent, WyalFile.Stmt consequent) {
if (antecedent == null) {
return consequent;
} else {
WyalFile.Stmt.Block antecedentBlock = new WyalFile.Stmt.Block(antecedent);
WyalFile.Stmt.Block consequentBlock = new WyalFile.Stmt.Block(consequent);
return new WyalF... | java | private WyalFile.Stmt implies(WyalFile.Stmt antecedent, WyalFile.Stmt consequent) {
if (antecedent == null) {
return consequent;
} else {
WyalFile.Stmt.Block antecedentBlock = new WyalFile.Stmt.Block(antecedent);
WyalFile.Stmt.Block consequentBlock = new WyalFile.Stmt.Block(consequent);
return new WyalF... | [
"private",
"WyalFile",
".",
"Stmt",
"implies",
"(",
"WyalFile",
".",
"Stmt",
"antecedent",
",",
"WyalFile",
".",
"Stmt",
"consequent",
")",
"{",
"if",
"(",
"antecedent",
"==",
"null",
")",
"{",
"return",
"consequent",
";",
"}",
"else",
"{",
"WyalFile",
"... | Construct an implication from one expression to another
@param antecedent
@param consequent
@return | [
"Construct",
"an",
"implication",
"from",
"one",
"expression",
"to",
"another"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1721-L1729 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.and | private WyalFile.Stmt and(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
return new WyalFile.Stmt.Block(lhs, rhs);
}
} | java | private WyalFile.Stmt and(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
return new WyalFile.Stmt.Block(lhs, rhs);
}
} | [
"private",
"WyalFile",
".",
"Stmt",
"and",
"(",
"WyalFile",
".",
"Stmt",
"lhs",
",",
"WyalFile",
".",
"Stmt",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
")",
"{",
"return",
"rhs",
";",
"}",
"else",
"if",
"(",
"rhs",
"==",
"null",
")",
"{",
... | Construct a conjunction of two expressions
@param lhs
@param rhs
@return | [
"Construct",
"a",
"conjunction",
"of",
"two",
"expressions"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1738-L1746 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.or | private WyalFile.Stmt or(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
WyalFile.Stmt.Block lhsBlock = new WyalFile.Stmt.Block(lhs);
WyalFile.Stmt.Block rhsBlock = new WyalFile.Stmt.Block(rhs);
return new WyalFile.Stmt.CaseOf(lh... | java | private WyalFile.Stmt or(WyalFile.Stmt lhs, WyalFile.Stmt rhs) {
if (lhs == null) {
return rhs;
} else if (rhs == null) {
return rhs;
} else {
WyalFile.Stmt.Block lhsBlock = new WyalFile.Stmt.Block(lhs);
WyalFile.Stmt.Block rhsBlock = new WyalFile.Stmt.Block(rhs);
return new WyalFile.Stmt.CaseOf(lh... | [
"private",
"WyalFile",
".",
"Stmt",
"or",
"(",
"WyalFile",
".",
"Stmt",
"lhs",
",",
"WyalFile",
".",
"Stmt",
"rhs",
")",
"{",
"if",
"(",
"lhs",
"==",
"null",
")",
"{",
"return",
"rhs",
";",
"}",
"else",
"if",
"(",
"rhs",
"==",
"null",
")",
"{",
... | Construct a disjunct of two expressions
@param lhs
@param rhs
@return | [
"Construct",
"a",
"disjunct",
"of",
"two",
"expressions"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1765-L1775 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.updateVariableVersions | private AssumptionSet updateVariableVersions(AssumptionSet assumptions, LocalEnvironment original,
LocalEnvironment updated) {
for (Map.Entry<WyilFile.Decl.Variable, WyalFile.VariableDeclaration> e : updated.locals.entrySet()) {
WyilFile.Decl.Variable var = e.getKey();
WyalFile.VariableDeclaration newVarVer... | java | private AssumptionSet updateVariableVersions(AssumptionSet assumptions, LocalEnvironment original,
LocalEnvironment updated) {
for (Map.Entry<WyilFile.Decl.Variable, WyalFile.VariableDeclaration> e : updated.locals.entrySet()) {
WyilFile.Decl.Variable var = e.getKey();
WyalFile.VariableDeclaration newVarVer... | [
"private",
"AssumptionSet",
"updateVariableVersions",
"(",
"AssumptionSet",
"assumptions",
",",
"LocalEnvironment",
"original",
",",
"LocalEnvironment",
"updated",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"WyilFile",
".",
"Decl",
".",
"Variable",
",",
"Wyal... | Bring a given assumption set which is consistent with an original environment
up-to-date with a new environment.
@param assumptions
The assumption set associated with a given context being joined
together.
@param original
The original environment associated with the given context. This
maps from location indices to ve... | [
"Bring",
"a",
"given",
"assumption",
"set",
"which",
"is",
"consistent",
"with",
"an",
"original",
"environment",
"up",
"-",
"to",
"-",
"date",
"with",
"a",
"new",
"environment",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1879-L1894 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.joinEnvironments | private LocalEnvironment joinEnvironments(Context... contexts) {
//
Context head = contexts[0];
GlobalEnvironment global = head.getEnvironment().getParent();
HashSet<WyilFile.Decl.Variable> modified = new HashSet<>();
HashSet<WyilFile.Decl.Variable> deleted = new HashSet<>();
Map<WyilFile.Decl.Variable, Wya... | java | private LocalEnvironment joinEnvironments(Context... contexts) {
//
Context head = contexts[0];
GlobalEnvironment global = head.getEnvironment().getParent();
HashSet<WyilFile.Decl.Variable> modified = new HashSet<>();
HashSet<WyilFile.Decl.Variable> deleted = new HashSet<>();
Map<WyilFile.Decl.Variable, Wya... | [
"private",
"LocalEnvironment",
"joinEnvironments",
"(",
"Context",
"...",
"contexts",
")",
"{",
"//",
"Context",
"head",
"=",
"contexts",
"[",
"0",
"]",
";",
"GlobalEnvironment",
"global",
"=",
"head",
".",
"getEnvironment",
"(",
")",
".",
"getParent",
"(",
... | Join the local environments of one or more context's together. This means
retaining variable versions which are the same for all context's, allocating
new versions for those which are different in at least one case, and removing
those which aren't present it at least one.
@param contexts
Array of at least one non-null... | [
"Join",
"the",
"local",
"environments",
"of",
"one",
"or",
"more",
"context",
"s",
"together",
".",
"This",
"means",
"retaining",
"variable",
"versions",
"which",
"are",
"the",
"same",
"for",
"all",
"context",
"s",
"allocating",
"new",
"versions",
"for",
"th... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1906-L1959 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.createFunctionOrMethodPrototype | private void createFunctionOrMethodPrototype(WyilFile.Decl.FunctionOrMethod declaration) {
Tuple<WyilFile.Decl.Variable> params = declaration.getParameters();
Tuple<WyilFile.Decl.Variable> returns = declaration.getReturns();
//
WyalFile.VariableDeclaration[] parameters = new WyalFile.VariableDeclaration[params.... | java | private void createFunctionOrMethodPrototype(WyilFile.Decl.FunctionOrMethod declaration) {
Tuple<WyilFile.Decl.Variable> params = declaration.getParameters();
Tuple<WyilFile.Decl.Variable> returns = declaration.getReturns();
//
WyalFile.VariableDeclaration[] parameters = new WyalFile.VariableDeclaration[params.... | [
"private",
"void",
"createFunctionOrMethodPrototype",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
")",
"{",
"Tuple",
"<",
"WyilFile",
".",
"Decl",
".",
"Variable",
">",
"params",
"=",
"declaration",
".",
"getParameters",
"(",
")",
";",
... | Construct a function or method prototype with a given name and type. The
function or method can then be called elsewhere as an uninterpreted function.
The function or method doesn't have a body but is used as a name to be
referred to from assertions.
@param declaration
--- the function or method declaration in questio... | [
"Construct",
"a",
"function",
"or",
"method",
"prototype",
"with",
"a",
"given",
"name",
"and",
"type",
".",
"The",
"function",
"or",
"method",
"can",
"then",
"be",
"called",
"elsewhere",
"as",
"an",
"uninterpreted",
"function",
".",
"The",
"function",
"or",... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L1973-L1996 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.createAssertions | private void createAssertions(WyilFile.Decl declaration, List<VerificationCondition> vcs,
GlobalEnvironment environment) {
// FIXME: should be logged somehow?
for (int i = 0; i != vcs.size(); ++i) {
VerificationCondition vc = vcs.get(i);
// Build the actual verification condition
WyalFile.Stmt.Block ver... | java | private void createAssertions(WyilFile.Decl declaration, List<VerificationCondition> vcs,
GlobalEnvironment environment) {
// FIXME: should be logged somehow?
for (int i = 0; i != vcs.size(); ++i) {
VerificationCondition vc = vcs.get(i);
// Build the actual verification condition
WyalFile.Stmt.Block ver... | [
"private",
"void",
"createAssertions",
"(",
"WyilFile",
".",
"Decl",
"declaration",
",",
"List",
"<",
"VerificationCondition",
">",
"vcs",
",",
"GlobalEnvironment",
"environment",
")",
"{",
"// FIXME: should be logged somehow?",
"for",
"(",
"int",
"i",
"=",
"0",
"... | Turn each verification condition into an assertion in the underlying WyalFile
being generated. The main challenge here is to ensure that all variables used
in the assertion are properly typed.
@param declaration
The enclosing function or method declaration
@param vcs
The list of verification conditions which have been... | [
"Turn",
"each",
"verification",
"condition",
"into",
"an",
"assertion",
"in",
"the",
"underlying",
"WyalFile",
"being",
"generated",
".",
"The",
"main",
"challenge",
"here",
"is",
"to",
"ensure",
"that",
"all",
"variables",
"used",
"in",
"the",
"assertion",
"a... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2014-L2030 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.buildVerificationCondition | public WyalFile.Stmt.Block buildVerificationCondition(WyilFile.Decl declaration, GlobalEnvironment environment,
VerificationCondition vc) {
WyalFile.Stmt antecedent = flatten(vc.antecedent);
Expr consequent = vc.consequent;
HashSet<WyalFile.VariableDeclaration> freeVariables = new HashSet<>();
freeVariables(... | java | public WyalFile.Stmt.Block buildVerificationCondition(WyilFile.Decl declaration, GlobalEnvironment environment,
VerificationCondition vc) {
WyalFile.Stmt antecedent = flatten(vc.antecedent);
Expr consequent = vc.consequent;
HashSet<WyalFile.VariableDeclaration> freeVariables = new HashSet<>();
freeVariables(... | [
"public",
"WyalFile",
".",
"Stmt",
".",
"Block",
"buildVerificationCondition",
"(",
"WyilFile",
".",
"Decl",
"declaration",
",",
"GlobalEnvironment",
"environment",
",",
"VerificationCondition",
"vc",
")",
"{",
"WyalFile",
".",
"Stmt",
"antecedent",
"=",
"flatten",
... | Construct a fully typed and quantified expression for representing a
verification condition. Aside from flattening the various components, it must
also determine appropriate variable types, including those for aliased
variables.
@param vc
@param environment
@return | [
"Construct",
"a",
"fully",
"typed",
"and",
"quantified",
"expression",
"for",
"representing",
"a",
"verification",
"condition",
".",
"Aside",
"from",
"flattening",
"the",
"various",
"components",
"it",
"must",
"also",
"determine",
"appropriate",
"variable",
"types",... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2042-L2065 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.flatten | private WyalFile.Stmt flatten(AssumptionSet assumptions) {
WyalFile.Stmt result = flattenUpto(assumptions, null);
if (result == null) {
return new Expr.Constant(new Value.Bool(true));
} else {
return result;
}
} | java | private WyalFile.Stmt flatten(AssumptionSet assumptions) {
WyalFile.Stmt result = flattenUpto(assumptions, null);
if (result == null) {
return new Expr.Constant(new Value.Bool(true));
} else {
return result;
}
} | [
"private",
"WyalFile",
".",
"Stmt",
"flatten",
"(",
"AssumptionSet",
"assumptions",
")",
"{",
"WyalFile",
".",
"Stmt",
"result",
"=",
"flattenUpto",
"(",
"assumptions",
",",
"null",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"return",
"new",
... | Flatten a given assumption set into a single logical condition. The key
challenge here is to try and do this as efficiency as possible.
@param assumptions
@return | [
"Flatten",
"a",
"given",
"assumption",
"set",
"into",
"a",
"single",
"logical",
"condition",
".",
"The",
"key",
"challenge",
"here",
"is",
"to",
"try",
"and",
"do",
"this",
"as",
"efficiency",
"as",
"possible",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2074-L2081 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.flattenUpto | private WyalFile.Stmt flattenUpto(AssumptionSet assumptions, AssumptionSet ancestor) {
if (assumptions == ancestor) {
// We have reached the ancestor
return null;
} else {
// Flattern parent assumptions
AssumptionSet[] parents = assumptions.parents;
WyalFile.Stmt e = null;
switch (parents.length)... | java | private WyalFile.Stmt flattenUpto(AssumptionSet assumptions, AssumptionSet ancestor) {
if (assumptions == ancestor) {
// We have reached the ancestor
return null;
} else {
// Flattern parent assumptions
AssumptionSet[] parents = assumptions.parents;
WyalFile.Stmt e = null;
switch (parents.length)... | [
"private",
"WyalFile",
".",
"Stmt",
"flattenUpto",
"(",
"AssumptionSet",
"assumptions",
",",
"AssumptionSet",
"ancestor",
")",
"{",
"if",
"(",
"assumptions",
"==",
"ancestor",
")",
"{",
"// We have reached the ancestor",
"return",
"null",
";",
"}",
"else",
"{",
... | Flatten an assumption set upto a given ancestor. That is, do not include the
ancestor or any of its ancestors in the results. This is a little like taking
the difference of the given assumptions and the given ancestor's assumptions.
@param assumptions
The assumption set to be flattened
@param ancestor
An ancestor of t... | [
"Flatten",
"an",
"assumption",
"set",
"upto",
"a",
"given",
"ancestor",
".",
"That",
"is",
"do",
"not",
"include",
"the",
"ancestor",
"or",
"any",
"of",
"its",
"ancestors",
"in",
"the",
"results",
".",
"This",
"is",
"a",
"little",
"like",
"taking",
"the"... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2095-L2130 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.determineVariableAliases | private Expr determineVariableAliases(GlobalEnvironment environment,
Set<WyalFile.VariableDeclaration> freeVariables) {
Expr aliases = null;
for (WyalFile.VariableDeclaration var : freeVariables) {
WyalFile.VariableDeclaration parent = environment.getParent(var);
if (parent != null) {
// This indicates... | java | private Expr determineVariableAliases(GlobalEnvironment environment,
Set<WyalFile.VariableDeclaration> freeVariables) {
Expr aliases = null;
for (WyalFile.VariableDeclaration var : freeVariables) {
WyalFile.VariableDeclaration parent = environment.getParent(var);
if (parent != null) {
// This indicates... | [
"private",
"Expr",
"determineVariableAliases",
"(",
"GlobalEnvironment",
"environment",
",",
"Set",
"<",
"WyalFile",
".",
"VariableDeclaration",
">",
"freeVariables",
")",
"{",
"Expr",
"aliases",
"=",
"null",
";",
"for",
"(",
"WyalFile",
".",
"VariableDeclaration",
... | Determine any variable aliases which need to be accounted for. This is done
by adding an equality between the aliased variables to ensure they have the
same value.
@param environment
@param freeVariables
@return | [
"Determine",
"any",
"variable",
"aliases",
"which",
"need",
"to",
"be",
"accounted",
"for",
".",
"This",
"is",
"done",
"by",
"adding",
"an",
"equality",
"between",
"the",
"aliased",
"variables",
"to",
"ensure",
"they",
"have",
"the",
"same",
"value",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2141-L2157 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generatePreconditionParameters | private WyalFile.VariableDeclaration[] generatePreconditionParameters(WyilFile.Decl.Callable declaration,
LocalEnvironment environment) {
Tuple<WyilFile.Decl.Variable> params = declaration.getParameters();
WyalFile.VariableDeclaration[] vars = new WyalFile.VariableDeclaration[params.size()];
// second, set ini... | java | private WyalFile.VariableDeclaration[] generatePreconditionParameters(WyilFile.Decl.Callable declaration,
LocalEnvironment environment) {
Tuple<WyilFile.Decl.Variable> params = declaration.getParameters();
WyalFile.VariableDeclaration[] vars = new WyalFile.VariableDeclaration[params.size()];
// second, set ini... | [
"private",
"WyalFile",
".",
"VariableDeclaration",
"[",
"]",
"generatePreconditionParameters",
"(",
"WyilFile",
".",
"Decl",
".",
"Callable",
"declaration",
",",
"LocalEnvironment",
"environment",
")",
"{",
"Tuple",
"<",
"WyilFile",
".",
"Decl",
".",
"Variable",
"... | Convert the parameter types for a given function or method declaration into a
corresponding list of type patterns. This is primarily useful for generating
declarations from functions or method.
@param params
@param declaration
@return | [
"Convert",
"the",
"parameter",
"types",
"for",
"a",
"given",
"function",
"or",
"method",
"declaration",
"into",
"a",
"corresponding",
"list",
"of",
"type",
"patterns",
".",
"This",
"is",
"primarily",
"useful",
"for",
"generating",
"declarations",
"from",
"functi... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2191-L2201 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generatePostconditionTypePattern | private WyalFile.VariableDeclaration[] generatePostconditionTypePattern(WyilFile.Decl.FunctionOrMethod declaration,
LocalEnvironment environment) {
Tuple<Decl.Variable> params = declaration.getParameters();
Tuple<Decl.Variable> returns = declaration.getReturns();
WyalFile.VariableDeclaration[] vars = new WyalF... | java | private WyalFile.VariableDeclaration[] generatePostconditionTypePattern(WyilFile.Decl.FunctionOrMethod declaration,
LocalEnvironment environment) {
Tuple<Decl.Variable> params = declaration.getParameters();
Tuple<Decl.Variable> returns = declaration.getReturns();
WyalFile.VariableDeclaration[] vars = new WyalF... | [
"private",
"WyalFile",
".",
"VariableDeclaration",
"[",
"]",
"generatePostconditionTypePattern",
"(",
"WyilFile",
".",
"Decl",
".",
"FunctionOrMethod",
"declaration",
",",
"LocalEnvironment",
"environment",
")",
"{",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"para... | Convert the return types for a given function or method declaration into a
corresponding list of type patterns. This is primarily useful for generating
declarations from functions or method.
@param params
@param declaration
@return | [
"Convert",
"the",
"return",
"types",
"for",
"a",
"given",
"function",
"or",
"method",
"declaration",
"into",
"a",
"corresponding",
"list",
"of",
"type",
"patterns",
".",
"This",
"is",
"primarily",
"useful",
"for",
"generating",
"declarations",
"from",
"functions... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2212-L2228 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.generateLoopInvariantParameterDeclarations | private WyalFile.VariableDeclaration[] generateLoopInvariantParameterDeclarations(Stmt.Loop loop,
LocalEnvironment environment) {
// Extract all used variables within the loop invariant. This is necessary to
// determine what parameters are required for the loop invariant macros.
Tuple<Decl.Variable> modified ... | java | private WyalFile.VariableDeclaration[] generateLoopInvariantParameterDeclarations(Stmt.Loop loop,
LocalEnvironment environment) {
// Extract all used variables within the loop invariant. This is necessary to
// determine what parameters are required for the loop invariant macros.
Tuple<Decl.Variable> modified ... | [
"private",
"WyalFile",
".",
"VariableDeclaration",
"[",
"]",
"generateLoopInvariantParameterDeclarations",
"(",
"Stmt",
".",
"Loop",
"loop",
",",
"LocalEnvironment",
"environment",
")",
"{",
"// Extract all used variables within the loop invariant. This is necessary to",
"// dete... | Convert the types of local variables in scope at a given position within a
function or method into a type pattern. This is primarily useful for
determining the types for a loop invariant macro.
@param params
@param declaration
@return | [
"Convert",
"the",
"types",
"of",
"local",
"variables",
"in",
"scope",
"at",
"a",
"given",
"position",
"within",
"a",
"function",
"or",
"method",
"into",
"a",
"type",
"pattern",
".",
"This",
"is",
"primarily",
"useful",
"for",
"determining",
"the",
"types",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2239-L2251 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.determineUsedVariables | public Tuple<Decl.Variable> determineUsedVariables(Tuple<WyilFile.Expr> exprs) {
HashSet<Decl.Variable> used = new HashSet<>();
usedVariableExtractor.visitExpressions(exprs, used);
return new Tuple<>(used);
} | java | public Tuple<Decl.Variable> determineUsedVariables(Tuple<WyilFile.Expr> exprs) {
HashSet<Decl.Variable> used = new HashSet<>();
usedVariableExtractor.visitExpressions(exprs, used);
return new Tuple<>(used);
} | [
"public",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"determineUsedVariables",
"(",
"Tuple",
"<",
"WyilFile",
".",
"Expr",
">",
"exprs",
")",
"{",
"HashSet",
"<",
"Decl",
".",
"Variable",
">",
"used",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"usedV... | Determine the set of used variables in a given set of expressions. A used
variable is one referred to by a VariableAccess expression.
@param expression
@return | [
"Determine",
"the",
"set",
"of",
"used",
"variables",
"in",
"a",
"given",
"set",
"of",
"expressions",
".",
"A",
"used",
"variable",
"is",
"one",
"referred",
"to",
"by",
"a",
"VariableAccess",
"expression",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2296-L2300 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.convert | public WyalFile.Name convert(QualifiedName id, SyntacticItem context) {
return convert(id.getUnit(), id.getName().get(), context);
} | java | public WyalFile.Name convert(QualifiedName id, SyntacticItem context) {
return convert(id.getUnit(), id.getName().get(), context);
} | [
"public",
"WyalFile",
".",
"Name",
"convert",
"(",
"QualifiedName",
"id",
",",
"SyntacticItem",
"context",
")",
"{",
"return",
"convert",
"(",
"id",
".",
"getUnit",
"(",
")",
",",
"id",
".",
"getName",
"(",
")",
".",
"get",
"(",
")",
",",
"context",
... | Convert a Name identifier from a WyIL into one suitable for a WyAL file.
@param id
@return | [
"Convert",
"a",
"Name",
"identifier",
"from",
"a",
"WyIL",
"into",
"one",
"suitable",
"for",
"a",
"WyAL",
"file",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2308-L2310 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.convert | public WyalFile.Name convert(QualifiedName id, String suffix, SyntacticItem context) {
return convert(id.getUnit(), id.getName().get().concat(suffix), context);
} | java | public WyalFile.Name convert(QualifiedName id, String suffix, SyntacticItem context) {
return convert(id.getUnit(), id.getName().get().concat(suffix), context);
} | [
"public",
"WyalFile",
".",
"Name",
"convert",
"(",
"QualifiedName",
"id",
",",
"String",
"suffix",
",",
"SyntacticItem",
"context",
")",
"{",
"return",
"convert",
"(",
"id",
".",
"getUnit",
"(",
")",
",",
"id",
".",
"getName",
"(",
")",
".",
"get",
"("... | Convert a qualified name along with an additional suffix into one suitable
for a WyAL file.
@param id
@param suffix
@param context
@return | [
"Convert",
"a",
"qualified",
"name",
"along",
"with",
"an",
"additional",
"suffix",
"into",
"one",
"suitable",
"for",
"a",
"WyAL",
"file",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2321-L2323 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.typeMayHaveInvariant | private static boolean typeMayHaveInvariant(Type type, Context context) {
if (type instanceof Type.Void) {
return false;
} else if (type instanceof Type.Null) {
return false;
} else if (type instanceof Type.Bool) {
return false;
} else if (type instanceof Type.Byte) {
return false;
} else if (type... | java | private static boolean typeMayHaveInvariant(Type type, Context context) {
if (type instanceof Type.Void) {
return false;
} else if (type instanceof Type.Null) {
return false;
} else if (type instanceof Type.Bool) {
return false;
} else if (type instanceof Type.Byte) {
return false;
} else if (type... | [
"private",
"static",
"boolean",
"typeMayHaveInvariant",
"(",
"Type",
"type",
",",
"Context",
"context",
")",
"{",
"if",
"(",
"type",
"instanceof",
"Type",
".",
"Void",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"type",
"instanceof",
"Type",
... | Perform a simple check to see whether or not a given type may have an
invariant, or not.
@param type
@return | [
"Perform",
"a",
"simple",
"check",
"to",
"see",
"whether",
"or",
"not",
"a",
"given",
"type",
"may",
"have",
"an",
"invariant",
"or",
"not",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2434-L2482 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.freeVariables | public void freeVariables(SyntacticItem e, Set<WyalFile.VariableDeclaration> freeVars) {
if (e instanceof Expr.VariableAccess) {
Expr.VariableAccess va = (Expr.VariableAccess) e;
freeVars.add(va.getVariableDeclaration());
} else if (e instanceof Expr.Quantifier) {
Expr.Quantifier q = (Expr.Quantifier) e;
... | java | public void freeVariables(SyntacticItem e, Set<WyalFile.VariableDeclaration> freeVars) {
if (e instanceof Expr.VariableAccess) {
Expr.VariableAccess va = (Expr.VariableAccess) e;
freeVars.add(va.getVariableDeclaration());
} else if (e instanceof Expr.Quantifier) {
Expr.Quantifier q = (Expr.Quantifier) e;
... | [
"public",
"void",
"freeVariables",
"(",
"SyntacticItem",
"e",
",",
"Set",
"<",
"WyalFile",
".",
"VariableDeclaration",
">",
"freeVars",
")",
"{",
"if",
"(",
"e",
"instanceof",
"Expr",
".",
"VariableAccess",
")",
"{",
"Expr",
".",
"VariableAccess",
"va",
"=",... | Determine all free variables which are used within the given expression. A
free variable is one which is not bound within the expression itself.
@param e
@param freeVars | [
"Determine",
"all",
"free",
"variables",
"which",
"are",
"used",
"within",
"the",
"given",
"expression",
".",
"A",
"free",
"variable",
"is",
"one",
"which",
"is",
"not",
"bound",
"within",
"the",
"expression",
"itself",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2500-L2519 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/VerificationConditionGenerator.java | VerificationConditionGenerator.removeNull | private static <T> T[] removeNull(T[] items) {
int count = 0;
for (int i = 0; i != items.length; ++i) {
if (items[i] == null) {
count = count + 1;
}
}
if (count == 0) {
return items;
} else {
T[] rs = java.util.Arrays.copyOf(items, items.length - count);
for (int i = 0, j = 0; i != items.le... | java | private static <T> T[] removeNull(T[] items) {
int count = 0;
for (int i = 0; i != items.length; ++i) {
if (items[i] == null) {
count = count + 1;
}
}
if (count == 0) {
return items;
} else {
T[] rs = java.util.Arrays.copyOf(items, items.length - count);
for (int i = 0, j = 0; i != items.le... | [
"private",
"static",
"<",
"T",
">",
"T",
"[",
"]",
"removeNull",
"(",
"T",
"[",
"]",
"items",
")",
"{",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"items",
".",
"length",
";",
"++",
"i",
")",
"{",
"if",... | Create exact copy of a given array, but with evey null element removed.
@param items
@return | [
"Create",
"exact",
"copy",
"of",
"a",
"given",
"array",
"but",
"with",
"evey",
"null",
"element",
"removed",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/VerificationConditionGenerator.java#L2596-L2616 | train |
Whiley/WhileyCompiler | src/main/java/wyil/type/binding/RelaxedTypeResolver.java | RelaxedTypeResolver.isApplicable | private boolean isApplicable(Type.Callable candidate, LifetimeRelation lifetimes,
Tuple<? extends SemanticType> args) {
Tuple<Type> parameters = candidate.getParameters();
if (parameters.size() != args.size()) {
// Differing number of parameters / arguments. Since we don't
// support variable-length argume... | java | private boolean isApplicable(Type.Callable candidate, LifetimeRelation lifetimes,
Tuple<? extends SemanticType> args) {
Tuple<Type> parameters = candidate.getParameters();
if (parameters.size() != args.size()) {
// Differing number of parameters / arguments. Since we don't
// support variable-length argume... | [
"private",
"boolean",
"isApplicable",
"(",
"Type",
".",
"Callable",
"candidate",
",",
"LifetimeRelation",
"lifetimes",
",",
"Tuple",
"<",
"?",
"extends",
"SemanticType",
">",
"args",
")",
"{",
"Tuple",
"<",
"Type",
">",
"parameters",
"=",
"candidate",
".",
"... | Determine whether a given function or method declaration is applicable to a
given set of argument types. If there number of arguments differs, it's
definitely not applicable. Otherwise, we need every argument type to be a
subtype of its corresponding parameter type.
@param candidate
@param args
@return | [
"Determine",
"whether",
"a",
"given",
"function",
"or",
"method",
"declaration",
"is",
"applicable",
"to",
"a",
"given",
"set",
"of",
"argument",
"types",
".",
"If",
"there",
"number",
"of",
"arguments",
"differs",
"it",
"s",
"definitely",
"not",
"applicable",... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/binding/RelaxedTypeResolver.java#L288-L308 | train |
Whiley/WhileyCompiler | src/main/java/wyil/type/binding/RelaxedTypeResolver.java | RelaxedTypeResolver.selectCallableCandidate | private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) {
Binding best = null;
Type.Callable bestType = null;
boolean bestValidWinner = false;
//
for (int i = 0; i != candidates.size(); ++i) {
Binding candidate = candidates.get(i);
Type.Callable candidate... | java | private Binding selectCallableCandidate(Name name, List<Binding> candidates, LifetimeRelation lifetimes) {
Binding best = null;
Type.Callable bestType = null;
boolean bestValidWinner = false;
//
for (int i = 0; i != candidates.size(); ++i) {
Binding candidate = candidates.get(i);
Type.Callable candidate... | [
"private",
"Binding",
"selectCallableCandidate",
"(",
"Name",
"name",
",",
"List",
"<",
"Binding",
">",
"candidates",
",",
"LifetimeRelation",
"lifetimes",
")",
"{",
"Binding",
"best",
"=",
"null",
";",
"Type",
".",
"Callable",
"bestType",
"=",
"null",
";",
... | Given a list of candidate function or method declarations, determine the most
precise match for the supplied argument types. The given argument types must
be applicable to this function or macro declaration, and it must be a subtype
of all other applicable candidates.
@param candidates
@param args
@return | [
"Given",
"a",
"list",
"of",
"candidate",
"function",
"or",
"method",
"declarations",
"determine",
"the",
"most",
"precise",
"match",
"for",
"the",
"supplied",
"argument",
"types",
".",
"The",
"given",
"argument",
"types",
"must",
"be",
"applicable",
"to",
"thi... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/binding/RelaxedTypeResolver.java#L507-L551 | train |
Whiley/WhileyCompiler | src/main/java/wyil/type/binding/RelaxedTypeResolver.java | RelaxedTypeResolver.isSubtype | private boolean isSubtype(Type.Callable lhs, Type.Callable rhs, LifetimeRelation lifetimes) {
Tuple<Type> parentParams = lhs.getParameters();
Tuple<Type> childParams = rhs.getParameters();
if (parentParams.size() != childParams.size()) {
// Differing number of parameters / arguments. Since we don't
// suppo... | java | private boolean isSubtype(Type.Callable lhs, Type.Callable rhs, LifetimeRelation lifetimes) {
Tuple<Type> parentParams = lhs.getParameters();
Tuple<Type> childParams = rhs.getParameters();
if (parentParams.size() != childParams.size()) {
// Differing number of parameters / arguments. Since we don't
// suppo... | [
"private",
"boolean",
"isSubtype",
"(",
"Type",
".",
"Callable",
"lhs",
",",
"Type",
".",
"Callable",
"rhs",
",",
"LifetimeRelation",
"lifetimes",
")",
"{",
"Tuple",
"<",
"Type",
">",
"parentParams",
"=",
"lhs",
".",
"getParameters",
"(",
")",
";",
"Tuple"... | Check whether the type signature for a given function or method declaration
is a super type of a given child declaration.
@param lhs
@param rhs
@return | [
"Check",
"whether",
"the",
"type",
"signature",
"for",
"a",
"given",
"function",
"or",
"method",
"declaration",
"is",
"a",
"super",
"type",
"of",
"a",
"given",
"child",
"declaration",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/binding/RelaxedTypeResolver.java#L566-L586 | train |
Whiley/WhileyCompiler | src/main/java/wyil/type/util/TypeIntersector.java | TypeIntersector.extractNonMatchingFields | private static int extractNonMatchingFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
Type.Field[] result, int index) {
outer: for (int i = 0; i != lhsFields.size(); ++i) {
for (int j = 0; j != rhsFields.size(); ++j) {
Type.Field lhsField = lhsFields.get(i);
Type.Field rhsField = rhsFiel... | java | private static int extractNonMatchingFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
Type.Field[] result, int index) {
outer: for (int i = 0; i != lhsFields.size(); ++i) {
for (int j = 0; j != rhsFields.size(); ++j) {
Type.Field lhsField = lhsFields.get(i);
Type.Field rhsField = rhsFiel... | [
"private",
"static",
"int",
"extractNonMatchingFields",
"(",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"lhsFields",
",",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"rhsFields",
",",
"Type",
".",
"Field",
"[",
"]",
"result",
",",
"int",
"index",
")",
"{",
... | Extract fields from lhs which do not match any field in the rhs. That is,
there is no field in the rhs with the same name.
@param lhsFields
@param rhsFields
@param result
@param index
@return | [
"Extract",
"fields",
"from",
"lhs",
"which",
"do",
"not",
"match",
"any",
"field",
"in",
"the",
"rhs",
".",
"That",
"is",
"there",
"is",
"no",
"field",
"in",
"the",
"rhs",
"with",
"the",
"same",
"name",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/TypeIntersector.java#L256-L273 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/NameResolution.java | NameResolution.apply | public boolean apply() {
// FIXME: need to make this incremental
// Create initial set of patches.
List<Patch> patches = resolver.apply(target);
// Keep iterating until all patches are resolved
while (patches.size() > 0) {
// Create importer
Importer importer = new Importer(target, true);
// Now cont... | java | public boolean apply() {
// FIXME: need to make this incremental
// Create initial set of patches.
List<Patch> patches = resolver.apply(target);
// Keep iterating until all patches are resolved
while (patches.size() > 0) {
// Create importer
Importer importer = new Importer(target, true);
// Now cont... | [
"public",
"boolean",
"apply",
"(",
")",
"{",
"// FIXME: need to make this incremental",
"// Create initial set of patches.",
"List",
"<",
"Patch",
">",
"patches",
"=",
"resolver",
".",
"apply",
"(",
"target",
")",
";",
"// Keep iterating until all patches are resolved",
"... | Apply this name resolver to a given WyilFile.
@param wf | [
"Apply",
"this",
"name",
"resolver",
"to",
"a",
"given",
"WyilFile",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/NameResolution.java#L101-L121 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/NameResolution.java | NameResolution.getExternals | private List<WyilFile> getExternals() throws IOException {
ArrayList<WyilFile> externals = new ArrayList<>();
List<Build.Package> pkgs = project.getPackages();
// Consider each package in turn and identify all contained WyilFiles
for (int i = 0; i != pkgs.size(); ++i) {
Build.Package p = pkgs.get(i);
// F... | java | private List<WyilFile> getExternals() throws IOException {
ArrayList<WyilFile> externals = new ArrayList<>();
List<Build.Package> pkgs = project.getPackages();
// Consider each package in turn and identify all contained WyilFiles
for (int i = 0; i != pkgs.size(); ++i) {
Build.Package p = pkgs.get(i);
// F... | [
"private",
"List",
"<",
"WyilFile",
">",
"getExternals",
"(",
")",
"throws",
"IOException",
"{",
"ArrayList",
"<",
"WyilFile",
">",
"externals",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"List",
"<",
"Build",
".",
"Package",
">",
"pkgs",
"=",
"projec... | Read in all external packages so they can be used for name resolution. This
amounts to loading in every WyilFile contained within an external package
dependency. | [
"Read",
"in",
"all",
"external",
"packages",
"so",
"they",
"can",
"be",
"used",
"for",
"name",
"resolution",
".",
"This",
"amounts",
"to",
"loading",
"in",
"every",
"WyilFile",
"contained",
"within",
"an",
"external",
"package",
"dependency",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/NameResolution.java#L128-L142 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkTypeDeclaration | public void checkTypeDeclaration(Decl.Type decl) {
Environment environment = new Environment();
// Check type is contractive
checkContractive(decl);
// Check variable declaration is not empty
checkVariableDeclaration(decl.getVariableDeclaration(), environment);
// Check the type invariant
checkConditions(... | java | public void checkTypeDeclaration(Decl.Type decl) {
Environment environment = new Environment();
// Check type is contractive
checkContractive(decl);
// Check variable declaration is not empty
checkVariableDeclaration(decl.getVariableDeclaration(), environment);
// Check the type invariant
checkConditions(... | [
"public",
"void",
"checkTypeDeclaration",
"(",
"Decl",
".",
"Type",
"decl",
")",
"{",
"Environment",
"environment",
"=",
"new",
"Environment",
"(",
")",
";",
"// Check type is contractive",
"checkContractive",
"(",
"decl",
")",
";",
"// Check variable declaration is n... | Resolve types for a given type declaration. If an invariant expression is
given, then we have to check and resolve types throughout the expression.
@param td
Type declaration to check.
@throws IOException | [
"Resolve",
"types",
"for",
"a",
"given",
"type",
"declaration",
".",
"If",
"an",
"invariant",
"expression",
"is",
"given",
"then",
"we",
"have",
"to",
"check",
"and",
"resolve",
"types",
"throughout",
"the",
"expression",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L164-L172 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkStaticVariableDeclaration | public void checkStaticVariableDeclaration(Decl.StaticVariable decl) {
Environment environment = new Environment();
// Check type not void
checkVariableDeclaration(decl, environment);
} | java | public void checkStaticVariableDeclaration(Decl.StaticVariable decl) {
Environment environment = new Environment();
// Check type not void
checkVariableDeclaration(decl, environment);
} | [
"public",
"void",
"checkStaticVariableDeclaration",
"(",
"Decl",
".",
"StaticVariable",
"decl",
")",
"{",
"Environment",
"environment",
"=",
"new",
"Environment",
"(",
")",
";",
"// Check type not void",
"checkVariableDeclaration",
"(",
"decl",
",",
"environment",
")"... | check and check types for a given constant declaration.
@param cd
Constant declaration to check.
@throws IOException | [
"check",
"and",
"check",
"types",
"for",
"a",
"given",
"constant",
"declaration",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L181-L185 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkFunctionOrMethodDeclaration | public void checkFunctionOrMethodDeclaration(Decl.FunctionOrMethod d) {
// Construct initial environment
Environment environment = new Environment();
// Update environment so this within declared lifetimes
environment = FlowTypeUtils.declareThisWithin(d, environment);
// Check parameters and returns are not e... | java | public void checkFunctionOrMethodDeclaration(Decl.FunctionOrMethod d) {
// Construct initial environment
Environment environment = new Environment();
// Update environment so this within declared lifetimes
environment = FlowTypeUtils.declareThisWithin(d, environment);
// Check parameters and returns are not e... | [
"public",
"void",
"checkFunctionOrMethodDeclaration",
"(",
"Decl",
".",
"FunctionOrMethod",
"d",
")",
"{",
"// Construct initial environment",
"Environment",
"environment",
"=",
"new",
"Environment",
"(",
")",
";",
"// Update environment so this within declared lifetimes",
"e... | Type check a given function or method declaration.
@param fd
Function or method declaration to check.
@throws IOException | [
"Type",
"check",
"a",
"given",
"function",
"or",
"method",
"declaration",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L194-L220 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkReturnValue | private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) {
if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) {
// In this case, code reaches the end of the function or method and,
// furthermore, that this requires a return value. To get he... | java | private void checkReturnValue(Decl.FunctionOrMethod d, Environment last) {
if (d.match(Modifier.Native.class) == null && last != FlowTypeUtils.BOTTOM && d.getReturns().size() != 0) {
// In this case, code reaches the end of the function or method and,
// furthermore, that this requires a return value. To get he... | [
"private",
"void",
"checkReturnValue",
"(",
"Decl",
".",
"FunctionOrMethod",
"d",
",",
"Environment",
"last",
")",
"{",
"if",
"(",
"d",
".",
"match",
"(",
"Modifier",
".",
"Native",
".",
"class",
")",
"==",
"null",
"&&",
"last",
"!=",
"FlowTypeUtils",
".... | Check that a return value is provided when it is needed. For example, a
return value is not required for a method that has no return type. Likewise,
we don't expect one from a native method since there was no body to analyse.
@param d
@param last | [
"Check",
"that",
"a",
"return",
"value",
"is",
"provided",
"when",
"it",
"is",
"needed",
".",
"For",
"example",
"a",
"return",
"value",
"is",
"not",
"required",
"for",
"a",
"method",
"that",
"has",
"no",
"return",
"type",
".",
"Likewise",
"we",
"don",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L230-L238 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkBlock | private Environment checkBlock(Stmt.Block block, Environment environment, EnclosingScope scope) {
for (int i = 0; i != block.size(); ++i) {
Stmt stmt = block.get(i);
environment = checkStatement(stmt, environment, scope);
}
return environment;
} | java | private Environment checkBlock(Stmt.Block block, Environment environment, EnclosingScope scope) {
for (int i = 0; i != block.size(); ++i) {
Stmt stmt = block.get(i);
environment = checkStatement(stmt, environment, scope);
}
return environment;
} | [
"private",
"Environment",
"checkBlock",
"(",
"Stmt",
".",
"Block",
"block",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"block",
".",
"size",
"(",
")",
";",
"++",
"i",
... | check type information in a flow-sensitive fashion through a block of
statements, whilst type checking each statement and expression.
@param block
Block of statements to flow sensitively type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"check",
"type",
"information",
"in",
"a",
"flow",
"-",
"sensitive",
"fashion",
"through",
"a",
"block",
"of",
"statements",
"whilst",
"type",
"checking",
"each",
"statement",
"and",
"expression",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L266-L272 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkFail | private Environment checkFail(Stmt.Fail stmt, Environment environment, EnclosingScope scope) {
return FlowTypeUtils.BOTTOM;
} | java | private Environment checkFail(Stmt.Fail stmt, Environment environment, EnclosingScope scope) {
return FlowTypeUtils.BOTTOM;
} | [
"private",
"Environment",
"checkFail",
"(",
"Stmt",
".",
"Fail",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"return",
"FlowTypeUtils",
".",
"BOTTOM",
";",
"}"
] | Type check a fail statement. The environment after a fail statement is
"bottom" because that represents an unreachable program point.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"fail",
"statement",
".",
"The",
"environment",
"after",
"a",
"fail",
"statement",
"is",
"bottom",
"because",
"that",
"represents",
"an",
"unreachable",
"program",
"point",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L386-L388 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkVariableDeclarations | private Environment checkVariableDeclarations(Tuple<Decl.Variable> decls, Environment environment) {
for (int i = 0; i != decls.size(); ++i) {
environment = checkVariableDeclaration(decls.get(i), environment);
}
return environment;
} | java | private Environment checkVariableDeclarations(Tuple<Decl.Variable> decls, Environment environment) {
for (int i = 0; i != decls.size(); ++i) {
environment = checkVariableDeclaration(decls.get(i), environment);
}
return environment;
} | [
"private",
"Environment",
"checkVariableDeclarations",
"(",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"decls",
",",
"Environment",
"environment",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"decls",
".",
"size",
"(",
")",
";",
"++",
"... | Type check a given sequence of variable declarations.
@param decls
@param environment
Determines the type of all variables immediately going into this
statement.
@return
@throws IOException | [
"Type",
"check",
"a",
"given",
"sequence",
"of",
"variable",
"declarations",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L400-L405 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkVariableDeclaration | private Environment checkVariableDeclaration(Decl.Variable decl, Environment environment) {
// Check type is sensible
checkNonEmpty(decl, environment);
// Check type of initialiser.
if (decl.hasInitialiser()) {
SemanticType type = checkExpression(decl.getInitialiser(), environment);
checkIsSubtype(decl.ge... | java | private Environment checkVariableDeclaration(Decl.Variable decl, Environment environment) {
// Check type is sensible
checkNonEmpty(decl, environment);
// Check type of initialiser.
if (decl.hasInitialiser()) {
SemanticType type = checkExpression(decl.getInitialiser(), environment);
checkIsSubtype(decl.ge... | [
"private",
"Environment",
"checkVariableDeclaration",
"(",
"Decl",
".",
"Variable",
"decl",
",",
"Environment",
"environment",
")",
"{",
"// Check type is sensible",
"checkNonEmpty",
"(",
"decl",
",",
"environment",
")",
";",
"// Check type of initialiser.",
"if",
"(",
... | Type check a variable declaration statement. In particular, when an
initialiser is given we must check it is well-formed and that it is a subtype
of the declared type.
@param decl
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"variable",
"declaration",
"statement",
".",
"In",
"particular",
"when",
"an",
"initialiser",
"is",
"given",
"we",
"must",
"check",
"it",
"is",
"well",
"-",
"formed",
"and",
"that",
"it",
"is",
"a",
"subtype",
"of",
"the",
"declared",... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L419-L429 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkAssign | private Environment checkAssign(Stmt.Assign stmt, Environment environment, EnclosingScope scope)
throws IOException {
Tuple<LVal> lvals = stmt.getLeftHandSide();
Type[] types = new Type[lvals.size()];
for (int i = 0; i != lvals.size(); ++i) {
types[i] = checkLVal(lvals.get(i), environment);
}
checkMulti... | java | private Environment checkAssign(Stmt.Assign stmt, Environment environment, EnclosingScope scope)
throws IOException {
Tuple<LVal> lvals = stmt.getLeftHandSide();
Type[] types = new Type[lvals.size()];
for (int i = 0; i != lvals.size(); ++i) {
types[i] = checkLVal(lvals.get(i), environment);
}
checkMulti... | [
"private",
"Environment",
"checkAssign",
"(",
"Stmt",
".",
"Assign",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"throws",
"IOException",
"{",
"Tuple",
"<",
"LVal",
">",
"lvals",
"=",
"stmt",
".",
"getLeftHandSide",
"(",
")"... | Type check an assignment statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"an",
"assignment",
"statement",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L441-L450 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkBreak | private Environment checkBreak(Stmt.Break stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the break destination
return FlowTypeUtils.BOTTOM;
} | java | private Environment checkBreak(Stmt.Break stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the break destination
return FlowTypeUtils.BOTTOM;
} | [
"private",
"Environment",
"checkBreak",
"(",
"Stmt",
".",
"Break",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// FIXME: need to check environment to the break destination",
"return",
"FlowTypeUtils",
".",
"BOTTOM",
";",
"}"
] | Type check a break statement. This requires propagating the current
environment to the block destination, to ensure that the actual types of all
variables at that point are precise.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"break",
"statement",
".",
"This",
"requires",
"propagating",
"the",
"current",
"environment",
"to",
"the",
"block",
"destination",
"to",
"ensure",
"that",
"the",
"actual",
"types",
"of",
"all",
"variables",
"at",
"that",
"point",
"are",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L464-L467 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkContinue | private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the continue destination
return FlowTypeUtils.BOTTOM;
} | java | private Environment checkContinue(Stmt.Continue stmt, Environment environment, EnclosingScope scope) {
// FIXME: need to check environment to the continue destination
return FlowTypeUtils.BOTTOM;
} | [
"private",
"Environment",
"checkContinue",
"(",
"Stmt",
".",
"Continue",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// FIXME: need to check environment to the continue destination",
"return",
"FlowTypeUtils",
".",
"BOTTOM",
";",
... | Type check a continue statement. This requires propagating the current
environment to the block destination, to ensure that the actual types of all
variables at that point are precise.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"a",
"continue",
"statement",
".",
"This",
"requires",
"propagating",
"the",
"current",
"environment",
"to",
"the",
"block",
"destination",
"to",
"ensure",
"that",
"the",
"actual",
"types",
"of",
"all",
"variables",
"at",
"that",
"point",
"are... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L481-L484 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkDebug | private Environment checkDebug(Stmt.Debug stmt, Environment environment, EnclosingScope scope) {
// FIXME: want to refine integer type here
Type std_ascii = new Type.Array(Type.Int);
SemanticType type = checkExpression(stmt.getOperand(), environment);
checkIsSubtype(std_ascii, type, environment, stmt.getOperand... | java | private Environment checkDebug(Stmt.Debug stmt, Environment environment, EnclosingScope scope) {
// FIXME: want to refine integer type here
Type std_ascii = new Type.Array(Type.Int);
SemanticType type = checkExpression(stmt.getOperand(), environment);
checkIsSubtype(std_ascii, type, environment, stmt.getOperand... | [
"private",
"Environment",
"checkDebug",
"(",
"Stmt",
".",
"Debug",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// FIXME: want to refine integer type here",
"Type",
"std_ascii",
"=",
"new",
"Type",
".",
"Array",
"(",
"Type",
... | Type check an assume statement. This requires checking that the expression
being printed is well-formed and has string type.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return | [
"Type",
"check",
"an",
"assume",
"statement",
".",
"This",
"requires",
"checking",
"that",
"the",
"expression",
"being",
"printed",
"is",
"well",
"-",
"formed",
"and",
"has",
"string",
"type",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L497-L503 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkDoWhile | private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) {
// Type check loop body
environment = checkBlock(stmt.getBody(), environment, scope);
// Type check invariants
checkConditions(stmt.getInvariant(), true, environment);
// Determine and update modified variable... | java | private Environment checkDoWhile(Stmt.DoWhile stmt, Environment environment, EnclosingScope scope) {
// Type check loop body
environment = checkBlock(stmt.getBody(), environment, scope);
// Type check invariants
checkConditions(stmt.getInvariant(), true, environment);
// Determine and update modified variable... | [
"private",
"Environment",
"checkDoWhile",
"(",
"Stmt",
".",
"DoWhile",
"stmt",
",",
"Environment",
"environment",
",",
"EnclosingScope",
"scope",
")",
"{",
"// Type check loop body",
"environment",
"=",
"checkBlock",
"(",
"stmt",
".",
"getBody",
"(",
")",
",",
"... | Type check a do-while statement.
@param stmt
Statement to type check
@param environment
Determines the type of all variables immediately going into this
block
@return
@throws ResolveError
If a named type within this statement cannot be resolved within
the enclosing project. | [
"Type",
"check",
"a",
"do",
"-",
"while",
"statement",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L518-L530 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkLVal | public Type checkLVal(LVal lval, Environment environment) {
Type type;
switch (lval.getOpcode()) {
case EXPR_variablecopy:
type = checkVariableLVal((Expr.VariableAccess) lval, environment);
break;
case EXPR_staticvariable:
type = checkStaticVariableLVal((Expr.StaticVariableAccess) lval, environment);
... | java | public Type checkLVal(LVal lval, Environment environment) {
Type type;
switch (lval.getOpcode()) {
case EXPR_variablecopy:
type = checkVariableLVal((Expr.VariableAccess) lval, environment);
break;
case EXPR_staticvariable:
type = checkStaticVariableLVal((Expr.StaticVariableAccess) lval, environment);
... | [
"public",
"Type",
"checkLVal",
"(",
"LVal",
"lval",
",",
"Environment",
"environment",
")",
"{",
"Type",
"type",
";",
"switch",
"(",
"lval",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"EXPR_variablecopy",
":",
"type",
"=",
"checkVariableLVal",
"(",
"(",... | Type check a given lval assuming an initial environment. This returns the
largest type which can be safely assigned to the lval. Observe that this type
is determined by the declared type of the variable being assigned.
@param expression
@param environment
@return
@throws ResolutionError | [
"Type",
"check",
"a",
"given",
"lval",
"assuming",
"an",
"initial",
"environment",
".",
"This",
"returns",
"the",
"largest",
"type",
"which",
"can",
"be",
"safely",
"assigned",
"to",
"the",
"lval",
".",
"Observe",
"that",
"this",
"type",
"is",
"determined",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1104-L1133 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkMultiExpressions | public final void checkMultiExpressions(Tuple<Expr> expressions, Environment environment, Tuple<Type> expected) {
for (int i = 0, j = 0; i != expressions.size(); ++i) {
Expr expression = expressions.get(i);
switch (expression.getOpcode()) {
case EXPR_invoke: {
Tuple<Type> results = checkInvoke((Expr.Invo... | java | public final void checkMultiExpressions(Tuple<Expr> expressions, Environment environment, Tuple<Type> expected) {
for (int i = 0, j = 0; i != expressions.size(); ++i) {
Expr expression = expressions.get(i);
switch (expression.getOpcode()) {
case EXPR_invoke: {
Tuple<Type> results = checkInvoke((Expr.Invo... | [
"public",
"final",
"void",
"checkMultiExpressions",
"(",
"Tuple",
"<",
"Expr",
">",
"expressions",
",",
"Environment",
"environment",
",",
"Tuple",
"<",
"Type",
">",
"expected",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
",",
"j",
"=",
"0",
";",
"i",
... | Type check a sequence of zero or more multi-expressions, assuming a given
initial environment. A multi-expression is one which may have multiple return
values. There are relatively few situations where this can arise, particular
assignments and return statements. This returns a sequence of one or more
pairs, each of wh... | [
"Type",
"check",
"a",
"sequence",
"of",
"zero",
"or",
"more",
"multi",
"-",
"expressions",
"assuming",
"a",
"given",
"initial",
"environment",
".",
"A",
"multi",
"-",
"expression",
"is",
"one",
"which",
"may",
"have",
"multiple",
"return",
"values",
".",
"... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1216-L1261 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkConstant | private SemanticType checkConstant(Expr.Constant expr, Environment env) {
Value item = expr.getValue();
switch (item.getOpcode()) {
case ITEM_null:
return Type.Null;
case ITEM_bool:
return Type.Bool;
case ITEM_int:
return Type.Int;
case ITEM_byte:
return Type.Byte;
case ITEM_utf8:
// FIXME:... | java | private SemanticType checkConstant(Expr.Constant expr, Environment env) {
Value item = expr.getValue();
switch (item.getOpcode()) {
case ITEM_null:
return Type.Null;
case ITEM_bool:
return Type.Bool;
case ITEM_int:
return Type.Int;
case ITEM_byte:
return Type.Byte;
case ITEM_utf8:
// FIXME:... | [
"private",
"SemanticType",
"checkConstant",
"(",
"Expr",
".",
"Constant",
"expr",
",",
"Environment",
"env",
")",
"{",
"Value",
"item",
"=",
"expr",
".",
"getValue",
"(",
")",
";",
"switch",
"(",
"item",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"I... | Check the type of a given constant expression. This is straightforward since
the determine is fully determined by the kind of constant we have.
@param expr
@return | [
"Check",
"the",
"type",
"of",
"a",
"given",
"constant",
"expression",
".",
"This",
"is",
"straightforward",
"since",
"the",
"determine",
"is",
"fully",
"determined",
"by",
"the",
"kind",
"of",
"constant",
"we",
"have",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1451-L1470 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkVariable | private SemanticType checkVariable(Expr.VariableAccess expr, Environment environment) {
Decl.Variable var = expr.getVariableDeclaration();
return environment.getType(var);
} | java | private SemanticType checkVariable(Expr.VariableAccess expr, Environment environment) {
Decl.Variable var = expr.getVariableDeclaration();
return environment.getType(var);
} | [
"private",
"SemanticType",
"checkVariable",
"(",
"Expr",
".",
"VariableAccess",
"expr",
",",
"Environment",
"environment",
")",
"{",
"Decl",
".",
"Variable",
"var",
"=",
"expr",
".",
"getVariableDeclaration",
"(",
")",
";",
"return",
"environment",
".",
"getType... | Check the type of a given variable access. This is straightforward since the
determine is fully determined by the declared type for the variable in
question.
@param expr
@return | [
"Check",
"the",
"type",
"of",
"a",
"given",
"variable",
"access",
".",
"This",
"is",
"straightforward",
"since",
"the",
"determine",
"is",
"fully",
"determined",
"by",
"the",
"declared",
"type",
"for",
"the",
"variable",
"in",
"question",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1480-L1483 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkIntegerOperator | private SemanticType checkIntegerOperator(Expr.BinaryOperator expr, Environment environment) {
checkOperand(Type.Int, expr.getFirstOperand(), environment);
checkOperand(Type.Int, expr.getSecondOperand(), environment);
return Type.Int;
} | java | private SemanticType checkIntegerOperator(Expr.BinaryOperator expr, Environment environment) {
checkOperand(Type.Int, expr.getFirstOperand(), environment);
checkOperand(Type.Int, expr.getSecondOperand(), environment);
return Type.Int;
} | [
"private",
"SemanticType",
"checkIntegerOperator",
"(",
"Expr",
".",
"BinaryOperator",
"expr",
",",
"Environment",
"environment",
")",
"{",
"checkOperand",
"(",
"Type",
".",
"Int",
",",
"expr",
".",
"getFirstOperand",
"(",
")",
",",
"environment",
")",
";",
"c... | Check the type for a given arithmetic operator. Such an operator has the type
int, and all children should also produce values of type int.
@param expr
@return | [
"Check",
"the",
"type",
"for",
"a",
"given",
"arithmetic",
"operator",
".",
"Such",
"an",
"operator",
"has",
"the",
"type",
"int",
"and",
"all",
"children",
"should",
"also",
"produce",
"values",
"of",
"type",
"int",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1604-L1608 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkNonEmpty | private void checkNonEmpty(Tuple<Decl.Variable> decls, LifetimeRelation lifetimes) {
for (int i = 0; i != decls.size(); ++i) {
checkNonEmpty(decls.get(i), lifetimes);
}
} | java | private void checkNonEmpty(Tuple<Decl.Variable> decls, LifetimeRelation lifetimes) {
for (int i = 0; i != decls.size(); ++i) {
checkNonEmpty(decls.get(i), lifetimes);
}
} | [
"private",
"void",
"checkNonEmpty",
"(",
"Tuple",
"<",
"Decl",
".",
"Variable",
">",
"decls",
",",
"LifetimeRelation",
"lifetimes",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"decls",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{"... | Check a given set of variable declarations are not "empty". That is, their
declared type is not equivalent to void.
@param decls | [
"Check",
"a",
"given",
"set",
"of",
"variable",
"declarations",
"are",
"not",
"empty",
".",
"That",
"is",
"their",
"declared",
"type",
"is",
"not",
"equivalent",
"to",
"void",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1850-L1854 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.checkNonEmpty | private void checkNonEmpty(Decl.Variable d, LifetimeRelation lifetimes) {
if (relaxedSubtypeOperator.isVoid(d.getType(), lifetimes)) {
syntaxError(d.getType(), EMPTY_TYPE);
}
} | java | private void checkNonEmpty(Decl.Variable d, LifetimeRelation lifetimes) {
if (relaxedSubtypeOperator.isVoid(d.getType(), lifetimes)) {
syntaxError(d.getType(), EMPTY_TYPE);
}
} | [
"private",
"void",
"checkNonEmpty",
"(",
"Decl",
".",
"Variable",
"d",
",",
"LifetimeRelation",
"lifetimes",
")",
"{",
"if",
"(",
"relaxedSubtypeOperator",
".",
"isVoid",
"(",
"d",
".",
"getType",
"(",
")",
",",
"lifetimes",
")",
")",
"{",
"syntaxError",
"... | Check that a given variable declaration is not empty. That is, the declared
type is not equivalent to void. This is an important sanity check.
@param d | [
"Check",
"that",
"a",
"given",
"variable",
"declaration",
"is",
"not",
"empty",
".",
"That",
"is",
"the",
"declared",
"type",
"is",
"not",
"equivalent",
"to",
"void",
".",
"This",
"is",
"an",
"important",
"sanity",
"check",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1862-L1866 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractArrayType | public SemanticType.Array extractArrayType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Array> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Array sourceArrayT = rwTypeExtractor.apply(type, environment, combinator);
//
if (sourceArray... | java | public SemanticType.Array extractArrayType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Array> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Array sourceArrayT = rwTypeExtractor.apply(type, environment, combinator);
//
if (sourceArray... | [
"public",
"SemanticType",
".",
"Array",
"extractArrayType",
"(",
"SemanticType",
"type",
",",
"Environment",
"environment",
",",
"ReadWriteTypeExtractor",
".",
"Combinator",
"<",
"SemanticType",
".",
"Array",
">",
"combinator",
",",
"SyntacticItem",
"item",
")",
"{"... | From an arbitrary type, extract the array type it represents which is either
readable or writeable depending on the context. | [
"From",
"an",
"arbitrary",
"type",
"extract",
"the",
"array",
"type",
"it",
"represents",
"which",
"is",
"either",
"readable",
"or",
"writeable",
"depending",
"on",
"the",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1872-L1885 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractElementType | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | java | public SemanticType extractElementType(SemanticType.Array type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | [
"public",
"SemanticType",
"extractElementType",
"(",
"SemanticType",
".",
"Array",
"type",
",",
"SyntacticItem",
"item",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getElement",
"(",... | Extract the element type from an array. The array type can be null if some
earlier part of type checking generated an error message and we are just
continuing after that.
@param type
@param item
@return | [
"Extract",
"the",
"element",
"type",
"from",
"an",
"array",
".",
"The",
"array",
"type",
"can",
"be",
"null",
"if",
"some",
"earlier",
"part",
"of",
"type",
"checking",
"generated",
"an",
"error",
"message",
"and",
"we",
"are",
"just",
"continuing",
"after... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1896-L1902 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractRecordType | public SemanticType.Record extractRecordType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Record> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Record recordT = rwTypeExtractor.apply(type, environment, combinator);
//
if (recordT == n... | java | public SemanticType.Record extractRecordType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Record> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Record recordT = rwTypeExtractor.apply(type, environment, combinator);
//
if (recordT == n... | [
"public",
"SemanticType",
".",
"Record",
"extractRecordType",
"(",
"SemanticType",
"type",
",",
"Environment",
"environment",
",",
"ReadWriteTypeExtractor",
".",
"Combinator",
"<",
"SemanticType",
".",
"Record",
">",
"combinator",
",",
"SyntacticItem",
"item",
")",
... | From an arbitrary type, extract the record type it represents which is either
readable or writeable depending on the context. | [
"From",
"an",
"arbitrary",
"type",
"extract",
"the",
"record",
"type",
"it",
"represents",
"which",
"is",
"either",
"readable",
"or",
"writeable",
"depending",
"on",
"the",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1908-L1921 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractFieldType | public SemanticType extractFieldType(SemanticType.Record type, Identifier field) {
if (type == null) {
return null;
} else {
SemanticType fieldType = type.getField(field);
if (fieldType == null) {
// Indicates an invalid field selection
syntaxError(field, INVALID_FIELD);
}
return fieldType;
... | java | public SemanticType extractFieldType(SemanticType.Record type, Identifier field) {
if (type == null) {
return null;
} else {
SemanticType fieldType = type.getField(field);
if (fieldType == null) {
// Indicates an invalid field selection
syntaxError(field, INVALID_FIELD);
}
return fieldType;
... | [
"public",
"SemanticType",
"extractFieldType",
"(",
"SemanticType",
".",
"Record",
"type",
",",
"Identifier",
"field",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"SemanticType",
"fieldType",
"=",
"type",
".... | From a given record type, extract type for a given field. | [
"From",
"a",
"given",
"record",
"type",
"extract",
"type",
"for",
"a",
"given",
"field",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1926-L1937 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractReferenceType | public SemanticType.Reference extractReferenceType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Reference> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Reference refT = rwTypeExtractor.apply(type, environment, combinator);
//
if (ref... | java | public SemanticType.Reference extractReferenceType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<SemanticType.Reference> combinator, SyntacticItem item) {
//
if (type != null) {
SemanticType.Reference refT = rwTypeExtractor.apply(type, environment, combinator);
//
if (ref... | [
"public",
"SemanticType",
".",
"Reference",
"extractReferenceType",
"(",
"SemanticType",
"type",
",",
"Environment",
"environment",
",",
"ReadWriteTypeExtractor",
".",
"Combinator",
"<",
"SemanticType",
".",
"Reference",
">",
"combinator",
",",
"SyntacticItem",
"item",
... | From an arbitrary type, extract the reference type it represents which is
either readable or writeable depending on the context. | [
"From",
"an",
"arbitrary",
"type",
"extract",
"the",
"reference",
"type",
"it",
"represents",
"which",
"is",
"either",
"readable",
"or",
"writeable",
"depending",
"on",
"the",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1953-L1967 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractElementType | public SemanticType extractElementType(SemanticType.Reference type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | java | public SemanticType extractElementType(SemanticType.Reference type, SyntacticItem item) {
if (type == null) {
return null;
} else {
return type.getElement();
}
} | [
"public",
"SemanticType",
"extractElementType",
"(",
"SemanticType",
".",
"Reference",
"type",
",",
"SyntacticItem",
"item",
")",
"{",
"if",
"(",
"type",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"else",
"{",
"return",
"type",
".",
"getElement",
... | Extract the element type from a reference. The array type can be null if some
earlier part of type checking generated an error message and we are just
continuing after that.
@param type
@param item
@return | [
"Extract",
"the",
"element",
"type",
"from",
"a",
"reference",
".",
"The",
"array",
"type",
"can",
"be",
"null",
"if",
"some",
"earlier",
"part",
"of",
"type",
"checking",
"generated",
"an",
"error",
"message",
"and",
"we",
"are",
"just",
"continuing",
"af... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1978-L1984 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/FlowTypeCheck.java | FlowTypeCheck.extractLambdaType | public Type.Callable extractLambdaType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<Type.Callable> combinator, SyntacticItem item) {
//
if (type != null) {
Type.Callable refT = rwTypeExtractor.apply(type, environment, combinator);
//
if (refT == null) {
syntaxError(i... | java | public Type.Callable extractLambdaType(SemanticType type, Environment environment,
ReadWriteTypeExtractor.Combinator<Type.Callable> combinator, SyntacticItem item) {
//
if (type != null) {
Type.Callable refT = rwTypeExtractor.apply(type, environment, combinator);
//
if (refT == null) {
syntaxError(i... | [
"public",
"Type",
".",
"Callable",
"extractLambdaType",
"(",
"SemanticType",
"type",
",",
"Environment",
"environment",
",",
"ReadWriteTypeExtractor",
".",
"Combinator",
"<",
"Type",
".",
"Callable",
">",
"combinator",
",",
"SyntacticItem",
"item",
")",
"{",
"//",... | From an arbitrary type, extract the lambda type it represents which is either
readable or writeable depending on the context. | [
"From",
"an",
"arbitrary",
"type",
"extract",
"the",
"lambda",
"type",
"it",
"represents",
"which",
"is",
"either",
"readable",
"or",
"writeable",
"depending",
"on",
"the",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/FlowTypeCheck.java#L1990-L2003 | train |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileLexer.java | WhileyFileLexer.scan | public List<Token> scan() {
ArrayList<Token> tokens = new ArrayList<>();
pos = 0;
while (pos < input.length()) {
char c = input.charAt(pos);
if (isDigit(c)) {
tokens.add(scanNumericLiteral());
} else if (c == '"') {
tokens.add(scanStringLiteral());
} else if (c == '\'') {
tokens.add(scan... | java | public List<Token> scan() {
ArrayList<Token> tokens = new ArrayList<>();
pos = 0;
while (pos < input.length()) {
char c = input.charAt(pos);
if (isDigit(c)) {
tokens.add(scanNumericLiteral());
} else if (c == '"') {
tokens.add(scanStringLiteral());
} else if (c == '\'') {
tokens.add(scan... | [
"public",
"List",
"<",
"Token",
">",
"scan",
"(",
")",
"{",
"ArrayList",
"<",
"Token",
">",
"tokens",
"=",
"new",
"ArrayList",
"<>",
"(",
")",
";",
"pos",
"=",
"0",
";",
"while",
"(",
"pos",
"<",
"input",
".",
"length",
"(",
")",
")",
"{",
"cha... | Scan all characters from the input stream and generate a corresponding
list of tokens, whilst discarding all whitespace and comments.
@return | [
"Scan",
"all",
"characters",
"from",
"the",
"input",
"stream",
"and",
"generate",
"a",
"corresponding",
"list",
"of",
"tokens",
"whilst",
"discarding",
"all",
"whitespace",
"and",
"comments",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileLexer.java#L68-L93 | train |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileLexer.java | WhileyFileLexer.scanIndent | public Token scanIndent() {
int start = pos;
while (pos < input.length()
&& (input.charAt(pos) == ' ' || input.charAt(pos) == '\t')) {
pos++;
}
return new Token(Token.Kind.Indent, input.substring(start, pos), start);
} | java | public Token scanIndent() {
int start = pos;
while (pos < input.length()
&& (input.charAt(pos) == ' ' || input.charAt(pos) == '\t')) {
pos++;
}
return new Token(Token.Kind.Indent, input.substring(start, pos), start);
} | [
"public",
"Token",
"scanIndent",
"(",
")",
"{",
"int",
"start",
"=",
"pos",
";",
"while",
"(",
"pos",
"<",
"input",
".",
"length",
"(",
")",
"&&",
"(",
"input",
".",
"charAt",
"(",
"pos",
")",
"==",
"'",
"'",
"||",
"input",
".",
"charAt",
"(",
... | Scan one or more spaces or tab characters, combining them to form an
"indent".
@return | [
"Scan",
"one",
"or",
"more",
"spaces",
"or",
"tab",
"characters",
"combining",
"them",
"to",
"form",
"an",
"indent",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileLexer.java#L472-L479 | train |
Whiley/WhileyCompiler | src/main/java/wyc/io/WhileyFileLexer.java | WhileyFileLexer.skipWhitespace | public void skipWhitespace(List<Token> tokens) {
while (pos < input.length()
&& (input.charAt(pos) == '\n' || input.charAt(pos) == '\t')) {
pos++;
}
} | java | public void skipWhitespace(List<Token> tokens) {
while (pos < input.length()
&& (input.charAt(pos) == '\n' || input.charAt(pos) == '\t')) {
pos++;
}
} | [
"public",
"void",
"skipWhitespace",
"(",
"List",
"<",
"Token",
">",
"tokens",
")",
"{",
"while",
"(",
"pos",
"<",
"input",
".",
"length",
"(",
")",
"&&",
"(",
"input",
".",
"charAt",
"(",
"pos",
")",
"==",
"'",
"'",
"||",
"input",
".",
"charAt",
... | Skip over any whitespace at the current index position in the input
string.
@param tokens | [
"Skip",
"over",
"any",
"whitespace",
"at",
"the",
"current",
"index",
"position",
"in",
"the",
"input",
"string",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/io/WhileyFileLexer.java#L506-L511 | train |
Whiley/WhileyCompiler | src/main/java/wyc/task/CompileTask.java | CompileTask.compile | private static WyilFile compile(List<Path.Entry<WhileyFile>> sources, Path.Entry<WyilFile> target) throws IOException {
// Read target WyilFile. This may have already been compiled in a previous run
// and, in such case, we are invalidating some or all of the existing file.
WyilFile wyil = target.read();
// Par... | java | private static WyilFile compile(List<Path.Entry<WhileyFile>> sources, Path.Entry<WyilFile> target) throws IOException {
// Read target WyilFile. This may have already been compiled in a previous run
// and, in such case, we are invalidating some or all of the existing file.
WyilFile wyil = target.read();
// Par... | [
"private",
"static",
"WyilFile",
"compile",
"(",
"List",
"<",
"Path",
".",
"Entry",
"<",
"WhileyFile",
">",
">",
"sources",
",",
"Path",
".",
"Entry",
"<",
"WyilFile",
">",
"target",
")",
"throws",
"IOException",
"{",
"// Read target WyilFile. This may have alre... | Compile one or more WhileyFiles into a given WyilFile
@param source The source file being compiled.
@param target The target file being generated.
@return
@throws IOException | [
"Compile",
"one",
"or",
"more",
"WhileyFiles",
"into",
"a",
"given",
"WyilFile"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/task/CompileTask.java#L292-L306 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/SymbolTable.java | SymbolTable.contains | public boolean contains(QualifiedName name) {
Name unit = name.getUnit();
// Get information associated with this unit
SymbolTable.Group group = symbolTable.get(unit);
return group != null && group.isValid(name.getName());
} | java | public boolean contains(QualifiedName name) {
Name unit = name.getUnit();
// Get information associated with this unit
SymbolTable.Group group = symbolTable.get(unit);
return group != null && group.isValid(name.getName());
} | [
"public",
"boolean",
"contains",
"(",
"QualifiedName",
"name",
")",
"{",
"Name",
"unit",
"=",
"name",
".",
"getUnit",
"(",
")",
";",
"// Get information associated with this unit",
"SymbolTable",
".",
"Group",
"group",
"=",
"symbolTable",
".",
"get",
"(",
"unit"... | Check whether a given name is registered. That is, whether or not there is a
corresponding name or not.
@param name
@return | [
"Check",
"whether",
"a",
"given",
"name",
"is",
"registered",
".",
"That",
"is",
"whether",
"or",
"not",
"there",
"is",
"a",
"corresponding",
"name",
"or",
"not",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/SymbolTable.java#L105-L110 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/SymbolTable.java | SymbolTable.isAvailable | public boolean isAvailable(QualifiedName name) {
SymbolTable.Group group = symbolTable.get(name.getUnit());
return group != null && group.isAvailable(name.getName());
} | java | public boolean isAvailable(QualifiedName name) {
SymbolTable.Group group = symbolTable.get(name.getUnit());
return group != null && group.isAvailable(name.getName());
} | [
"public",
"boolean",
"isAvailable",
"(",
"QualifiedName",
"name",
")",
"{",
"SymbolTable",
".",
"Group",
"group",
"=",
"symbolTable",
".",
"get",
"(",
"name",
".",
"getUnit",
"(",
")",
")",
";",
"return",
"group",
"!=",
"null",
"&&",
"group",
".",
"isAva... | Check whether a given symbol is currently external to the enclosing WyilFile.
Specifically, this indicates whether or not a stub is available for it.
@param name
@return | [
"Check",
"whether",
"a",
"given",
"symbol",
"is",
"currently",
"external",
"to",
"the",
"enclosing",
"WyilFile",
".",
"Specifically",
"this",
"indicates",
"whether",
"or",
"not",
"a",
"stub",
"is",
"available",
"for",
"it",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/SymbolTable.java#L119-L122 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/SymbolTable.java | SymbolTable.getRegisteredDeclarations | public List<Decl.Named> getRegisteredDeclarations(QualifiedName name) {
Group g = symbolTable.get(name.getUnit());
if (g != null) {
return g.getRegisteredDeclarations(name.getName());
} else {
return Collections.EMPTY_LIST;
}
} | java | public List<Decl.Named> getRegisteredDeclarations(QualifiedName name) {
Group g = symbolTable.get(name.getUnit());
if (g != null) {
return g.getRegisteredDeclarations(name.getName());
} else {
return Collections.EMPTY_LIST;
}
} | [
"public",
"List",
"<",
"Decl",
".",
"Named",
">",
"getRegisteredDeclarations",
"(",
"QualifiedName",
"name",
")",
"{",
"Group",
"g",
"=",
"symbolTable",
".",
"get",
"(",
"name",
".",
"getUnit",
"(",
")",
")",
";",
"if",
"(",
"g",
"!=",
"null",
")",
"... | Get the actual declarations associated with a given symbol.
@param name
@return | [
"Get",
"the",
"actual",
"declarations",
"associated",
"with",
"a",
"given",
"symbol",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/SymbolTable.java#L130-L137 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/SymbolTable.java | SymbolTable.addAvailable | public void addAvailable(QualifiedName name, List<Decl.Named> available) {
ExternalGroup group = (ExternalGroup) symbolTable.get(name.getUnit());
//
for (int i = 0; i != available.size(); ++i) {
group.addAvailable(available.get(i));
}
} | java | public void addAvailable(QualifiedName name, List<Decl.Named> available) {
ExternalGroup group = (ExternalGroup) symbolTable.get(name.getUnit());
//
for (int i = 0; i != available.size(); ++i) {
group.addAvailable(available.get(i));
}
} | [
"public",
"void",
"addAvailable",
"(",
"QualifiedName",
"name",
",",
"List",
"<",
"Decl",
".",
"Named",
">",
"available",
")",
"{",
"ExternalGroup",
"group",
"=",
"(",
"ExternalGroup",
")",
"symbolTable",
".",
"get",
"(",
"name",
".",
"getUnit",
"(",
")",
... | Make available declarations for an external symbol. This makes those
declarations available within the target for linking.
@param name Fully qualified name of symbol being consolidated.
@param available List of declaration stubs which have now been imported into
the target. | [
"Make",
"available",
"declarations",
"for",
"an",
"external",
"symbol",
".",
"This",
"makes",
"those",
"declarations",
"available",
"within",
"the",
"target",
"for",
"linking",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/SymbolTable.java#L162-L168 | train |
Whiley/WhileyCompiler | src/main/java/wyil/transform/SymbolTable.java | SymbolTable.consolidate | public void consolidate() {
Decl.Module module = target.getModule();
for(ExternalGroup group : consolidations) {
// TODO: this could be made way more efficient by collecting all consolidate
// units into one batch
module.putExtern(group.consolidate());
}
consolidations.clear();
} | java | public void consolidate() {
Decl.Module module = target.getModule();
for(ExternalGroup group : consolidations) {
// TODO: this could be made way more efficient by collecting all consolidate
// units into one batch
module.putExtern(group.consolidate());
}
consolidations.clear();
} | [
"public",
"void",
"consolidate",
"(",
")",
"{",
"Decl",
".",
"Module",
"module",
"=",
"target",
".",
"getModule",
"(",
")",
";",
"for",
"(",
"ExternalGroup",
"group",
":",
"consolidations",
")",
"{",
"// TODO: this could be made way more efficient by collecting all ... | Consolidate the status of external symbols. For example, this will ensure all
external units which have imported symbols are made available. Likewise, it
may garbage collect available symbols and units which are no longer required.
@return | [
"Consolidate",
"the",
"status",
"of",
"external",
"symbols",
".",
"For",
"example",
"this",
"will",
"ensure",
"all",
"external",
"units",
"which",
"have",
"imported",
"symbols",
"are",
"made",
"available",
".",
"Likewise",
"it",
"may",
"garbage",
"collect",
"a... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/transform/SymbolTable.java#L177-L185 | train |
Whiley/WhileyCompiler | src/main/java/wyil/type/util/TypeSubtractor.java | TypeSubtractor.determinePivotFields | private Type.Field[] determinePivotFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
LifetimeRelation lifetimes, LinkageStack stack) {
Type.Field[] pivots = new Type.Field[lhsFields.size()];
//
for (int i = 0; i != lhsFields.size(); ++i) {
Type.Field lhsField = lhsFields.get(i);
Identifier... | java | private Type.Field[] determinePivotFields(Tuple<Type.Field> lhsFields, Tuple<Type.Field> rhsFields,
LifetimeRelation lifetimes, LinkageStack stack) {
Type.Field[] pivots = new Type.Field[lhsFields.size()];
//
for (int i = 0; i != lhsFields.size(); ++i) {
Type.Field lhsField = lhsFields.get(i);
Identifier... | [
"private",
"Type",
".",
"Field",
"[",
"]",
"determinePivotFields",
"(",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"lhsFields",
",",
"Tuple",
"<",
"Type",
".",
"Field",
">",
"rhsFields",
",",
"LifetimeRelation",
"lifetimes",
",",
"LinkageStack",
"stack",
")",
... | Find all pivots between the lhs and rhs fields, and calculate their types.
@param lhsFields
@param rhsFields
@param lifetimes
@param stack
@return | [
"Find",
"all",
"pivots",
"between",
"the",
"lhs",
"and",
"rhs",
"fields",
"and",
"calculate",
"their",
"types",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/type/util/TypeSubtractor.java#L181-L204 | train |
Whiley/WhileyCompiler | src/main/java/wyil/check/DefiniteAssignmentCheck.java | DefiniteAssignmentCheck.visitBlock | @Override
public ControlFlow visitBlock(Stmt.Block block, DefinitelyAssignedSet environment) {
DefinitelyAssignedSet nextEnvironment = environment;
DefinitelyAssignedSet breakEnvironment = null;
for(int i=0;i!=block.size();++i) {
Stmt s = block.get(i);
ControlFlow nf = visitStatement(s, nextEnvironment);
... | java | @Override
public ControlFlow visitBlock(Stmt.Block block, DefinitelyAssignedSet environment) {
DefinitelyAssignedSet nextEnvironment = environment;
DefinitelyAssignedSet breakEnvironment = null;
for(int i=0;i!=block.size();++i) {
Stmt s = block.get(i);
ControlFlow nf = visitStatement(s, nextEnvironment);
... | [
"@",
"Override",
"public",
"ControlFlow",
"visitBlock",
"(",
"Stmt",
".",
"Block",
"block",
",",
"DefinitelyAssignedSet",
"environment",
")",
"{",
"DefinitelyAssignedSet",
"nextEnvironment",
"=",
"environment",
";",
"DefinitelyAssignedSet",
"breakEnvironment",
"=",
"nul... | Check that all variables used in a given list of statements are
definitely assigned. Furthermore, update the set of definitely assigned
variables to include any which are definitely assigned at the end of
these statements.
@param block
The list of statements to visit.
@param environment
The set of variables which are ... | [
"Check",
"that",
"all",
"variables",
"used",
"in",
"a",
"given",
"list",
"of",
"statements",
"are",
"definitely",
"assigned",
".",
"Furthermore",
"update",
"the",
"set",
"of",
"definitely",
"assigned",
"variables",
"to",
"include",
"any",
"which",
"are",
"defi... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/check/DefiniteAssignmentCheck.java#L149-L164 | train |
Whiley/WhileyCompiler | src/main/java/wyc/util/ErrorMessages.java | ErrorMessages.syntaxError | public static void syntaxError(SyntacticItem e, int code, SyntacticItem... context) {
WyilFile wf = (WyilFile) e.getHeap();
// Allocate syntax error in the heap));
SyntacticItem.Marker m = wf.allocate(new WyilFile.SyntaxError(code, e, new Tuple<>(context)));
// Record marker to ensure it gets written to disk
... | java | public static void syntaxError(SyntacticItem e, int code, SyntacticItem... context) {
WyilFile wf = (WyilFile) e.getHeap();
// Allocate syntax error in the heap));
SyntacticItem.Marker m = wf.allocate(new WyilFile.SyntaxError(code, e, new Tuple<>(context)));
// Record marker to ensure it gets written to disk
... | [
"public",
"static",
"void",
"syntaxError",
"(",
"SyntacticItem",
"e",
",",
"int",
"code",
",",
"SyntacticItem",
"...",
"context",
")",
"{",
"WyilFile",
"wf",
"=",
"(",
"WyilFile",
")",
"e",
".",
"getHeap",
"(",
")",
";",
"// Allocate syntax error in the heap))... | Report an error message. This may additionally sanity check the supplied
context.
@param e
@param code
@param context | [
"Report",
"an",
"error",
"message",
".",
"This",
"may",
"additionally",
"sanity",
"check",
"the",
"supplied",
"context",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyc/util/ErrorMessages.java#L256-L262 | train |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.packReturns | private RValue[] packReturns(CallStack frame, Decl.Callable decl) {
if (decl instanceof Decl.Property) {
return new RValue[] { RValue.True };
} else {
Tuple<Decl.Variable> returns = decl.getReturns();
RValue[] values = new RValue[returns.size()];
for (int i = 0; i != values.length; ++i) {
values[i] ... | java | private RValue[] packReturns(CallStack frame, Decl.Callable decl) {
if (decl instanceof Decl.Property) {
return new RValue[] { RValue.True };
} else {
Tuple<Decl.Variable> returns = decl.getReturns();
RValue[] values = new RValue[returns.size()];
for (int i = 0; i != values.length; ++i) {
values[i] ... | [
"private",
"RValue",
"[",
"]",
"packReturns",
"(",
"CallStack",
"frame",
",",
"Decl",
".",
"Callable",
"decl",
")",
"{",
"if",
"(",
"decl",
"instanceof",
"Decl",
".",
"Property",
")",
"{",
"return",
"new",
"RValue",
"[",
"]",
"{",
"RValue",
".",
"True"... | Given an execution frame, extract the return values from a given function
or method. The parameters of the function or method are located first in
the frame, followed by the return values.
@param frame
@param type
@return | [
"Given",
"an",
"execution",
"frame",
"extract",
"the",
"return",
"values",
"from",
"a",
"given",
"function",
"or",
"method",
".",
"The",
"parameters",
"of",
"the",
"function",
"or",
"method",
"are",
"located",
"first",
"in",
"the",
"frame",
"followed",
"by",... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L137-L148 | train |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeBlock | private Status executeBlock(Stmt.Block block, CallStack frame, EnclosingScope scope) {
for (int i = 0; i != block.size(); ++i) {
Stmt stmt = block.get(i);
Status r = executeStatement(stmt, frame, scope);
// Now, see whether we are continuing or not
if (r != Status.NEXT) {
return r;
}
}
return S... | java | private Status executeBlock(Stmt.Block block, CallStack frame, EnclosingScope scope) {
for (int i = 0; i != block.size(); ++i) {
Stmt stmt = block.get(i);
Status r = executeStatement(stmt, frame, scope);
// Now, see whether we are continuing or not
if (r != Status.NEXT) {
return r;
}
}
return S... | [
"private",
"Status",
"executeBlock",
"(",
"Stmt",
".",
"Block",
"block",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"!=",
"block",
".",
"size",
"(",
")",
";",
"++",
"i",
")",
"{"... | Execute a given block of statements starting from the beginning. Control
may terminate prematurely in a number of situations. For example, when a
return or break statement is encountered.
@param block
--- Statement block to execute
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"given",
"block",
"of",
"statements",
"starting",
"from",
"the",
"beginning",
".",
"Control",
"may",
"terminate",
"prematurely",
"in",
"a",
"number",
"of",
"situations",
".",
"For",
"example",
"when",
"a",
"return",
"or",
"break",
"statement",
... | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L162-L172 | train |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeStatement | private Status executeStatement(Stmt stmt, CallStack frame, EnclosingScope scope) {
switch (stmt.getOpcode()) {
case WyilFile.STMT_assert:
return executeAssert((Stmt.Assert) stmt, frame, scope);
case WyilFile.STMT_assume:
return executeAssume((Stmt.Assume) stmt, frame, scope);
case WyilFile.STMT_assign:
... | java | private Status executeStatement(Stmt stmt, CallStack frame, EnclosingScope scope) {
switch (stmt.getOpcode()) {
case WyilFile.STMT_assert:
return executeAssert((Stmt.Assert) stmt, frame, scope);
case WyilFile.STMT_assume:
return executeAssume((Stmt.Assume) stmt, frame, scope);
case WyilFile.STMT_assign:
... | [
"private",
"Status",
"executeStatement",
"(",
"Stmt",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"switch",
"(",
"stmt",
".",
"getOpcode",
"(",
")",
")",
"{",
"case",
"WyilFile",
".",
"STMT_assert",
":",
"return",
"executeAss... | Execute a statement at a given point in the function or method body
@param stmt
--- The statement to be executed
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"statement",
"at",
"a",
"given",
"point",
"in",
"the",
"function",
"or",
"method",
"body"
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L183-L227 | train |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeBreak | private Status executeBreak(Stmt.Break stmt, CallStack frame, EnclosingScope scope) {
// TODO: the break bytecode supports a non-nearest exit and eventually
// this should be supported.
return Status.BREAK;
} | java | private Status executeBreak(Stmt.Break stmt, CallStack frame, EnclosingScope scope) {
// TODO: the break bytecode supports a non-nearest exit and eventually
// this should be supported.
return Status.BREAK;
} | [
"private",
"Status",
"executeBreak",
"(",
"Stmt",
".",
"Break",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"// TODO: the break bytecode supports a non-nearest exit and eventually",
"// this should be supported.",
"return",
"Status",
".",
"B... | Execute a break statement. This transfers to control out of the nearest
enclosing loop.
@param stmt
--- Break statement.
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"break",
"statement",
".",
"This",
"transfers",
"to",
"control",
"out",
"of",
"the",
"nearest",
"enclosing",
"loop",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L282-L286 | train |
Whiley/WhileyCompiler | src/main/java/wyil/interpreter/Interpreter.java | Interpreter.executeContinue | private Status executeContinue(Stmt.Continue stmt, CallStack frame, EnclosingScope scope) {
return Status.CONTINUE;
} | java | private Status executeContinue(Stmt.Continue stmt, CallStack frame, EnclosingScope scope) {
return Status.CONTINUE;
} | [
"private",
"Status",
"executeContinue",
"(",
"Stmt",
".",
"Continue",
"stmt",
",",
"CallStack",
"frame",
",",
"EnclosingScope",
"scope",
")",
"{",
"return",
"Status",
".",
"CONTINUE",
";",
"}"
] | Execute a continue statement. This transfers to control back to the start
the nearest enclosing loop.
@param stmt
--- Break statement.
@param frame
--- The current stack frame
@return | [
"Execute",
"a",
"continue",
"statement",
".",
"This",
"transfers",
"to",
"control",
"back",
"to",
"the",
"start",
"the",
"nearest",
"enclosing",
"loop",
"."
] | 680f8a657d3fc286f8cc422755988b6d74ab3f4c | https://github.com/Whiley/WhileyCompiler/blob/680f8a657d3fc286f8cc422755988b6d74ab3f4c/src/main/java/wyil/interpreter/Interpreter.java#L298-L300 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.