Preliminary strings

While not well-wrought, it's at least possible now to log some stuff when debugging
This commit is contained in:
dcodeIO
2018-01-27 05:35:14 +01:00
parent b548b5c81f
commit de066fc128
22 changed files with 1267 additions and 112 deletions

View File

@ -741,13 +741,14 @@ export class Parser extends DiagnosticEmitter {
}
}
if (tn.skip(Token.CONSTRUCTOR) || tn.skip(Token.IDENTIFIER)) { // order is important
var identifier: IdentifierExpression = tn.token == Token.CONSTRUCTOR
var isConstructor = tn.skip(Token.CONSTRUCTOR);
if (isConstructor || tn.skip(Token.IDENTIFIER)) {
var identifier = isConstructor
? Node.createConstructorExpression(tn.range())
: Node.createIdentifierExpression(tn.readIdentifier(), tn.range());
var typeParameters: TypeParameter[] | null;
if (tn.skip(Token.LESSTHAN)) {
if (identifier.kind == NodeKind.CONSTRUCTOR)
if (isConstructor)
this.error(DiagnosticCode.Type_parameters_cannot_appear_on_a_constructor_declaration, tn.range()); // recoverable
typeParameters = this.parseTypeParameters(tn);
if (!typeParameters)
@ -755,9 +756,6 @@ export class Parser extends DiagnosticEmitter {
} else
typeParameters = [];
if (identifier.kind == NodeKind.CONSTRUCTOR && tn.peek() != Token.OPENPAREN)
this.error(DiagnosticCode.Constructor_implementation_is_missing, tn.range());
// method: '(' Parameters (':' Type)? '{' Statement* '}' ';'?
if (tn.skip(Token.OPENPAREN)) {
var parameters = this.parseParameters(tn);
@ -802,6 +800,12 @@ export class Parser extends DiagnosticEmitter {
tn.skip(Token.SEMICOLON);
return retMethod;
} else if (isConstructor) {
this.error(DiagnosticCode.Constructor_implementation_is_missing, identifier.range());
} else if (isGetter || isSetter) {
this.error(DiagnosticCode.Function_implementation_is_missing_or_not_immediately_following_the_declaration, identifier.range());
// field: (':' Type)? ('=' Expression)? ';'?
} else {
var modifier: Modifier | null;