This commit is contained in:
dcode
2019-03-14 09:22:20 +01:00
parent ea43f9f2d0
commit cdf3e2cf12
5 changed files with 98 additions and 67 deletions

View File

@ -4118,10 +4118,11 @@ export function compileArrayGet(
contextualType: Type
): ExpressionRef {
var type = typedArraySymbolToType(target.internalName);
if (type) return compileTypedArrayGet(compiler, target, type, thisExpression, elementExpression, contextualType);
assert(target.prototype == compiler.program.arrayPrototype);
type = assert(target.typeArguments)[0];
throw new Error("not implemented");
if (!type) {
assert(target.prototype == compiler.program.arrayPrototype);
type = assert(target.typeArguments)[0];
}
return compileTypedArrayGet(compiler, target, type, thisExpression, elementExpression, contextualType);
}
function compileTypedArrayGet(

View File

@ -904,7 +904,7 @@ export class Compiler extends DiagnosticEmitter {
if (global.hasDecorator(DecoratorFlags.INLINE)) {
this.error(
DiagnosticCode.Decorator_0_is_not_valid_here,
global.identifierNode.range, "inline"
assert(findDecorator(DecoratorKind.INLINE, global.decoratorNodes)).range, "inline"
);
}
module.addGlobal(internalName, nativeType, true, global.type.toNativeZero(module));

View File

@ -14,7 +14,7 @@ import {
} from "./diagnosticMessages.generated";
import {
isLineBreak
isLineBreak, CharCode
} from "./util";
export {
@ -244,7 +244,13 @@ export function formatDiagnosticContext(range: Range, useColors: bool = false):
if (range.start == range.end) {
sb.push("^");
} else {
while (start++ < range.end) sb.push("~");
while (start++ < range.end) {
if (isLineBreak(text.charCodeAt(start))) {
sb.push(start == range.start + 1 ? "^" : "~");
break;
}
sb.push("~");
}
}
if (useColors) sb.push(COLOR_RESET);
return sb.join("");