Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
case Syntax.Identifier:
var value = environment.get(expr.name, false) || store.get(expr.name, false);
if (! value) {
if (primitives.hasOwnProperty(expr.name)) {
value = Set.of(primitives[expr.name]);
}
else {
console.log(store);
console.log(environment);
throw new Error('Au: unbound variable: ' + expr.name);
}
}
return value;
case Syntax.Literal:
return Set.of(expr.value);
default:
console.log(expr);
throw new Error('Au: unimplemented type: ' + expr.type);
}
}
break;
}
if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
return true;
}
}
} else {
for (let i = 0, iz = body.body.length; i < iz; ++i) {
const stmt = body.body[i];
if (stmt.type !== Syntax.ExpressionStatement) {
break;
}
const expr = stmt.expression;
if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
break;
}
if (expr.raw !== null && expr.raw !== undefined) {
if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
return true;
}
} else {
if (expr.value === "use strict") {
return true;
}
}
}
}
return false;
}
function getStaticValue(node) {
if (node.type === Syntax.Literal) {
var value = node.raw !== undefined ? node.raw : node.value;
var number = parseFloat(value);
if (!isNaN(number))
return number;
value = node.value;
switch(value) {
case "true": return true;
case "false": return false;
case "null": return null;
default: return value;
}
}
if (node.type == Syntax.MemberExpression || node.type == Syntax.CallExpression || node.type == Syntax.Identifier || node.type == Syntax.NewExpression || node.type == Syntax.LogicalExpression) {
return ANNO(node).getStaticValue();
}
if (node.type === Syntax.UnaryExpression) {
transformPoint: { callExp: function(callExpression, parent, context, state){
var transform = getSpaceTransform(callExpression.arguments[0], false);
var result = { type: Syntax.MemberExpression,
object: { type: Syntax.BinaryExpression, operator: "*",
left: { type: Syntax.Identifier, name: transform},
right: {type: Syntax.CallExpression,
callee: {type: Syntax.Identifier, name: "vec4"},
arguments: [
callExpression.arguments[1],
{ type: Syntax.Literal, value: 1, raw: 1}
]
}
},
property: { type: Syntax.Identifier, name: "xyz" }
};
ANNO(result).setType(TYPES.OBJECT, KINDS.FLOAT3);
ANNO(result.object).setType(TYPES.OBJECT, KINDS.FLOAT4);
ANNO(result.object.left).setType(TYPES.OBJECT, KINDS.MATRIX4);
ANNO(result.object.right).setType(TYPES.OBJECT, KINDS.FLOAT4);
ANNO(result.object.right.arguments[1]).setType(TYPES.NUMBER);
var systemName = Tools.getNameForSystem(transform);
state.usedParameters.system[systemName] = state.systemParameters[transform];
return result;
stmt = body.body[i];
if (stmt.type !== "DirectiveStatement") {
break;
}
if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
return true;
}
}
} else {
for (i = 0, iz = body.body.length; i < iz; ++i) {
stmt = body.body[i];
if (stmt.type !== Syntax.ExpressionStatement) {
break;
}
expr = stmt.expression;
if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
break;
}
if (expr.raw != null) {
if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
return true;
}
} else {
if (expr.value === "use strict") {
return true;
}
}
}
}
return false;
}
stmt = body.body[i];
if (stmt.type !== Syntax.DirectiveStatement) {
break;
}
if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
return true;
}
}
} else {
for (i = 0, iz = body.body.length; i < iz; ++i) {
stmt = body.body[i];
if (stmt.type !== Syntax.ExpressionStatement) {
break;
}
expr = stmt.expression;
if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
break;
}
if (expr.raw != null) {
if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
return true;
}
} else {
if (expr.value === "use strict") {
return true;
}
}
}
}
return false;
}
break;
}
if (stmt.raw === "\"use strict\"" || stmt.raw === "'use strict'") {
return true;
}
}
} else {
for (let i = 0, iz = body.body.length; i < iz; ++i) {
const stmt = body.body[i];
if (stmt.type !== Syntax.ExpressionStatement) {
break;
}
const expr = stmt.expression;
if (expr.type !== Syntax.Literal || typeof expr.value !== "string") {
break;
}
if (expr.raw !== null && expr.raw !== undefined) {
if (expr.raw === "\"use strict\"" || expr.raw === "'use strict'") {
return true;
}
} else {
if (expr.value === "use strict") {
return true;
}
}
}
}
return false;
}
function cps(node, k) {
switch (node.type) {
case Syntax.ArrayExpression:
case Syntax.AssignmentExpression:
case Syntax.BinaryExpression:
case Syntax.FunctionExpression:
case Syntax.Identifier:
case Syntax.Literal:
case Syntax.MemberExpression:
case Syntax.ObjectExpression:
case Syntax.UnaryExpression:
case Syntax.DebuggerStatement:
return atomize(node, function(node) {
return buildContinuationCall(k, node);
});
default:
return match(node, [
clause(Syntax.CallExpression, function(callee, args) {
return atomize(callee, function(callee) {
return atomizeStar(args, function(args) {
if (isPrimitive(callee)) {
return buildContinuationCall(k, buildCall(callee, args));
}
else {
property: function () {
return { type: Syntax.Literal, value: Math[constant], extra: { type: Shade.TYPES.NUMBER } };
}
}