feat(injector): initial implementaion of dynamic injector

This commit is contained in:
vsavkin
2014-09-30 14:56:33 -04:00
parent 6c8da62c1b
commit b2199632c7
24 changed files with 792 additions and 44 deletions

View File

@ -73,7 +73,8 @@ export class ClassTransformer extends ParseTreeTransformer {
// Collect all fields, defined in the constructor.
elementTree.body.statements.forEach(function(statement) {
var exp = statement.expression;
if (exp.type === BINARY_EXPRESSION &&
if (exp &&
exp.type === BINARY_EXPRESSION &&
exp.operator.type === EQUAL &&
exp.left.type === MEMBER_EXPRESSION &&
exp.left.operand.type === THIS_EXPRESSION) {
@ -170,7 +171,8 @@ export class ClassTransformer extends ParseTreeTransformer {
var superCall = null;
body.statements.forEach(function (statement) {
if (statement.expression.type === CALL_EXPRESSION &&
if (statement.expression &&
statement.expression.type === CALL_EXPRESSION &&
statement.expression.operand.type === SUPER_EXPRESSION) {
superCall = statement.expression;
} else {

View File

@ -11,7 +11,8 @@ import {
OPEN_CURLY,
OPEN_PAREN,
SEMI_COLON,
STAR
STAR,
STATIC
} from 'traceur/src/syntax/TokenType';
import {ParseTreeWriter as JavaScriptParseTreeWriter, ObjectLiteralExpression} from 'traceur/src/outputgeneration/ParseTreeWriter';