src/generators/Generator.js/Generator/enter
class Generator:	contextualise ( block, expression, context, isEventHandler ) {
		this.addSourcemapLocations( expression );

		const usedContexts = [];

		const { code, helpers } = this;
		const { contexts, indexes } = block;

		let scope = annotateWithScopes( expression ); // TODO this already happens in findDependencies
		let lexicalDepth = 0;

		const self = this;

		walk( expression, {
			enter ( node, parent, key ) {
				if ( /^Function/.test( node.type ) ) lexicalDepth += 1;

				if ( node._scope ) {
					scope = node._scope;
					return;
				}

				if ( node.type === 'ThisExpression' ) {
					if ( lexicalDepth === 0 && context ) code.overwrite( node.start, node.end, context, true );
				}

				else if ( isReference( node, parent ) ) {
					const { name } = flattenReference( node );
					if ( scope.has( name ) ) return;

					if ( parent && parent.type === 'CallExpression' && node === parent.callee && helpers.has( name ) ) {
						code.prependRight( node.start, `${self.alias( 'template' )}.helpers.` );
					}

					else if ( name === 'event' && isEventHandler ) {
						// noop
					}

					else if ( contexts.has( name ) ) {
						const contextName = contexts.get( name );
						if ( contextName !== name ) {
							// this is true for 'reserved' names like `state` and `component`
							code.overwrite( node.start, node.start + name.length, contextName, true );
						}

						if ( !~usedContexts.indexOf( name ) ) usedContexts.push( name );
					}

					else if ( indexes.has( name ) ) {
						const context = indexes.get( name );
						if ( !~usedContexts.indexOf( context ) ) usedContexts.push( context );
					}

					else {
						// handle shorthand properties
						if ( parent && parent.type === 'Property' && parent.shorthand ) {
							if ( key === 'key' ) {
								code.appendLeft( node.start, `${name}: ` );
								return;
							}
						}

						if ( globalWhitelist.has( name ) ) {
							code.prependRight( node.start, `( '${name}' in state ? state.` );
							code.appendLeft( node.object ? node.object.end : node.end, ` : ${name} )` );
						} else {
							code.prependRight( node.start, `state.` );
						}

						if ( !~usedContexts.indexOf( 'state' ) ) usedContexts.push( 'state' );
					}

					this.skip();
				}
			},

			leave ( node ) {
				if ( /^Function/.test( node.type ) ) lexicalDepth -= 1;
				if ( node._scope ) scope = scope.parent;
			}
		});

		return {
			dependencies: expression._dependencies, // TODO probably a better way to do this
			contexts: usedContexts,
			snippet: `[✂${expression.start}-${expression.end}✂]`
		};
	}