Merge branch 'master' into circularVar

This commit is contained in:
Anders Hejlsberg
2015-05-01 14:44:45 -07:00
252 changed files with 16747 additions and 12225 deletions
View File
+141
View File
@@ -1231,6 +1231,139 @@ interface ArrayBufferView {
byteOffset: number;
}
interface DataView {
buffer: ArrayBuffer;
byteLength: number;
byteOffset: number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat64(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;
/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;
/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint32(byteOffset: number, littleEndian: boolean): number;
/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;
/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;
/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
}
interface DataViewConstructor {
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
* number of bytes could not be allocated an exception is raised.
@@ -15857,11 +15990,13 @@ interface DocumentEvent {
createEvent(eventInterface:"CloseEvent"): CloseEvent;
createEvent(eventInterface:"CommandEvent"): CommandEvent;
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
createEvent(eventInterface: "CustomEvent"): CustomEvent;
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
createEvent(eventInterface:"DragEvent"): DragEvent;
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
createEvent(eventInterface:"Event"): Event;
createEvent(eventInterface:"Events"): Event;
createEvent(eventInterface:"FocusEvent"): FocusEvent;
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
@@ -15876,8 +16011,12 @@ interface DocumentEvent {
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
createEvent(eventInterface:"MessageEvent"): MessageEvent;
createEvent(eventInterface:"MouseEvent"): MouseEvent;
createEvent(eventInterface:"MouseEvents"): MouseEvent;
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
createEvent(eventInterface:"MutationEvent"): MutationEvent;
createEvent(eventInterface:"MutationEvents"): MutationEvent;
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
@@ -15888,6 +16027,7 @@ interface DocumentEvent {
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
createEvent(eventInterface:"StorageEvent"): StorageEvent;
createEvent(eventInterface:"TextEvent"): TextEvent;
@@ -15895,6 +16035,7 @@ interface DocumentEvent {
createEvent(eventInterface:"TrackEvent"): TrackEvent;
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
createEvent(eventInterface:"UIEvent"): UIEvent;
createEvent(eventInterface:"UIEvents"): UIEvent;
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
createEvent(eventInterface:"WheelEvent"): WheelEvent;
+141
View File
@@ -61,6 +61,139 @@ interface ArrayBufferView {
byteOffset: number;
}
interface DataView {
buffer: ArrayBuffer;
byteLength: number;
byteOffset: number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat64(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;
/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;
/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint32(byteOffset: number, littleEndian: boolean): number;
/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;
/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;
/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
}
interface DataViewConstructor {
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
* number of bytes could not be allocated an exception is raised.
@@ -14687,11 +14820,13 @@ interface DocumentEvent {
createEvent(eventInterface:"CloseEvent"): CloseEvent;
createEvent(eventInterface:"CommandEvent"): CommandEvent;
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
createEvent(eventInterface: "CustomEvent"): CustomEvent;
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
createEvent(eventInterface:"DragEvent"): DragEvent;
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
createEvent(eventInterface:"Event"): Event;
createEvent(eventInterface:"Events"): Event;
createEvent(eventInterface:"FocusEvent"): FocusEvent;
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
@@ -14706,8 +14841,12 @@ interface DocumentEvent {
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
createEvent(eventInterface:"MessageEvent"): MessageEvent;
createEvent(eventInterface:"MouseEvent"): MouseEvent;
createEvent(eventInterface:"MouseEvents"): MouseEvent;
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
createEvent(eventInterface:"MutationEvent"): MutationEvent;
createEvent(eventInterface:"MutationEvents"): MutationEvent;
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
@@ -14718,6 +14857,7 @@ interface DocumentEvent {
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
createEvent(eventInterface:"StorageEvent"): StorageEvent;
createEvent(eventInterface:"TextEvent"): TextEvent;
@@ -14725,6 +14865,7 @@ interface DocumentEvent {
createEvent(eventInterface:"TrackEvent"): TrackEvent;
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
createEvent(eventInterface:"UIEvent"): UIEvent;
createEvent(eventInterface:"UIEvents"): UIEvent;
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
createEvent(eventInterface:"WheelEvent"): WheelEvent;
+8
View File
@@ -17335,11 +17335,13 @@ interface DocumentEvent {
createEvent(eventInterface:"CloseEvent"): CloseEvent;
createEvent(eventInterface:"CommandEvent"): CommandEvent;
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
createEvent(eventInterface: "CustomEvent"): CustomEvent;
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
createEvent(eventInterface:"DragEvent"): DragEvent;
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
createEvent(eventInterface:"Event"): Event;
createEvent(eventInterface:"Events"): Event;
createEvent(eventInterface:"FocusEvent"): FocusEvent;
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
@@ -17354,8 +17356,12 @@ interface DocumentEvent {
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
createEvent(eventInterface:"MessageEvent"): MessageEvent;
createEvent(eventInterface:"MouseEvent"): MouseEvent;
createEvent(eventInterface:"MouseEvents"): MouseEvent;
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
createEvent(eventInterface:"MutationEvent"): MutationEvent;
createEvent(eventInterface:"MutationEvents"): MutationEvent;
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
@@ -17366,6 +17372,7 @@ interface DocumentEvent {
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
createEvent(eventInterface:"StorageEvent"): StorageEvent;
createEvent(eventInterface:"TextEvent"): TextEvent;
@@ -17373,6 +17380,7 @@ interface DocumentEvent {
createEvent(eventInterface:"TrackEvent"): TrackEvent;
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
createEvent(eventInterface:"UIEvent"): UIEvent;
createEvent(eventInterface:"UIEvents"): UIEvent;
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
createEvent(eventInterface:"WheelEvent"): WheelEvent;
+133
View File
@@ -61,6 +61,139 @@ interface ArrayBufferView {
byteOffset: number;
}
interface DataView {
buffer: ArrayBuffer;
byteLength: number;
byteOffset: number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat64(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;
/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;
/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint32(byteOffset: number, littleEndian: boolean): number;
/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;
/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;
/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
}
interface DataViewConstructor {
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
* number of bytes could not be allocated an exception is raised.
+2591 -1924
View File
File diff suppressed because it is too large Load Diff
+3293 -2624
View File
File diff suppressed because it is too large Load Diff
+144 -123
View File
@@ -140,132 +140,133 @@ declare module "typescript" {
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
ClassExpression = 174,
OmittedExpression = 175,
TemplateSpan = 176,
HeritageClauseElement = 177,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
NamespaceKeyword = 118,
RequireKeyword = 119,
NumberKeyword = 120,
SetKeyword = 121,
StringKeyword = 122,
SymbolKeyword = 123,
TypeKeyword = 124,
FromKeyword = 125,
OfKeyword = 126,
QualifiedName = 127,
ComputedPropertyName = 128,
TypeParameter = 129,
Parameter = 130,
Decorator = 131,
PropertySignature = 132,
PropertyDeclaration = 133,
MethodSignature = 134,
MethodDeclaration = 135,
Constructor = 136,
GetAccessor = 137,
SetAccessor = 138,
CallSignature = 139,
ConstructSignature = 140,
IndexSignature = 141,
TypeReference = 142,
FunctionType = 143,
ConstructorType = 144,
TypeQuery = 145,
TypeLiteral = 146,
ArrayType = 147,
TupleType = 148,
UnionType = 149,
ParenthesizedType = 150,
ObjectBindingPattern = 151,
ArrayBindingPattern = 152,
BindingElement = 153,
ArrayLiteralExpression = 154,
ObjectLiteralExpression = 155,
PropertyAccessExpression = 156,
ElementAccessExpression = 157,
CallExpression = 158,
NewExpression = 159,
TaggedTemplateExpression = 160,
TypeAssertionExpression = 161,
ParenthesizedExpression = 162,
FunctionExpression = 163,
ArrowFunction = 164,
DeleteExpression = 165,
TypeOfExpression = 166,
VoidExpression = 167,
PrefixUnaryExpression = 168,
PostfixUnaryExpression = 169,
BinaryExpression = 170,
ConditionalExpression = 171,
TemplateExpression = 172,
YieldExpression = 173,
SpreadElementExpression = 174,
ClassExpression = 175,
OmittedExpression = 176,
ExpressionWithTypeArguments = 177,
TemplateSpan = 178,
SemicolonClassElement = 179,
Block = 180,
VariableStatement = 181,
EmptyStatement = 182,
ExpressionStatement = 183,
IfStatement = 184,
DoStatement = 185,
WhileStatement = 186,
ForStatement = 187,
ForInStatement = 188,
ForOfStatement = 189,
ContinueStatement = 190,
BreakStatement = 191,
ReturnStatement = 192,
WithStatement = 193,
SwitchStatement = 194,
LabeledStatement = 195,
ThrowStatement = 196,
TryStatement = 197,
DebuggerStatement = 198,
VariableDeclaration = 199,
VariableDeclarationList = 200,
FunctionDeclaration = 201,
ClassDeclaration = 202,
InterfaceDeclaration = 203,
TypeAliasDeclaration = 204,
EnumDeclaration = 205,
ModuleDeclaration = 206,
ModuleBlock = 207,
CaseBlock = 208,
ImportEqualsDeclaration = 209,
ImportDeclaration = 210,
ImportClause = 211,
NamespaceImport = 212,
NamedImports = 213,
ImportSpecifier = 214,
ExportAssignment = 215,
ExportDeclaration = 216,
NamedExports = 217,
ExportSpecifier = 218,
MissingDeclaration = 219,
ExternalModuleReference = 220,
CaseClause = 221,
DefaultClause = 222,
HeritageClause = 223,
CatchClause = 224,
PropertyAssignment = 225,
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
SyntaxList = 229,
Count = 230,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
LastKeyword = 126,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstTypeNode = 142,
LastTypeNode = 150,
FirstPunctuation = 14,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 125,
LastToken = 126,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -274,7 +275,7 @@ declare module "typescript" {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 64,
FirstNode = 126,
FirstNode = 127,
}
const enum NodeFlags {
Export = 1,
@@ -290,7 +291,8 @@ declare module "typescript" {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Namespace = 32768,
ExportContext = 65536,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -553,7 +555,7 @@ declare module "typescript" {
typeArguments?: NodeArray<TypeNode>;
arguments: NodeArray<Expression>;
}
interface HeritageClauseElement extends TypeNode {
interface ExpressionWithTypeArguments extends TypeNode {
expression: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
}
@@ -672,7 +674,7 @@ declare module "typescript" {
}
interface HeritageClause extends Node {
token: SyntaxKind;
types?: NodeArray<HeritageClauseElement>;
types?: NodeArray<ExpressionWithTypeArguments>;
}
interface TypeAliasDeclaration extends Declaration, ModuleElement {
name: Identifier;
@@ -756,6 +758,9 @@ declare module "typescript" {
getSourceFile(fileName: string): SourceFile;
getCurrentDirectory(): string;
}
interface ParseConfigHost {
readDirectory(rootDir: string, extension: string): string[];
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
}
@@ -804,6 +809,7 @@ declare module "typescript" {
sourceMapFile: string;
sourceMapSourceRoot: string;
sourceMapSources: string[];
sourceMapSourcesContent?: string[];
inputSourceFileNames: string[];
sourceMapNames?: string[];
sourceMapMappings: string;
@@ -1082,6 +1088,8 @@ declare module "typescript" {
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
listFiles?: boolean;
locale?: string;
mapRoot?: string;
@@ -1113,6 +1121,7 @@ declare module "typescript" {
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
}
interface LineAndCharacter {
line: number;
@@ -1226,7 +1235,7 @@ declare module "typescript" {
const version: string;
function findConfigFile(searchPath: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
}
@@ -1236,14 +1245,26 @@ declare module "typescript" {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
function readConfigFile(fileName: string): any;
function readConfigFile(fileName: string): {
config?: any;
error?: Diagnostic;
};
/**
* Parse the text of the tsconfig.json file
* @param fileName The path to the config file
* @param jsonText The text of the config file
*/
function parseConfigFileText(fileName: string, jsonText: string): {
config?: any;
error?: Diagnostic;
};
/**
* Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare module "typescript" {
/** The version of the language service API */
+3869 -3008
View File
File diff suppressed because it is too large Load Diff
+144 -123
View File
@@ -140,132 +140,133 @@ declare module ts {
DeclareKeyword = 115,
GetKeyword = 116,
ModuleKeyword = 117,
RequireKeyword = 118,
NumberKeyword = 119,
SetKeyword = 120,
StringKeyword = 121,
SymbolKeyword = 122,
TypeKeyword = 123,
FromKeyword = 124,
OfKeyword = 125,
QualifiedName = 126,
ComputedPropertyName = 127,
TypeParameter = 128,
Parameter = 129,
Decorator = 130,
PropertySignature = 131,
PropertyDeclaration = 132,
MethodSignature = 133,
MethodDeclaration = 134,
Constructor = 135,
GetAccessor = 136,
SetAccessor = 137,
CallSignature = 138,
ConstructSignature = 139,
IndexSignature = 140,
TypeReference = 141,
FunctionType = 142,
ConstructorType = 143,
TypeQuery = 144,
TypeLiteral = 145,
ArrayType = 146,
TupleType = 147,
UnionType = 148,
ParenthesizedType = 149,
ObjectBindingPattern = 150,
ArrayBindingPattern = 151,
BindingElement = 152,
ArrayLiteralExpression = 153,
ObjectLiteralExpression = 154,
PropertyAccessExpression = 155,
ElementAccessExpression = 156,
CallExpression = 157,
NewExpression = 158,
TaggedTemplateExpression = 159,
TypeAssertionExpression = 160,
ParenthesizedExpression = 161,
FunctionExpression = 162,
ArrowFunction = 163,
DeleteExpression = 164,
TypeOfExpression = 165,
VoidExpression = 166,
PrefixUnaryExpression = 167,
PostfixUnaryExpression = 168,
BinaryExpression = 169,
ConditionalExpression = 170,
TemplateExpression = 171,
YieldExpression = 172,
SpreadElementExpression = 173,
ClassExpression = 174,
OmittedExpression = 175,
TemplateSpan = 176,
HeritageClauseElement = 177,
SemicolonClassElement = 178,
Block = 179,
VariableStatement = 180,
EmptyStatement = 181,
ExpressionStatement = 182,
IfStatement = 183,
DoStatement = 184,
WhileStatement = 185,
ForStatement = 186,
ForInStatement = 187,
ForOfStatement = 188,
ContinueStatement = 189,
BreakStatement = 190,
ReturnStatement = 191,
WithStatement = 192,
SwitchStatement = 193,
LabeledStatement = 194,
ThrowStatement = 195,
TryStatement = 196,
DebuggerStatement = 197,
VariableDeclaration = 198,
VariableDeclarationList = 199,
FunctionDeclaration = 200,
ClassDeclaration = 201,
InterfaceDeclaration = 202,
TypeAliasDeclaration = 203,
EnumDeclaration = 204,
ModuleDeclaration = 205,
ModuleBlock = 206,
CaseBlock = 207,
ImportEqualsDeclaration = 208,
ImportDeclaration = 209,
ImportClause = 210,
NamespaceImport = 211,
NamedImports = 212,
ImportSpecifier = 213,
ExportAssignment = 214,
ExportDeclaration = 215,
NamedExports = 216,
ExportSpecifier = 217,
MissingDeclaration = 218,
ExternalModuleReference = 219,
CaseClause = 220,
DefaultClause = 221,
HeritageClause = 222,
CatchClause = 223,
PropertyAssignment = 224,
ShorthandPropertyAssignment = 225,
EnumMember = 226,
SourceFile = 227,
SyntaxList = 228,
Count = 229,
NamespaceKeyword = 118,
RequireKeyword = 119,
NumberKeyword = 120,
SetKeyword = 121,
StringKeyword = 122,
SymbolKeyword = 123,
TypeKeyword = 124,
FromKeyword = 125,
OfKeyword = 126,
QualifiedName = 127,
ComputedPropertyName = 128,
TypeParameter = 129,
Parameter = 130,
Decorator = 131,
PropertySignature = 132,
PropertyDeclaration = 133,
MethodSignature = 134,
MethodDeclaration = 135,
Constructor = 136,
GetAccessor = 137,
SetAccessor = 138,
CallSignature = 139,
ConstructSignature = 140,
IndexSignature = 141,
TypeReference = 142,
FunctionType = 143,
ConstructorType = 144,
TypeQuery = 145,
TypeLiteral = 146,
ArrayType = 147,
TupleType = 148,
UnionType = 149,
ParenthesizedType = 150,
ObjectBindingPattern = 151,
ArrayBindingPattern = 152,
BindingElement = 153,
ArrayLiteralExpression = 154,
ObjectLiteralExpression = 155,
PropertyAccessExpression = 156,
ElementAccessExpression = 157,
CallExpression = 158,
NewExpression = 159,
TaggedTemplateExpression = 160,
TypeAssertionExpression = 161,
ParenthesizedExpression = 162,
FunctionExpression = 163,
ArrowFunction = 164,
DeleteExpression = 165,
TypeOfExpression = 166,
VoidExpression = 167,
PrefixUnaryExpression = 168,
PostfixUnaryExpression = 169,
BinaryExpression = 170,
ConditionalExpression = 171,
TemplateExpression = 172,
YieldExpression = 173,
SpreadElementExpression = 174,
ClassExpression = 175,
OmittedExpression = 176,
ExpressionWithTypeArguments = 177,
TemplateSpan = 178,
SemicolonClassElement = 179,
Block = 180,
VariableStatement = 181,
EmptyStatement = 182,
ExpressionStatement = 183,
IfStatement = 184,
DoStatement = 185,
WhileStatement = 186,
ForStatement = 187,
ForInStatement = 188,
ForOfStatement = 189,
ContinueStatement = 190,
BreakStatement = 191,
ReturnStatement = 192,
WithStatement = 193,
SwitchStatement = 194,
LabeledStatement = 195,
ThrowStatement = 196,
TryStatement = 197,
DebuggerStatement = 198,
VariableDeclaration = 199,
VariableDeclarationList = 200,
FunctionDeclaration = 201,
ClassDeclaration = 202,
InterfaceDeclaration = 203,
TypeAliasDeclaration = 204,
EnumDeclaration = 205,
ModuleDeclaration = 206,
ModuleBlock = 207,
CaseBlock = 208,
ImportEqualsDeclaration = 209,
ImportDeclaration = 210,
ImportClause = 211,
NamespaceImport = 212,
NamedImports = 213,
ImportSpecifier = 214,
ExportAssignment = 215,
ExportDeclaration = 216,
NamedExports = 217,
ExportSpecifier = 218,
MissingDeclaration = 219,
ExternalModuleReference = 220,
CaseClause = 221,
DefaultClause = 222,
HeritageClause = 223,
CatchClause = 224,
PropertyAssignment = 225,
ShorthandPropertyAssignment = 226,
EnumMember = 227,
SourceFile = 228,
SyntaxList = 229,
Count = 230,
FirstAssignment = 53,
LastAssignment = 64,
FirstReservedWord = 66,
LastReservedWord = 101,
FirstKeyword = 66,
LastKeyword = 125,
LastKeyword = 126,
FirstFutureReservedWord = 102,
LastFutureReservedWord = 110,
FirstTypeNode = 141,
LastTypeNode = 149,
FirstTypeNode = 142,
LastTypeNode = 150,
FirstPunctuation = 14,
LastPunctuation = 64,
FirstToken = 0,
LastToken = 125,
LastToken = 126,
FirstTriviaToken = 2,
LastTriviaToken = 6,
FirstLiteralToken = 7,
@@ -274,7 +275,7 @@ declare module ts {
LastTemplateToken = 13,
FirstBinaryOperator = 24,
LastBinaryOperator = 64,
FirstNode = 126,
FirstNode = 127,
}
const enum NodeFlags {
Export = 1,
@@ -290,7 +291,8 @@ declare module ts {
Let = 4096,
Const = 8192,
OctalLiteral = 16384,
ExportContext = 32768,
Namespace = 32768,
ExportContext = 65536,
Modifier = 499,
AccessibilityModifier = 112,
BlockScoped = 12288,
@@ -553,7 +555,7 @@ declare module ts {
typeArguments?: NodeArray<TypeNode>;
arguments: NodeArray<Expression>;
}
interface HeritageClauseElement extends TypeNode {
interface ExpressionWithTypeArguments extends TypeNode {
expression: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
}
@@ -672,7 +674,7 @@ declare module ts {
}
interface HeritageClause extends Node {
token: SyntaxKind;
types?: NodeArray<HeritageClauseElement>;
types?: NodeArray<ExpressionWithTypeArguments>;
}
interface TypeAliasDeclaration extends Declaration, ModuleElement {
name: Identifier;
@@ -756,6 +758,9 @@ declare module ts {
getSourceFile(fileName: string): SourceFile;
getCurrentDirectory(): string;
}
interface ParseConfigHost {
readDirectory(rootDir: string, extension: string): string[];
}
interface WriteFileCallback {
(fileName: string, data: string, writeByteOrderMark: boolean, onError?: (message: string) => void): void;
}
@@ -804,6 +809,7 @@ declare module ts {
sourceMapFile: string;
sourceMapSourceRoot: string;
sourceMapSources: string[];
sourceMapSourcesContent?: string[];
inputSourceFileNames: string[];
sourceMapNames?: string[];
sourceMapMappings: string;
@@ -1082,6 +1088,8 @@ declare module ts {
diagnostics?: boolean;
emitBOM?: boolean;
help?: boolean;
inlineSourceMap?: boolean;
inlineSources?: boolean;
listFiles?: boolean;
locale?: string;
mapRoot?: string;
@@ -1113,6 +1121,7 @@ declare module ts {
CommonJS = 1,
AMD = 2,
UMD = 3,
System = 4,
}
interface LineAndCharacter {
line: number;
@@ -1226,7 +1235,7 @@ declare module ts {
const version: string;
function findConfigFile(searchPath: string): string;
function createCompilerHost(options: CompilerOptions, setParentNodes?: boolean): CompilerHost;
function getPreEmitDiagnostics(program: Program): Diagnostic[];
function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[];
function flattenDiagnosticMessageText(messageText: string | DiagnosticMessageChain, newLine: string): string;
function createProgram(rootNames: string[], options: CompilerOptions, host?: CompilerHost): Program;
}
@@ -1236,14 +1245,26 @@ declare module ts {
* Read tsconfig.json file
* @param fileName The path to the config file
*/
function readConfigFile(fileName: string): any;
function readConfigFile(fileName: string): {
config?: any;
error?: Diagnostic;
};
/**
* Parse the text of the tsconfig.json file
* @param fileName The path to the config file
* @param jsonText The text of the config file
*/
function parseConfigFileText(fileName: string, jsonText: string): {
config?: any;
error?: Diagnostic;
};
/**
* Parse the contents of a config file (tsconfig.json).
* @param json The contents of the config file to parse
* @param basePath A root directory to resolve relative path entries in the config
* file to. e.g. outDir
*/
function parseConfigFile(json: any, basePath?: string): ParsedCommandLine;
function parseConfigFile(json: any, host: ParseConfigHost, basePath: string): ParsedCommandLine;
}
declare module ts {
/** The version of the language service API */
+3869 -3008
View File
File diff suppressed because it is too large Load Diff
+46 -54
View File
@@ -582,7 +582,7 @@ module ts {
if (moduleSymbol) {
let exportDefaultSymbol = resolveSymbol(moduleSymbol.exports["default"]);
if (!exportDefaultSymbol) {
error(node.name, Diagnostics.External_module_0_has_no_default_export, symbolToString(moduleSymbol));
error(node.name, Diagnostics.Module_0_has_no_default_export, symbolToString(moduleSymbol));
}
return exportDefaultSymbol;
}
@@ -870,10 +870,10 @@ module ts {
if (sourceFile.symbol) {
return sourceFile.symbol;
}
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_an_external_module, sourceFile.fileName);
error(moduleReferenceLiteral, Diagnostics.File_0_is_not_a_module, sourceFile.fileName);
return;
}
error(moduleReferenceLiteral, Diagnostics.Cannot_find_external_module_0, moduleName);
error(moduleReferenceLiteral, Diagnostics.Cannot_find_module_0, moduleName);
}
// An external module with an 'export =' declaration resolves to the target of the 'export =' declaration,
@@ -888,7 +888,7 @@ module ts {
function resolveESModuleSymbol(moduleSymbol: Symbol, moduleReferenceExpression: Expression): Symbol {
let symbol = resolveExternalModuleSymbol(moduleSymbol);
if (symbol && !(symbol.flags & (SymbolFlags.Module | SymbolFlags.Variable))) {
error(moduleReferenceExpression, Diagnostics.External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
error(moduleReferenceExpression, Diagnostics.Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct, symbolToString(moduleSymbol));
symbol = undefined;
}
return symbol;
@@ -2480,7 +2480,7 @@ module ts {
let declaration = <ClassDeclaration>getDeclarationOfKind(type.symbol, SyntaxKind.ClassDeclaration);
let baseTypeNode = getClassExtendsHeritageClauseElement(declaration);
if (baseTypeNode) {
let baseType = getTypeFromHeritageClauseElement(baseTypeNode);
let baseType = getTypeFromTypeNode(baseTypeNode);
if (baseType !== unknownType) {
if (getTargetType(baseType).flags & TypeFlags.Class) {
if (type !== baseType && !hasBaseType(<InterfaceType>baseType, type)) {
@@ -2502,7 +2502,7 @@ module ts {
for (let declaration of type.symbol.declarations) {
if (declaration.kind === SyntaxKind.InterfaceDeclaration && getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
for (let node of getInterfaceBaseTypeNodes(<InterfaceDeclaration>declaration)) {
let baseType = getTypeFromHeritageClauseElement(node);
let baseType = getTypeFromTypeNode(node);
if (baseType !== unknownType) {
if (getTargetType(baseType).flags & (TypeFlags.Class | TypeFlags.Interface)) {
@@ -3317,7 +3317,7 @@ module ts {
return type;
}
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | HeritageClauseElement, typeParameterSymbol: Symbol): boolean {
function isTypeParameterReferenceIllegalInConstraint(typeReferenceNode: TypeReferenceNode | ExpressionWithTypeArguments, typeParameterSymbol: Symbol): boolean {
let links = getNodeLinks(typeReferenceNode);
if (links.isIllegalTypeReferenceInConstraint !== undefined) {
return links.isIllegalTypeReferenceInConstraint;
@@ -3366,25 +3366,17 @@ module ts {
}
}
function getTypeFromTypeReference(node: TypeReferenceNode): Type {
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
}
function getTypeFromHeritageClauseElement(node: HeritageClauseElement): Type {
return getTypeFromTypeReferenceOrHeritageClauseElement(node);
}
function getTypeFromTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement): Type {
function getTypeFromTypeReferenceOrExpressionWithTypeArguments(node: TypeReferenceNode | ExpressionWithTypeArguments): Type {
let links = getNodeLinks(node);
if (!links.resolvedType) {
let type: Type;
// We don't currently support heritage clauses with complex expressions in them.
// For these cases, we just set the type to be the unknownType.
if (node.kind !== SyntaxKind.HeritageClauseElement || isSupportedHeritageClauseElement(<HeritageClauseElement>node)) {
if (node.kind !== SyntaxKind.ExpressionWithTypeArguments || isSupportedExpressionWithTypeArguments(<ExpressionWithTypeArguments>node)) {
let typeNameOrExpression = node.kind === SyntaxKind.TypeReference
? (<TypeReferenceNode>node).typeName
: (<HeritageClauseElement>node).expression;
: (<ExpressionWithTypeArguments>node).expression;
let symbol = resolveEntityName(typeNameOrExpression, SymbolFlags.Type);
if (symbol) {
@@ -3674,9 +3666,9 @@ module ts {
case SyntaxKind.StringLiteral:
return getTypeFromStringLiteral(<StringLiteral>node);
case SyntaxKind.TypeReference:
return getTypeFromTypeReference(<TypeReferenceNode>node);
case SyntaxKind.HeritageClauseElement:
return getTypeFromHeritageClauseElement(<HeritageClauseElement>node);
return getTypeFromTypeReferenceOrExpressionWithTypeArguments(<TypeReferenceNode>node);
case SyntaxKind.ExpressionWithTypeArguments:
return getTypeFromTypeReferenceOrExpressionWithTypeArguments(<ExpressionWithTypeArguments>node);
case SyntaxKind.TypeQuery:
return getTypeFromTypeQueryNode(<TypeQueryNode>node);
case SyntaxKind.ArrayType:
@@ -5515,7 +5507,7 @@ module ts {
switch (container.kind) {
case SyntaxKind.ModuleDeclaration:
error(node, Diagnostics.this_cannot_be_referenced_in_a_module_body);
error(node, Diagnostics.this_cannot_be_referenced_in_a_module_or_namespace_body);
// do not return here so in case if lexical this is captured - it will be reflected in flags on NodeLinks
break;
case SyntaxKind.EnumDeclaration:
@@ -8387,20 +8379,20 @@ module ts {
function checkTypeReferenceNode(node: TypeReferenceNode) {
checkGrammarTypeReferenceInStrictMode(node.typeName);
return checkTypeReferenceOrHeritageClauseElement(node);
return checkTypeReferenceOrExpressionWithTypeArguments(node);
}
function checkHeritageClauseElement(node: HeritageClauseElement) {
checkGrammarHeritageClauseElementInStrictMode(<PropertyAccessExpression>node.expression);
function checkExpressionWithTypeArguments(node: ExpressionWithTypeArguments) {
checkGrammarExpressionWithTypeArgumentsInStrictMode(<PropertyAccessExpression>node.expression);
return checkTypeReferenceOrHeritageClauseElement(node);
return checkTypeReferenceOrExpressionWithTypeArguments(node);
}
function checkTypeReferenceOrHeritageClauseElement(node: TypeReferenceNode | HeritageClauseElement) {
function checkTypeReferenceOrExpressionWithTypeArguments(node: TypeReferenceNode | ExpressionWithTypeArguments) {
// Grammar checking
checkGrammarTypeArguments(node, node.typeArguments);
let type = getTypeFromTypeReferenceOrHeritageClauseElement(node);
let type = getTypeFromTypeReferenceOrExpressionWithTypeArguments(node);
if (type !== unknownType && node.typeArguments) {
// Do type argument local checks only if referenced type is successfully resolved
let len = node.typeArguments.length;
@@ -9086,7 +9078,7 @@ module ts {
let parent = getDeclarationContainer(node);
if (parent.kind === SyntaxKind.SourceFile && isExternalModule(<SourceFile>parent)) {
// If the declaration happens to be in external module, report error that require and exports are reserved keywords
error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module,
error(name, Diagnostics.Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module,
declarationNameToString(name), declarationNameToString(name));
}
}
@@ -9966,12 +9958,12 @@ module ts {
let staticType = <ObjectType>getTypeOfSymbol(symbol);
let baseTypeNode = getClassExtendsHeritageClauseElement(node);
if (baseTypeNode) {
if (!isSupportedHeritageClauseElement(baseTypeNode)) {
if (!isSupportedExpressionWithTypeArguments(baseTypeNode)) {
error(baseTypeNode.expression, Diagnostics.Only_identifiers_Slashqualified_names_with_optional_type_arguments_are_currently_supported_in_a_class_extends_clauses);
}
emitExtends = emitExtends || !isInAmbientContext(node);
checkHeritageClauseElement(baseTypeNode);
checkExpressionWithTypeArguments(baseTypeNode);
}
let baseTypes = getBaseTypes(type);
if (baseTypes.length) {
@@ -9998,13 +9990,13 @@ module ts {
let implementedTypeNodes = getClassImplementsHeritageClauseElements(node);
if (implementedTypeNodes) {
forEach(implementedTypeNodes, typeRefNode => {
if (!isSupportedHeritageClauseElement(typeRefNode)) {
if (!isSupportedExpressionWithTypeArguments(typeRefNode)) {
error(typeRefNode.expression, Diagnostics.A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments);
}
checkHeritageClauseElement(typeRefNode);
checkExpressionWithTypeArguments(typeRefNode);
if (produceDiagnostics) {
let t = getTypeFromHeritageClauseElement(typeRefNode);
let t = getTypeFromTypeNode(typeRefNode);
if (t !== unknownType) {
let declaredType = (t.flags & TypeFlags.Reference) ? (<TypeReference>t).target : t;
if (declaredType.flags & (TypeFlags.Class | TypeFlags.Interface)) {
@@ -10199,11 +10191,11 @@ module ts {
}
}
forEach(getInterfaceBaseTypeNodes(node), heritageElement => {
if (!isSupportedHeritageClauseElement(heritageElement)) {
if (!isSupportedExpressionWithTypeArguments(heritageElement)) {
error(heritageElement.expression, Diagnostics.An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments);
}
checkHeritageClauseElement(heritageElement);
checkExpressionWithTypeArguments(heritageElement);
});
forEach(node.members, checkSourceElement);
@@ -10501,10 +10493,10 @@ module ts {
let firstNonAmbientClassOrFunc = getFirstNonAmbientClassOrFunctionDeclaration(symbol);
if (firstNonAmbientClassOrFunc) {
if (getSourceFileOfNode(node) !== getSourceFileOfNode(firstNonAmbientClassOrFunc)) {
error(node.name, Diagnostics.A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
error(node.name, Diagnostics.A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged);
}
else if (node.pos < firstNonAmbientClassOrFunc.pos) {
error(node.name, Diagnostics.A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
error(node.name, Diagnostics.A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged);
}
}
@@ -10520,10 +10512,10 @@ module ts {
// Checks for ambient external modules.
if (node.name.kind === SyntaxKind.StringLiteral) {
if (!isGlobalSourceFile(node.parent)) {
error(node.name, Diagnostics.Ambient_external_modules_cannot_be_nested_in_other_modules);
error(node.name, Diagnostics.Ambient_modules_cannot_be_nested_in_other_modules);
}
if (isExternalModuleNameRelative(node.name.text)) {
error(node.name, Diagnostics.Ambient_external_module_declaration_cannot_specify_relative_module_name);
error(node.name, Diagnostics.Ambient_module_declaration_cannot_specify_relative_module_name);
}
}
}
@@ -10555,8 +10547,8 @@ module ts {
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(moduleName, node.kind === SyntaxKind.ExportDeclaration ?
Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module :
Diagnostics.Import_declarations_in_an_internal_module_cannot_reference_an_external_module);
Diagnostics.Export_declarations_are_not_permitted_in_a_namespace :
Diagnostics.Import_declarations_in_a_namespace_cannot_reference_a_module);
return false;
}
if (inAmbientExternalModule && isExternalModuleNameRelative((<LiteralExpression>moduleName).text)) {
@@ -10564,7 +10556,7 @@ module ts {
// An ExternalImportDeclaration in an AmbientExternalModuleDeclaration may reference
// other external modules only through top - level external module names.
// Relative external module names are not permitted.
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name);
error(node, Diagnostics.Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name);
return false;
}
return true;
@@ -10658,14 +10650,14 @@ module ts {
let inAmbientExternalModule = node.parent.kind === SyntaxKind.ModuleBlock && (<ModuleDeclaration>node.parent.parent).name.kind === SyntaxKind.StringLiteral;
if (node.parent.kind !== SyntaxKind.SourceFile && !inAmbientExternalModule) {
error(node, Diagnostics.Export_declarations_are_not_permitted_in_an_internal_module);
error(node, Diagnostics.Export_declarations_are_not_permitted_in_a_namespace);
}
}
else {
// export * from "foo"
let moduleSymbol = resolveExternalModuleName(node, node.moduleSpecifier);
if (moduleSymbol && moduleSymbol.exports["export="]) {
error(node.moduleSpecifier, Diagnostics.External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
error(node.moduleSpecifier, Diagnostics.Module_0_uses_export_and_cannot_be_used_with_export_Asterisk, symbolToString(moduleSymbol));
}
}
}
@@ -10681,7 +10673,7 @@ module ts {
function checkExportAssignment(node: ExportAssignment) {
let container = node.parent.kind === SyntaxKind.SourceFile ? <SourceFile>node.parent : <ModuleDeclaration>node.parent.parent;
if (container.kind === SyntaxKind.ModuleDeclaration && (<ModuleDeclaration>container).name.kind === SyntaxKind.Identifier) {
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_an_internal_module);
error(node, Diagnostics.An_export_assignment_cannot_be_used_in_a_namespace);
return;
}
// Grammar checking
@@ -10696,7 +10688,7 @@ module ts {
}
checkExternalModuleExports(container);
if (node.isExportEquals) {
if (node.isExportEquals && !isInAmbientContext(node)) {
if (languageVersion >= ScriptTarget.ES6) {
// export assignment is deprecated in es6 or above
grammarErrorOnNode(node, Diagnostics.Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead);
@@ -11161,7 +11153,7 @@ module ts {
node = node.parent;
}
return node.parent && node.parent.kind === SyntaxKind.HeritageClauseElement;
return node.parent && node.parent.kind === SyntaxKind.ExpressionWithTypeArguments;
}
function isTypeNode(node: Node): boolean {
@@ -11181,7 +11173,7 @@ module ts {
case SyntaxKind.StringLiteral:
// Specialized signatures can have string literals as their parameters' type names
return node.parent.kind === SyntaxKind.Parameter;
case SyntaxKind.HeritageClauseElement:
case SyntaxKind.ExpressionWithTypeArguments:
return true;
// Identifiers and qualified names may be type nodes, depending on their context. Climb
@@ -11215,7 +11207,7 @@ module ts {
return true;
}
switch (parent.kind) {
case SyntaxKind.HeritageClauseElement:
case SyntaxKind.ExpressionWithTypeArguments:
return true;
case SyntaxKind.TypeParameter:
return node === (<TypeParameterDeclaration>parent).constraint;
@@ -11293,7 +11285,7 @@ module ts {
}
if (isHeritageClauseElementIdentifier(<EntityName>entityName)) {
let meaning = entityName.parent.kind === SyntaxKind.HeritageClauseElement ? SymbolFlags.Type : SymbolFlags.Namespace;
let meaning = entityName.parent.kind === SyntaxKind.ExpressionWithTypeArguments ? SymbolFlags.Type : SymbolFlags.Namespace;
meaning |= SymbolFlags.Alias;
return resolveEntityName(<EntityName>entityName, meaning);
}
@@ -11702,7 +11694,7 @@ module ts {
// * The serialized type of a TypeReference with a value declaration is its entity name.
// * The serialized type of a TypeReference with a call or construct signature is "Function".
// * The serialized type of any other type is "Object".
let type = getTypeFromTypeReference(node);
let type = getTypeFromTypeNode(node);
if (type.flags & TypeFlags.Void) {
return "void 0";
}
@@ -12124,7 +12116,7 @@ module ts {
// public // error at public
// public.private.package // error at public
// B.private.B // no error
function checkGrammarHeritageClauseElementInStrictMode(expression: Expression) {
function checkGrammarExpressionWithTypeArgumentsInStrictMode(expression: Expression) {
// Example:
// class C extends public // error at public
if (expression && expression.kind === SyntaxKind.Identifier) {
@@ -12135,7 +12127,7 @@ module ts {
// in PropertyAccessExpression. According to grammar production of MemberExpression,
// the left component expression is a PrimaryExpression (i.e. Identifier) while the other
// component after dots can be IdentifierName.
checkGrammarHeritageClauseElementInStrictMode((<PropertyAccessExpression>expression).expression);
checkGrammarExpressionWithTypeArgumentsInStrictMode((<PropertyAccessExpression>expression).expression);
}
}
+7 -7
View File
@@ -329,8 +329,8 @@ module ts {
case SyntaxKind.VoidKeyword:
case SyntaxKind.StringLiteral:
return writeTextOfNode(currentSourceFile, type);
case SyntaxKind.HeritageClauseElement:
return emitHeritageClauseElement(<HeritageClauseElement>type);
case SyntaxKind.ExpressionWithTypeArguments:
return emitExpressionWithTypeArguments(<ExpressionWithTypeArguments>type);
case SyntaxKind.TypeReference:
return emitTypeReference(<TypeReferenceNode>type);
case SyntaxKind.TypeQuery:
@@ -376,8 +376,8 @@ module ts {
}
}
function emitHeritageClauseElement(node: HeritageClauseElement) {
if (isSupportedHeritageClauseElement(node)) {
function emitExpressionWithTypeArguments(node: ExpressionWithTypeArguments) {
if (isSupportedExpressionWithTypeArguments(node)) {
Debug.assert(node.expression.kind === SyntaxKind.Identifier || node.expression.kind === SyntaxKind.PropertyAccessExpression);
emitEntityName(<Identifier | PropertyAccessExpression>node.expression);
if (node.typeArguments) {
@@ -861,14 +861,14 @@ module ts {
}
}
function emitHeritageClause(typeReferences: HeritageClauseElement[], isImplementsList: boolean) {
function emitHeritageClause(typeReferences: ExpressionWithTypeArguments[], isImplementsList: boolean) {
if (typeReferences) {
write(isImplementsList ? " implements " : " extends ");
emitCommaList(typeReferences, emitTypeOfTypeReference);
}
function emitTypeOfTypeReference(node: HeritageClauseElement) {
if (isSupportedHeritageClauseElement(node)) {
function emitTypeOfTypeReference(node: ExpressionWithTypeArguments) {
if (isSupportedExpressionWithTypeArguments(node)) {
emitTypeWithNewGetSymbolAccessibilityDiagnostic(node, getHeritageClauseVisibilityError);
}
@@ -46,7 +46,7 @@ module ts {
A_get_accessor_cannot_have_parameters: { code: 1054, category: DiagnosticCategory.Error, key: "A 'get' accessor cannot have parameters." },
Accessors_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1056, category: DiagnosticCategory.Error, key: "Accessors are only available when targeting ECMAScript 5 and higher." },
Enum_member_must_have_initializer: { code: 1061, category: DiagnosticCategory.Error, key: "Enum member must have initializer." },
An_export_assignment_cannot_be_used_in_an_internal_module: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in an internal module." },
An_export_assignment_cannot_be_used_in_a_namespace: { code: 1063, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a namespace." },
Ambient_enum_elements_can_only_have_integer_literal_initializers: { code: 1066, category: DiagnosticCategory.Error, key: "Ambient enum elements can only have integer literal initializers." },
Unexpected_token_A_constructor_method_accessor_or_property_was_expected: { code: 1068, category: DiagnosticCategory.Error, key: "Unexpected token. A constructor, method, accessor, or property was expected." },
A_declare_modifier_cannot_be_used_with_an_import_declaration: { code: 1079, category: DiagnosticCategory.Error, key: "A 'declare' modifier cannot be used with an import declaration." },
@@ -107,8 +107,8 @@ module ts {
or_expected: { code: 1144, category: DiagnosticCategory.Error, key: "'{' or ';' expected." },
Modifiers_not_permitted_on_index_signature_members: { code: 1145, category: DiagnosticCategory.Error, key: "Modifiers not permitted on index signature members." },
Declaration_expected: { code: 1146, category: DiagnosticCategory.Error, key: "Declaration expected." },
Import_declarations_in_an_internal_module_cannot_reference_an_external_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in an internal module cannot reference an external module." },
Cannot_compile_external_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile external modules unless the '--module' flag is provided." },
Import_declarations_in_a_namespace_cannot_reference_a_module: { code: 1147, category: DiagnosticCategory.Error, key: "Import declarations in a namespace cannot reference a module." },
Cannot_compile_modules_unless_the_module_flag_is_provided: { code: 1148, category: DiagnosticCategory.Error, key: "Cannot compile modules unless the '--module' flag is provided." },
File_name_0_differs_from_already_included_file_name_1_only_in_casing: { code: 1149, category: DiagnosticCategory.Error, key: "File name '{0}' differs from already included file name '{1}' only in casing" },
new_T_cannot_be_used_to_create_an_array_Use_new_Array_T_instead: { code: 1150, category: DiagnosticCategory.Error, key: "'new T[]' cannot be used to create an array. Use 'new Array<T>()' instead." },
var_let_or_const_expected: { code: 1152, category: DiagnosticCategory.Error, key: "'var', 'let' or 'const' expected." },
@@ -150,9 +150,9 @@ module ts {
The_variable_declaration_of_a_for_in_statement_cannot_have_an_initializer: { code: 1189, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...in' statement cannot have an initializer." },
The_variable_declaration_of_a_for_of_statement_cannot_have_an_initializer: { code: 1190, category: DiagnosticCategory.Error, key: "The variable declaration of a 'for...of' statement cannot have an initializer." },
An_import_declaration_cannot_have_modifiers: { code: 1191, category: DiagnosticCategory.Error, key: "An import declaration cannot have modifiers." },
External_module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "External module '{0}' has no default export." },
Module_0_has_no_default_export: { code: 1192, category: DiagnosticCategory.Error, key: "Module '{0}' has no default export." },
An_export_declaration_cannot_have_modifiers: { code: 1193, category: DiagnosticCategory.Error, key: "An export declaration cannot have modifiers." },
Export_declarations_are_not_permitted_in_an_internal_module: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in an internal module." },
Export_declarations_are_not_permitted_in_a_namespace: { code: 1194, category: DiagnosticCategory.Error, key: "Export declarations are not permitted in a namespace." },
Catch_clause_variable_name_must_be_an_identifier: { code: 1195, category: DiagnosticCategory.Error, key: "Catch clause variable name must be an identifier." },
Catch_clause_variable_cannot_have_a_type_annotation: { code: 1196, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have a type annotation." },
Catch_clause_variable_cannot_have_an_initializer: { code: 1197, category: DiagnosticCategory.Error, key: "Catch clause variable cannot have an initializer." },
@@ -161,20 +161,18 @@ module ts {
Line_terminator_not_permitted_before_arrow: { code: 1200, category: DiagnosticCategory.Error, key: "Line terminator not permitted before arrow." },
Import_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_import_Asterisk_as_ns_from_mod_import_a_from_mod_or_import_d_from_mod_instead: { code: 1202, category: DiagnosticCategory.Error, key: "Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from \"mod\"', 'import {a} from \"mod\"' or 'import d from \"mod\"' instead." },
Export_assignment_cannot_be_used_when_targeting_ECMAScript_6_or_higher_Consider_using_export_default_instead: { code: 1203, category: DiagnosticCategory.Error, key: "Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead." },
Cannot_compile_external_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." },
Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher: { code: 1204, category: DiagnosticCategory.Error, key: "Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher." },
Decorators_are_only_available_when_targeting_ECMAScript_5_and_higher: { code: 1205, category: DiagnosticCategory.Error, key: "Decorators are only available when targeting ECMAScript 5 and higher." },
Decorators_are_not_valid_here: { code: 1206, category: DiagnosticCategory.Error, key: "Decorators are not valid here." },
Decorators_cannot_be_applied_to_multiple_get_Slashset_accessors_of_the_same_name: { code: 1207, category: DiagnosticCategory.Error, key: "Decorators cannot be applied to multiple get/set accessors of the same name." },
Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile non-external modules when the '--separateCompilation' flag is provided." },
Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided: { code: 1208, category: DiagnosticCategory.Error, key: "Cannot compile namespaces when the '--separateCompilation' flag is provided." },
Ambient_const_enums_are_not_allowed_when_the_separateCompilation_flag_is_provided: { code: 1209, category: DiagnosticCategory.Error, key: "Ambient const enums are not allowed when the '--separateCompilation' flag is provided." },
Invalid_use_of_0_Class_definitions_are_automatically_in_strict_mode: { code: 1210, category: DiagnosticCategory.Error, key: "Invalid use of '{0}'. Class definitions are automatically in strict mode." },
A_class_declaration_without_the_default_modifier_must_have_a_name: { code: 1211, category: DiagnosticCategory.Error, key: "A class declaration without the 'default' modifier must have a name" },
Identifier_expected_0_is_a_reserved_word_in_strict_mode: { code: 1212, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode" },
Identifier_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1213, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Identifier_expected_0_is_a_reserved_word_in_strict_mode_External_Module_is_automatically_in_strict_mode: { code: 1214, category: DiagnosticCategory.Error, key: "Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode." },
Type_expected_0_is_a_reserved_word_in_strict_mode: { code: 1215, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode" },
Type_expected_0_is_a_reserved_word_in_strict_mode_Class_definitions_are_automatically_in_strict_mode: { code: 1216, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Class definitions are automatically in strict mode." },
Type_expected_0_is_a_reserved_word_in_strict_mode_Module_is_automatically_in_strict_mode: { code: 1217, category: DiagnosticCategory.Error, key: "Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode." },
Export_assignment_is_not_supported_when_module_flag_is_system: { code: 1218, category: DiagnosticCategory.Error, key: "Export assignment is not supported when '--module' flag is 'system'." },
Duplicate_identifier_0: { code: 2300, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'." },
Initializer_of_instance_member_variable_0_cannot_reference_identifier_1_declared_in_the_constructor: { code: 2301, category: DiagnosticCategory.Error, key: "Initializer of instance member variable '{0}' cannot reference identifier '{1}' declared in the constructor." },
@@ -182,8 +180,8 @@ module ts {
Circular_definition_of_import_alias_0: { code: 2303, category: DiagnosticCategory.Error, key: "Circular definition of import alias '{0}'." },
Cannot_find_name_0: { code: 2304, category: DiagnosticCategory.Error, key: "Cannot find name '{0}'." },
Module_0_has_no_exported_member_1: { code: 2305, category: DiagnosticCategory.Error, key: "Module '{0}' has no exported member '{1}'." },
File_0_is_not_an_external_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not an external module." },
Cannot_find_external_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find external module '{0}'." },
File_0_is_not_a_module: { code: 2306, category: DiagnosticCategory.Error, key: "File '{0}' is not a module." },
Cannot_find_module_0: { code: 2307, category: DiagnosticCategory.Error, key: "Cannot find module '{0}'." },
A_module_cannot_have_more_than_one_export_assignment: { code: 2308, category: DiagnosticCategory.Error, key: "A module cannot have more than one export assignment." },
An_export_assignment_cannot_be_used_in_a_module_with_other_exported_elements: { code: 2309, category: DiagnosticCategory.Error, key: "An export assignment cannot be used in a module with other exported elements." },
Type_0_recursively_references_itself_as_a_base_type: { code: 2310, category: DiagnosticCategory.Error, key: "Type '{0}' recursively references itself as a base type." },
@@ -206,7 +204,7 @@ module ts {
Types_of_parameters_0_and_1_are_incompatible: { code: 2328, category: DiagnosticCategory.Error, key: "Types of parameters '{0}' and '{1}' are incompatible." },
Index_signature_is_missing_in_type_0: { code: 2329, category: DiagnosticCategory.Error, key: "Index signature is missing in type '{0}'." },
Index_signatures_are_incompatible: { code: 2330, category: DiagnosticCategory.Error, key: "Index signatures are incompatible." },
this_cannot_be_referenced_in_a_module_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module body." },
this_cannot_be_referenced_in_a_module_or_namespace_body: { code: 2331, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a module or namespace body." },
this_cannot_be_referenced_in_current_location: { code: 2332, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in current location." },
this_cannot_be_referenced_in_constructor_arguments: { code: 2333, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in constructor arguments." },
this_cannot_be_referenced_in_a_static_property_initializer: { code: 2334, category: DiagnosticCategory.Error, key: "'this' cannot be referenced in a static property initializer." },
@@ -298,15 +296,15 @@ module ts {
Interface_0_incorrectly_extends_interface_1: { code: 2430, category: DiagnosticCategory.Error, key: "Interface '{0}' incorrectly extends interface '{1}'." },
Enum_name_cannot_be_0: { code: 2431, category: DiagnosticCategory.Error, key: "Enum name cannot be '{0}'" },
In_an_enum_with_multiple_declarations_only_one_declaration_can_omit_an_initializer_for_its_first_enum_element: { code: 2432, category: DiagnosticCategory.Error, key: "In an enum with multiple declarations, only one declaration can omit an initializer for its first enum element." },
A_module_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A module declaration cannot be in a different file from a class or function with which it is merged" },
A_module_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A module declaration cannot be located prior to a class or function with which it is merged" },
Ambient_external_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient external modules cannot be nested in other modules." },
Ambient_external_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient external module declaration cannot specify relative module name." },
A_namespace_declaration_cannot_be_in_a_different_file_from_a_class_or_function_with_which_it_is_merged: { code: 2433, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be in a different file from a class or function with which it is merged" },
A_namespace_declaration_cannot_be_located_prior_to_a_class_or_function_with_which_it_is_merged: { code: 2434, category: DiagnosticCategory.Error, key: "A namespace declaration cannot be located prior to a class or function with which it is merged" },
Ambient_modules_cannot_be_nested_in_other_modules: { code: 2435, category: DiagnosticCategory.Error, key: "Ambient modules cannot be nested in other modules." },
Ambient_module_declaration_cannot_specify_relative_module_name: { code: 2436, category: DiagnosticCategory.Error, key: "Ambient module declaration cannot specify relative module name." },
Module_0_is_hidden_by_a_local_declaration_with_the_same_name: { code: 2437, category: DiagnosticCategory.Error, key: "Module '{0}' is hidden by a local declaration with the same name" },
Import_name_cannot_be_0: { code: 2438, category: DiagnosticCategory.Error, key: "Import name cannot be '{0}'" },
Import_or_export_declaration_in_an_ambient_external_module_declaration_cannot_reference_external_module_through_relative_external_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name." },
Import_or_export_declaration_in_an_ambient_module_declaration_cannot_reference_module_through_relative_module_name: { code: 2439, category: DiagnosticCategory.Error, key: "Import or export declaration in an ambient module declaration cannot reference module through relative module name." },
Import_declaration_conflicts_with_local_declaration_of_0: { code: 2440, category: DiagnosticCategory.Error, key: "Import declaration conflicts with local declaration of '{0}'" },
Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_an_external_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module." },
Duplicate_identifier_0_Compiler_reserves_name_1_in_top_level_scope_of_a_module: { code: 2441, category: DiagnosticCategory.Error, key: "Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module." },
Types_have_separate_declarations_of_a_private_property_0: { code: 2442, category: DiagnosticCategory.Error, key: "Types have separate declarations of a private property '{0}'." },
Property_0_is_protected_but_type_1_is_not_a_class_derived_from_2: { code: 2443, category: DiagnosticCategory.Error, key: "Property '{0}' is protected but type '{1}' is not a class derived from '{2}'." },
Property_0_is_protected_in_type_1_but_public_in_type_2: { code: 2444, category: DiagnosticCategory.Error, key: "Property '{0}' is protected in type '{1}' but public in type '{2}'." },
@@ -360,8 +358,8 @@ module ts {
Using_a_string_in_a_for_of_statement_is_only_supported_in_ECMAScript_5_and_higher: { code: 2494, category: DiagnosticCategory.Error, key: "Using a string in a 'for...of' statement is only supported in ECMAScript 5 and higher." },
Type_0_is_not_an_array_type_or_a_string_type: { code: 2495, category: DiagnosticCategory.Error, key: "Type '{0}' is not an array type or a string type." },
The_arguments_object_cannot_be_referenced_in_an_arrow_function_in_ES3_and_ES5_Consider_using_a_standard_function_expression: { code: 2496, category: DiagnosticCategory.Error, key: "The 'arguments' object cannot be referenced in an arrow function in ES3 and ES5. Consider using a standard function expression." },
External_module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "External module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
External_module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "External module '{0}' uses 'export =' and cannot be used with 'export *'." },
Module_0_resolves_to_a_non_module_entity_and_cannot_be_imported_using_this_construct: { code: 2497, category: DiagnosticCategory.Error, key: "Module '{0}' resolves to a non-module entity and cannot be imported using this construct." },
Module_0_uses_export_and_cannot_be_used_with_export_Asterisk: { code: 2498, category: DiagnosticCategory.Error, key: "Module '{0}' uses 'export =' and cannot be used with 'export *'." },
An_interface_can_only_extend_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2499, category: DiagnosticCategory.Error, key: "An interface can only extend an identifier/qualified-name with optional type arguments." },
A_class_can_only_implement_an_identifier_Slashqualified_name_with_optional_type_arguments: { code: 2500, category: DiagnosticCategory.Error, key: "A class can only implement an identifier/qualified-name with optional type arguments." },
A_rest_element_cannot_contain_a_binding_pattern: { code: 2501, category: DiagnosticCategory.Error, key: "A rest element cannot contain a binding pattern." },
+20 -27
View File
@@ -171,7 +171,7 @@
"category": "Error",
"code": 1061
},
"An export assignment cannot be used in an internal module.": {
"An export assignment cannot be used in a namespace.": {
"category": "Error",
"code": 1063
},
@@ -415,11 +415,11 @@
"category": "Error",
"code": 1146
},
"Import declarations in an internal module cannot reference an external module.": {
"Import declarations in a namespace cannot reference a module.": {
"category": "Error",
"code": 1147
},
"Cannot compile external modules unless the '--module' flag is provided.": {
"Cannot compile modules unless the '--module' flag is provided.": {
"category": "Error",
"code": 1148
},
@@ -587,7 +587,7 @@
"category": "Error",
"code": 1191
},
"External module '{0}' has no default export.": {
"Module '{0}' has no default export.": {
"category": "Error",
"code": 1192
},
@@ -595,7 +595,7 @@
"category": "Error",
"code": 1193
},
"Export declarations are not permitted in an internal module.": {
"Export declarations are not permitted in a namespace.": {
"category": "Error",
"code": 1194
},
@@ -631,7 +631,7 @@
"category": "Error",
"code": 1203
},
"Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": {
"Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.": {
"category": "Error",
"code": 1204
},
@@ -647,7 +647,7 @@
"category": "Error",
"code": 1207
},
"Cannot compile non-external modules when the '--separateCompilation' flag is provided.": {
"Cannot compile namespaces when the '--separateCompilation' flag is provided.": {
"category": "Error",
"code": 1208
},
@@ -671,10 +671,6 @@
"category": "Error",
"code": 1213
},
"Identifier expected. '{0}' is a reserved word in strict mode. External Module is automatically in strict mode.": {
"category": "Error",
"code": 1214
},
"Type expected. '{0}' is a reserved word in strict mode": {
"category": "Error",
"code": 1215
@@ -683,14 +679,11 @@
"category": "Error",
"code": 1216
},
"Type expected. '{0}' is a reserved word in strict mode. Module is automatically in strict mode.": {
"category": "Error",
"code": 1217
},
"Export assignment is not supported when '--module' flag is 'system'.": {
"category": "Error",
"code": 1218
},
},
"Duplicate identifier '{0}'.": {
"category": "Error",
"code": 2300
@@ -715,11 +708,11 @@
"category": "Error",
"code": 2305
},
"File '{0}' is not an external module.": {
"File '{0}' is not a module.": {
"category": "Error",
"code": 2306
},
"Cannot find external module '{0}'.": {
"Cannot find module '{0}'.": {
"category": "Error",
"code": 2307
},
@@ -811,7 +804,7 @@
"category": "Error",
"code": 2330
},
"'this' cannot be referenced in a module body.": {
"'this' cannot be referenced in a module or namespace body.": {
"category": "Error",
"code": 2331
},
@@ -1179,19 +1172,19 @@
"category": "Error",
"code": 2432
},
"A module declaration cannot be in a different file from a class or function with which it is merged": {
"A namespace declaration cannot be in a different file from a class or function with which it is merged": {
"category": "Error",
"code": 2433
},
"A module declaration cannot be located prior to a class or function with which it is merged": {
"A namespace declaration cannot be located prior to a class or function with which it is merged": {
"category": "Error",
"code": 2434
},
"Ambient external modules cannot be nested in other modules.": {
"Ambient modules cannot be nested in other modules.": {
"category": "Error",
"code": 2435
},
"Ambient external module declaration cannot specify relative module name.": {
"Ambient module declaration cannot specify relative module name.": {
"category": "Error",
"code": 2436
},
@@ -1203,7 +1196,7 @@
"category": "Error",
"code": 2438
},
"Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.": {
"Import or export declaration in an ambient module declaration cannot reference module through relative module name.": {
"category": "Error",
"code": 2439
},
@@ -1211,7 +1204,7 @@
"category": "Error",
"code": 2440
},
"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of an external module.": {
"Duplicate identifier '{0}'. Compiler reserves name '{1}' in top level scope of a module.": {
"category": "Error",
"code": 2441
},
@@ -1427,11 +1420,11 @@
"category": "Error",
"code": 2496
},
"External module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
"Module '{0}' resolves to a non-module entity and cannot be imported using this construct.": {
"category": "Error",
"code": 2497
},
"External module '{0}' uses 'export =' and cannot be used with 'export *'.": {
"Module '{0}' uses 'export =' and cannot be used with 'export *'.": {
"category": "Error",
"code": 2498
},
+159 -18
View File
@@ -3,12 +3,6 @@
/* @internal */
module ts {
// represents one LexicalEnvironment frame to store unique generated names
interface ScopeFrame {
names: Map<string>;
previous: ScopeFrame;
}
export function isExternalModuleOrDeclarationFile(sourceFile: SourceFile) {
return isExternalModule(sourceFile) || isDeclarationFile(sourceFile);
}
@@ -18,7 +12,6 @@ module ts {
Auto = 0x00000000, // No preferred name
CountMask = 0x0FFFFFFF, // Temp variable counter
_i = 0x10000000, // Use/preference flag for '_i'
_n = 0x20000000, // Use/preference flag for '_n'
}
// targetSourceFile is when users only want one file in entire project to be emitted. This is used in compileOnSave feature
@@ -2683,15 +2676,17 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
if (!exportEquals && exportSpecifiers && hasProperty(exportSpecifiers, name.text)) {
for (let specifier of exportSpecifiers[name.text]) {
writeLine();
emitStart(specifier.name);
if (compilerOptions.module === ModuleKind.System) {
emitStart(specifier.name);
write(`${exportFunctionForFile}("`);
emitNodeWithoutSourceMap(specifier.name);
write(`", `);
emitExpressionIdentifier(name);
write(")")
emitEnd(specifier.name);
}
else {
emitStart(specifier.name);
emitContainingModuleName(specifier);
write(".");
emitNodeWithoutSourceMap(specifier.name);
@@ -3641,7 +3636,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
}
}
function emitConstructor(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) {
function emitConstructor(node: ClassLikeDeclaration, baseTypeElement: ExpressionWithTypeArguments) {
let saveTempFlags = tempFlags;
let saveTempVariables = tempVariables;
let saveTempParameters = tempParameters;
@@ -3656,7 +3651,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
tempParameters = saveTempParameters;
}
function emitConstructorWorker(node: ClassLikeDeclaration, baseTypeElement: HeritageClauseElement) {
function emitConstructorWorker(node: ClassLikeDeclaration, baseTypeElement: ExpressionWithTypeArguments) {
// Check if we have property assignment inside class declaration.
// If there is property assignment, we need to emit constructor whether users define it or not
// If there is no property assignment, we can omit constructor if users do not define it
@@ -4968,7 +4963,135 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
}
}
function hoistTopLevelVariableAndFunctionDeclarations(node: SourceFile): void {
function emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations: (Identifier | Declaration)[]): string {
// when resolving exports local exported entries/indirect exported entries in the module
// should always win over entries with similar names that were added via star exports
// to support this we store names of local/indirect exported entries in a set.
// this set is used to filter names brought by star expors.
if (!hasExportStars) {
// local names set is needed only in presence of star exports
return undefined;
}
// local names set should only be added if we have anything exported
if (!exportedDeclarations && isEmpty(exportSpecifiers)) {
// no exported declarations (export var ...) or export specifiers (export {x})
// check if we have any non star export declarations.
let hasExportDeclarationWithExportClause = false;
for (let externalImport of externalImports) {
if (externalImport.kind === SyntaxKind.ExportDeclaration && (<ExportDeclaration>externalImport).exportClause) {
hasExportDeclarationWithExportClause = true;
break;
}
}
if (!hasExportDeclarationWithExportClause) {
// we still need to emit exportStar helper
return emitExportStarFunction(/*localNames*/ undefined);
}
}
const exportedNamesStorageRef = makeUniqueName("exportedNames");
writeLine();
write(`var ${exportedNamesStorageRef} = {`);
increaseIndent();
let started = false;
if (exportedDeclarations) {
for (let i = 0; i < exportedDeclarations.length; ++i) {
// write name of exported declaration, i.e 'export var x...'
writeExportedName(exportedDeclarations[i]);
}
}
if (exportSpecifiers) {
for (let n in exportSpecifiers) {
for (let specifier of exportSpecifiers[n]) {
// write name of export specified, i.e. 'export {x}'
writeExportedName(specifier.name);
}
}
}
for (let externalImport of externalImports) {
if (externalImport.kind !== SyntaxKind.ExportDeclaration) {
continue;
}
let exportDecl = <ExportDeclaration>externalImport;
if (!exportDecl.exportClause) {
// export * from ...
continue;
}
for (let element of exportDecl.exportClause.elements) {
// write name of indirectly exported entry, i.e. 'export {x} from ...'
writeExportedName(element.name || element.propertyName);
}
}
decreaseIndent();
writeLine();
write("};");
return emitExportStarFunction(exportedNamesStorageRef);
function emitExportStarFunction(localNames: string): string {
const exportStarFunction = makeUniqueName("exportStar");
writeLine();
// define an export star helper function
write(`function ${exportStarFunction}(m) {`);
increaseIndent();
writeLine();
write(`for(var n in m) {`);
increaseIndent();
writeLine();
write(`if (n !== "default"`);
if (localNames) {
write(`&& !${localNames}.hasOwnProperty(n)`);
}
write(`) ${exportFunctionForFile}(n, m[n]);`);
decreaseIndent();
writeLine();
write("}");
decreaseIndent();
writeLine();
write("}")
return exportStarFunction;
}
function writeExportedName(node: Identifier | Declaration): void {
// do not record default exports
// they are local to module and never overwritten (explicitly skipped) by star export
if (node.kind !== SyntaxKind.Identifier && node.flags & NodeFlags.Default) {
return;
}
if (started) {
write(",");
}
else {
started = true;
}
writeLine();
write("'");
if (node.kind === SyntaxKind.Identifier) {
emitNodeWithoutSourceMap(node);
}
else {
emitDeclarationName(<Declaration>node);
}
write("': true");
}
}
function processTopLevelVariableAndFunctionDeclarations(node: SourceFile): (Identifier | Declaration)[] {
// per ES6 spec:
// 15.2.1.16.4 ModuleDeclarationInstantiation() Concrete Method
// - var declarations are initialized to undefined - 14.a.ii
@@ -4980,6 +5103,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
// including variables declarations for module and class declarations
let hoistedVars: (Identifier | ClassDeclaration | ModuleDeclaration)[];
let hoistedFunctionDeclarations: FunctionDeclaration[];
let exportedDeclarations: (Identifier | Declaration)[];
visit(node);
@@ -4997,6 +5121,14 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
else {
emit(local);
}
let flags = getCombinedNodeFlags(local.kind === SyntaxKind.Identifier ? local.parent : local);
if (flags & NodeFlags.Export) {
if (!exportedDeclarations) {
exportedDeclarations = [];
}
exportedDeclarations.push(local);
}
}
write(";")
}
@@ -5005,9 +5137,18 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
for (let f of hoistedFunctionDeclarations) {
writeLine();
emit(f);
if (f.flags & NodeFlags.Export) {
if (!exportedDeclarations) {
exportedDeclarations = [];
}
exportedDeclarations.push(f);
}
}
}
return exportedDeclarations;
function visit(node: Node): void {
if (node.kind === SyntaxKind.FunctionDeclaration) {
if (!hoistedFunctionDeclarations) {
@@ -5121,12 +5262,13 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
// }
emitVariableDeclarationsForImports();
writeLine();
hoistTopLevelVariableAndFunctionDeclarations(node);
var exportedDeclarations = processTopLevelVariableAndFunctionDeclarations(node);
let exportStarFunction = emitLocalStorageForExportedNamesIfNecessary(exportedDeclarations)
writeLine();
write("return {");
increaseIndent();
writeLine();
emitSetters();
emitSetters(exportStarFunction);
writeLine();
emitExecute(node, startIndex);
emitTempDeclarations(/*newLine*/ true)
@@ -5135,7 +5277,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
write("}"); // return
}
function emitSetters() {
function emitSetters(exportStarFunction: string) {
write("setters:[");
for (let i = 0; i < externalImports.length; ++i) {
if (i !== 0) {
@@ -5163,7 +5305,7 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
increaseIndent();
writeLine();
// save import into the local
write(`${importVariableName} = ${parameterName}`);
write(`${importVariableName} = ${parameterName};`);
writeLine();
let defaultName =
@@ -5228,9 +5370,8 @@ if (typeof __param !== "function") __param = function (paramIndex, decorator) {
writeLine();
// export * from 'foo'
// emit as:
// for (var n in _foo) exports(n, _foo[n]);
// NOTE: it is safe to use name 'n' since parameter name always starts with '_'
write(`for (var n in ${parameterName}) ${exportFunctionForFile}(n, ${parameterName}[n]);`);
// exportStar(_foo);
write(`${exportStarFunction}(${parameterName});`);
}
writeLine();
+22 -12
View File
@@ -308,9 +308,9 @@ module ts {
return visitNode(cbNode, (<ComputedPropertyName>node).expression);
case SyntaxKind.HeritageClause:
return visitNodes(cbNodes, (<HeritageClause>node).types);
case SyntaxKind.HeritageClauseElement:
return visitNode(cbNode, (<HeritageClauseElement>node).expression) ||
visitNodes(cbNodes, (<HeritageClauseElement>node).typeArguments);
case SyntaxKind.ExpressionWithTypeArguments:
return visitNode(cbNode, (<ExpressionWithTypeArguments>node).expression) ||
visitNodes(cbNodes, (<ExpressionWithTypeArguments>node).typeArguments);
case SyntaxKind.ExternalModuleReference:
return visitNode(cbNode, (<ExternalModuleReference>node).expression);
case SyntaxKind.MissingDeclaration:
@@ -3704,6 +3704,7 @@ module ts {
return !isConstEnum;
case SyntaxKind.InterfaceKeyword:
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
case SyntaxKind.EnumKeyword:
case SyntaxKind.TypeKeyword:
// When followed by an identifier, these do not start a statement but might
@@ -4283,15 +4284,15 @@ module ts {
let node = <HeritageClause>createNode(SyntaxKind.HeritageClause);
node.token = token;
nextToken();
node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseHeritageClauseElement);
node.types = parseDelimitedList(ParsingContext.HeritageClauseElement, parseExpressionWithTypeArguments);
return finishNode(node);
}
return undefined;
}
function parseHeritageClauseElement(): HeritageClauseElement {
let node = <HeritageClauseElement>createNode(SyntaxKind.HeritageClauseElement);
function parseExpressionWithTypeArguments(): ExpressionWithTypeArguments {
let node = <ExpressionWithTypeArguments>createNode(SyntaxKind.ExpressionWithTypeArguments);
node.expression = parseLeftHandSideExpressionOrHigher();
if (token === SyntaxKind.LessThanToken) {
node.typeArguments = parseBracketedList(ParsingContext.TypeArguments, parseType, SyntaxKind.LessThanToken, SyntaxKind.GreaterThanToken);
@@ -4371,14 +4372,14 @@ module ts {
return finishNode(node);
}
function parseInternalModuleTail(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
function parseModuleOrNamespaceDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray, flags: NodeFlags): ModuleDeclaration {
let node = <ModuleDeclaration>createNode(SyntaxKind.ModuleDeclaration, fullStart);
node.decorators = decorators;
setModifiers(node, modifiers);
node.flags |= flags;
node.name = parseIdentifier();
node.body = parseOptional(SyntaxKind.DotToken)
? parseInternalModuleTail(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
? parseModuleOrNamespaceDeclaration(getNodePos(), /*decorators*/ undefined, /*modifiers:*/undefined, NodeFlags.Export)
: parseModuleBlock();
return finishNode(node);
}
@@ -4393,10 +4394,17 @@ module ts {
}
function parseModuleDeclaration(fullStart: number, decorators: NodeArray<Decorator>, modifiers: ModifiersArray): ModuleDeclaration {
parseExpected(SyntaxKind.ModuleKeyword);
return token === SyntaxKind.StringLiteral
? parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers)
: parseInternalModuleTail(fullStart, decorators, modifiers, modifiers ? modifiers.flags : 0);
let flags = modifiers ? modifiers.flags : 0;
if (parseOptional(SyntaxKind.NamespaceKeyword)) {
flags |= NodeFlags.Namespace;
}
else {
parseExpected(SyntaxKind.ModuleKeyword);
if (token === SyntaxKind.StringLiteral) {
return parseAmbientExternalModuleDeclaration(fullStart, decorators, modifiers);
}
}
return parseModuleOrNamespaceDeclaration(fullStart, decorators, modifiers, flags);
}
function isExternalModuleReference() {
@@ -4631,6 +4639,7 @@ module ts {
// Not true keywords so ensure an identifier follows or is string literal or asterisk or open brace
return lookAhead(nextTokenCanFollowImportKeyword);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
// Not a true keyword so ensure an identifier or string literal follows
return lookAhead(nextTokenIsIdentifierOrKeywordOrStringLiteral);
case SyntaxKind.ExportKeyword:
@@ -4715,6 +4724,7 @@ module ts {
case SyntaxKind.EnumKeyword:
return parseEnumDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ModuleKeyword:
case SyntaxKind.NamespaceKeyword:
return parseModuleDeclaration(fullStart, decorators, modifiers);
case SyntaxKind.ImportKeyword:
return parseImportDeclarationOrImportEqualsDeclaration(fullStart, decorators, modifiers);
+6 -6
View File
@@ -102,11 +102,11 @@ module ts {
};
}
export function getPreEmitDiagnostics(program: Program): Diagnostic[] {
let diagnostics = program.getSyntacticDiagnostics().concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics());
export function getPreEmitDiagnostics(program: Program, sourceFile?: SourceFile): Diagnostic[] {
let diagnostics = program.getSyntacticDiagnostics(sourceFile).concat(program.getGlobalDiagnostics()).concat(program.getSemanticDiagnostics(sourceFile));
if (program.getCompilerOptions().declaration) {
diagnostics.concat(program.getDeclarationDiagnostics());
diagnostics.concat(program.getDeclarationDiagnostics(sourceFile));
}
return sortAndDeduplicateDiagnostics(diagnostics);
@@ -575,18 +575,18 @@ module ts {
let firstNonExternalModuleSourceFile = forEach(files, f => !isExternalModule(f) && !isDeclarationFile(f) ? f : undefined);
if (firstNonExternalModuleSourceFile) {
let span = getErrorSpanForNode(firstNonExternalModuleSourceFile, firstNonExternalModuleSourceFile);
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_non_external_modules_when_the_separateCompilation_flag_is_provided));
diagnostics.add(createFileDiagnostic(firstNonExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_namespaces_when_the_separateCompilation_flag_is_provided));
}
}
else if (firstExternalModuleSourceFile && languageVersion < ScriptTarget.ES6 && !options.module) {
// We cannot use createDiagnosticFromNode because nodes do not have parents yet
let span = getErrorSpanForNode(firstExternalModuleSourceFile, firstExternalModuleSourceFile.externalModuleIndicator);
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_external_modules_unless_the_module_flag_is_provided));
diagnostics.add(createFileDiagnostic(firstExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_unless_the_module_flag_is_provided));
}
// Cannot specify module gen target when in es6 or above
if (options.module && languageVersion >= ScriptTarget.ES6) {
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_external_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
diagnostics.add(createCompilerDiagnostic(Diagnostics.Cannot_compile_modules_into_commonjs_amd_system_or_umd_when_targeting_ES6_or_higher));
}
// there has to be common source directory if user specified --outdir || --sourceRoot
+1
View File
@@ -76,6 +76,7 @@ module ts {
"interface": SyntaxKind.InterfaceKeyword,
"let": SyntaxKind.LetKeyword,
"module": SyntaxKind.ModuleKeyword,
"namespace": SyntaxKind.NamespaceKeyword,
"new": SyntaxKind.NewKeyword,
"null": SyntaxKind.NullKeyword,
"number": SyntaxKind.NumberKeyword,
+7 -5
View File
@@ -138,6 +138,7 @@ module ts {
DeclareKeyword,
GetKeyword,
ModuleKeyword,
NamespaceKeyword,
RequireKeyword,
NumberKeyword,
SetKeyword,
@@ -205,9 +206,9 @@ module ts {
SpreadElementExpression,
ClassExpression,
OmittedExpression,
ExpressionWithTypeArguments,
// Misc
TemplateSpan,
HeritageClauseElement,
SemicolonClassElement,
// Element
Block,
@@ -312,8 +313,9 @@ module ts {
DeclarationFile = 0x00000800, // Node is a .d.ts file
Let = 0x00001000, // Variable declaration
Const = 0x00002000, // Variable declaration
OctalLiteral = 0x00004000,
ExportContext = 0x00008000, // Export context (initialized by binding)
OctalLiteral = 0x00004000, // Octal numeric literal
Namespace = 0x00008000, // Namespace declaration
ExportContext = 0x00010000, // Export context (initialized by binding)
Modifier = Export | Ambient | Public | Private | Protected | Static | Default,
AccessibilityModifier = Public | Private | Protected,
@@ -739,7 +741,7 @@ module ts {
arguments: NodeArray<Expression>;
}
export interface HeritageClauseElement extends TypeNode {
export interface ExpressionWithTypeArguments extends TypeNode {
expression: LeftHandSideExpression;
typeArguments?: NodeArray<TypeNode>;
}
@@ -891,7 +893,7 @@ module ts {
export interface HeritageClause extends Node {
token: SyntaxKind;
types?: NodeArray<HeritageClauseElement>;
types?: NodeArray<ExpressionWithTypeArguments>;
}
export interface TypeAliasDeclaration extends Declaration, ModuleElement {
+4 -4
View File
@@ -1671,16 +1671,16 @@ module ts {
// Returns false if this heritage clause element's expression contains something unsupported
// (i.e. not a name or dotted name).
export function isSupportedHeritageClauseElement(node: HeritageClauseElement): boolean {
return isSupportedHeritageClauseElementExpression(node.expression);
export function isSupportedExpressionWithTypeArguments(node: ExpressionWithTypeArguments): boolean {
return isSupportedExpressionWithTypeArgumentsRest(node.expression);
}
function isSupportedHeritageClauseElementExpression(node: Expression): boolean {
function isSupportedExpressionWithTypeArgumentsRest(node: Expression): boolean {
if (node.kind === SyntaxKind.Identifier) {
return true;
}
else if (node.kind === SyntaxKind.PropertyAccessExpression) {
return isSupportedHeritageClauseElementExpression((<PropertyAccessExpression>node).expression);
return isSupportedExpressionWithTypeArgumentsRest((<PropertyAccessExpression>node).expression);
}
else {
return false;
+34 -10
View File
@@ -2192,38 +2192,62 @@ module FourSlash {
xmlData.push(xml);
}
// We don't want to recompile 'fourslash.ts' for every test, so
// here we cache the JS output and reuse it for every test.
let fourslashJsOutput: string;
{
let host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined }],
(fn, contents) => fourslashJsOutput = contents,
ts.ScriptTarget.Latest,
ts.sys.useCaseSensitiveFileNames);
let program = ts.createProgram([Harness.Compiler.fourslashFileName], { noResolve: true, target: ts.ScriptTarget.ES3 }, host);
program.emit(host.getSourceFile(Harness.Compiler.fourslashFileName, ts.ScriptTarget.ES3));
}
export function runFourSlashTestContent(basePath: string, testType: FourSlashTestType, content: string, fileName: string): TestXmlData {
// Parse out the files and their metadata
var testData = parseTestData(basePath, content, fileName);
let testData = parseTestData(basePath, content, fileName);
currentTestState = new TestState(basePath, testType, testData);
var result = '';
var host = Harness.Compiler.createCompilerHost([{ unitName: Harness.Compiler.fourslashFileName, content: undefined },
{ unitName: fileName, content: content }],
let result = '';
let host = Harness.Compiler.createCompilerHost(
[
{ unitName: Harness.Compiler.fourslashFileName, content: undefined },
{ unitName: fileName, content: content }
],
(fn, contents) => result = contents,
ts.ScriptTarget.Latest,
ts.sys.useCaseSensitiveFileNames);
// TODO (drosen): We need to enforce checking on these tests.
var program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
var diagnostics = ts.getPreEmitDiagnostics(program);
let program = ts.createProgram([Harness.Compiler.fourslashFileName, fileName], { out: "fourslashTestOutput.js", noResolve: true, target: ts.ScriptTarget.ES3 }, host);
let sourceFile = host.getSourceFile(fileName, ts.ScriptTarget.ES3);
let diagnostics = ts.getPreEmitDiagnostics(program, sourceFile);
if (diagnostics.length > 0) {
throw new Error('Error compiling ' + fileName + ': ' +
diagnostics.map(e => ts.flattenDiagnosticMessageText(e.messageText, ts.sys.newLine)).join('\r\n'));
}
program.emit();
program.emit(sourceFile);
result = result || ''; // Might have an empty fourslash file
result = fourslashJsOutput + "\r\n" + result;
// Compile and execute the test
try {
eval(result);
} catch (err) {
}
catch (err) {
// Debugging: FourSlash.currentTestState.printCurrentFileState();
throw err;
}
var xmlData = currentTestState.getTestXmlData();
let xmlData = currentTestState.getTestXmlData();
xmlData.originalName = fileName;
return xmlData;
}
+9
View File
@@ -241,6 +241,9 @@ module Harness.LanguageService {
class ClassifierShimProxy implements ts.Classifier {
constructor(private shim: ts.ClassifierShim) {
}
getEncodedLexicalClassifications(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.Classifications {
throw new Error("NYI");
}
getClassificationsForLine(text: string, lexState: ts.EndOfLineState, classifyKeywordsInGenerics?: boolean): ts.ClassificationResult {
var result = this.shim.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics).split('\n');
var entries: ts.ClassificationInfo[] = [];
@@ -306,6 +309,12 @@ module Harness.LanguageService {
getSemanticClassifications(fileName: string, span: ts.TextSpan): ts.ClassifiedSpan[] {
return unwrapJSONCallResult(this.shim.getSemanticClassifications(fileName, span.start, span.length));
}
getEncodedSyntacticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications {
return unwrapJSONCallResult(this.shim.getEncodedSyntacticClassifications(fileName, span.start, span.length));
}
getEncodedSemanticClassifications(fileName: string, span: ts.TextSpan): ts.Classifications {
return unwrapJSONCallResult(this.shim.getEncodedSemanticClassifications(fileName, span.start, span.length));
}
getCompletionsAtPosition(fileName: string, position: number): ts.CompletionInfo {
return unwrapJSONCallResult(this.shim.getCompletionsAtPosition(fileName, position));
}
+36 -76
View File
@@ -331,7 +331,7 @@ class ProjectRunner extends RunnerBase {
var name = 'Compiling project for ' + testCase.scenario + ': testcase ' + testCaseFileName;
describe(name, () => {
function verifyCompilerResults(compilerResult: BatchCompileProjectTestCaseResult) {
function verifyCompilerResults(moduleKind: ts.ModuleKind) {
function getCompilerResolutionInfo() {
var resolutionInfo: ProjectRunnerTestCaseResolutionInfo = {
scenario: testCase.scenario,
@@ -356,23 +356,33 @@ class ProjectRunner extends RunnerBase {
return resolutionInfo;
}
it('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
var compilerResult: BatchCompileProjectTestCaseResult;
it(name + ": " + moduleNameToString(moduleKind) , () => {
// Compile using node
compilerResult = batchCompilerProjectTestCase(moduleKind);
});
it('Resolution information of (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('Resolution information of (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.json', () => {
return JSON.stringify(getCompilerResolutionInfo(), undefined, " ");
});
});
if (compilerResult.errors.length) {
it('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
it('Errors for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
if (compilerResult.errors.length) {
Harness.Baseline.runBaseline('Errors for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.errors.txt', () => {
return getErrorsBaseline(compilerResult);
});
});
}
}
});
it('Baseline of emitted result (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
if (testCase.baselineCheck) {
ts.forEach(compilerResult.outputFiles, outputFile => {
if (testCase.baselineCheck) {
ts.forEach(compilerResult.outputFiles, outputFile => {
it('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('Baseline of emitted result (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + outputFile.fileName, () => {
try {
return ts.sys.readFile(getProjectOutputFolder(outputFile.fileName, compilerResult.moduleKind));
@@ -382,89 +392,39 @@ class ProjectRunner extends RunnerBase {
}
});
});
});
}
});
it('SourceMapRecord for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
if (compilerResult.sourceMapData) {
it('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.sourcemap.txt', () => {
return Harness.SourceMapRecoder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
ts.filter(compilerResult.outputFiles, outputFile => Harness.Compiler.isJS(outputFile.emittedFileName)));
});
Harness.Baseline.runBaseline('SourceMapRecord for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.sourcemap.txt', () => {
return Harness.SourceMapRecoder.getSourceMapRecord(compilerResult.sourceMapData, compilerResult.program,
ts.filter(compilerResult.outputFiles, outputFile => Harness.Compiler.isJS(outputFile.emittedFileName)));
});
}
});
// Verify that all the generated .d.ts files compile
// Verify that all the generated .d.ts files compile
it('Errors in generated Dts files for (' + moduleNameToString(moduleKind) + '): ' + testCaseFileName, () => {
if (!compilerResult.errors.length && testCase.declaration) {
var dTsCompileResult = compileCompileDTsFiles(compilerResult);
if (dTsCompileResult.errors.length) {
it('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, () => {
Harness.Baseline.runBaseline('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.dts.errors.txt', () => {
return getErrorsBaseline(dTsCompileResult);
});
Harness.Baseline.runBaseline('Errors in generated Dts files for (' + moduleNameToString(compilerResult.moduleKind) + '): ' + testCaseFileName, getBaselineFolder(compilerResult.moduleKind) + testCaseJustName + '.dts.errors.txt', () => {
return getErrorsBaseline(dTsCompileResult);
});
}
}
}
}
var nodeCompilerResult: BatchCompileProjectTestCaseResult;
var amdCompilerResult: BatchCompileProjectTestCaseResult;
it(name + ": node", () => {
// Compile using node
nodeCompilerResult = batchCompilerProjectTestCase(ts.ModuleKind.CommonJS);
verifyCompilerResults(nodeCompilerResult);
});
it(name + ": amd", () => {
// Compile using amd
amdCompilerResult = batchCompilerProjectTestCase(ts.ModuleKind.AMD);
verifyCompilerResults(amdCompilerResult);
});
if (testCase.runTest) {
it(name + ": runTest", () => {
if (!nodeCompilerResult || !amdCompilerResult) {
return;
}
//TODO(ryanca/danquirk): Either support this or remove this option from the interface as well as test case json files
// Node results
assert.isTrue(!nodeCompilerResult.nonSubfolderDiskFiles, "Cant run test case that generates parent folders/absolute path");
//it("runs without error: (" + moduleNameToString(nodeCompilerResult.moduleKind) + ')', function (done: any) {
// Exec.exec("node.exe", ['"' + baseLineLocalPath(nodeCompilerResult.outputFiles[0].diskRelativeName, nodeCompilerResult.moduleKind) + '"'], function (res) {
// Harness.Assert.equal(res.stdout, "");
// Harness.Assert.equal(res.stderr, "");
// done();
// })
//});
// Amd results
assert.isTrue(!amdCompilerResult.nonSubfolderDiskFiles, "Cant run test case that generates parent folders/absolute path");
//var amdDriverTemplate = "var requirejs = require('../r.js');\n\n" +
// "requirejs.config({\n" +
// " nodeRequire: require\n" +
// "});\n\n" +
// "requirejs(['{0}'],\n" +
// "function ({0}) {\n" +
// "});";
//var moduleName = baseLineLocalPath(amdCompilerResult.outputFiles[0].diskRelativeName, amdCompilerResult.moduleKind).replace(/\.js$/, "");
//sys.writeFile(testCase.projectRoot + '/driver.js', amdDriverTemplate.replace(/\{0}/g, moduleName));
//it("runs without error (" + moduleNameToString(amdCompilerResult.moduleKind) + ')', function (done: any) {
// Exec.exec("node.exe", ['"' + testCase.projectRoot + '/driver.js"'], function (res) {
// Harness.Assert.equal(res.stdout, "");
// Harness.Assert.equal(res.stderr, "");
// done();
// })
//});
});
after(() => {
nodeCompilerResult = undefined;
amdCompilerResult = undefined;
compilerResult = undefined;
});
}
verifyCompilerResults(ts.ModuleKind.CommonJS);
verifyCompilerResults(ts.ModuleKind.AMD);
after(() => {
// Mocha holds onto the closure environment of the describe callback even after the test is done.
// Therefore we have to clean out large objects after the test is done.
-8
View File
@@ -20,9 +20,6 @@
/// <reference path='rwcRunner.ts' />
function runTests(runners: RunnerBase[]) {
if (reverse) {
runners = runners.reverse();
}
for (var i = iterations; i > 0; i--) {
for (var j = 0; j < runners.length; j++) {
runners[j].initializeTests();
@@ -31,8 +28,6 @@ function runTests(runners: RunnerBase[]) {
}
var runners: RunnerBase[] = [];
global.runners = runners;
var reverse: boolean = false;
var iterations: number = 1;
// users can define tests to run in mytest.config that will override cmd line args, otherwise use cmd line args (test.config), otherwise no options
@@ -78,9 +73,6 @@ if (testConfigFile !== '') {
case 'test262':
runners.push(new Test262BaselineRunner());
break;
case 'reverse':
reverse = true;
break;
}
}
}
+8
View File
@@ -12332,11 +12332,13 @@ interface DocumentEvent {
createEvent(eventInterface:"CloseEvent"): CloseEvent;
createEvent(eventInterface:"CommandEvent"): CommandEvent;
createEvent(eventInterface:"CompositionEvent"): CompositionEvent;
createEvent(eventInterface: "CustomEvent"): CustomEvent;
createEvent(eventInterface:"DeviceMotionEvent"): DeviceMotionEvent;
createEvent(eventInterface:"DeviceOrientationEvent"): DeviceOrientationEvent;
createEvent(eventInterface:"DragEvent"): DragEvent;
createEvent(eventInterface:"ErrorEvent"): ErrorEvent;
createEvent(eventInterface:"Event"): Event;
createEvent(eventInterface:"Events"): Event;
createEvent(eventInterface:"FocusEvent"): FocusEvent;
createEvent(eventInterface:"GamepadEvent"): GamepadEvent;
createEvent(eventInterface:"HashChangeEvent"): HashChangeEvent;
@@ -12351,8 +12353,12 @@ interface DocumentEvent {
createEvent(eventInterface:"MSSiteModeEvent"): MSSiteModeEvent;
createEvent(eventInterface:"MessageEvent"): MessageEvent;
createEvent(eventInterface:"MouseEvent"): MouseEvent;
createEvent(eventInterface:"MouseEvents"): MouseEvent;
createEvent(eventInterface:"MouseWheelEvent"): MouseWheelEvent;
createEvent(eventInterface:"MSGestureEvent"): MSGestureEvent;
createEvent(eventInterface:"MSPointerEvent"): MSPointerEvent;
createEvent(eventInterface:"MutationEvent"): MutationEvent;
createEvent(eventInterface:"MutationEvents"): MutationEvent;
createEvent(eventInterface:"NavigationCompletedEvent"): NavigationCompletedEvent;
createEvent(eventInterface:"NavigationEvent"): NavigationEvent;
createEvent(eventInterface:"NavigationEventWithReferrer"): NavigationEventWithReferrer;
@@ -12363,6 +12369,7 @@ interface DocumentEvent {
createEvent(eventInterface:"PopStateEvent"): PopStateEvent;
createEvent(eventInterface:"ProgressEvent"): ProgressEvent;
createEvent(eventInterface:"SVGZoomEvent"): SVGZoomEvent;
createEvent(eventInterface:"SVGZoomEvents"): SVGZoomEvent;
createEvent(eventInterface:"ScriptNotifyEvent"): ScriptNotifyEvent;
createEvent(eventInterface:"StorageEvent"): StorageEvent;
createEvent(eventInterface:"TextEvent"): TextEvent;
@@ -12370,6 +12377,7 @@ interface DocumentEvent {
createEvent(eventInterface:"TrackEvent"): TrackEvent;
createEvent(eventInterface:"TransitionEvent"): TransitionEvent;
createEvent(eventInterface:"UIEvent"): UIEvent;
createEvent(eventInterface:"UIEvents"): UIEvent;
createEvent(eventInterface:"UnviewableContentIdentifiedEvent"): UnviewableContentIdentifiedEvent;
createEvent(eventInterface:"WebGLContextEvent"): WebGLContextEvent;
createEvent(eventInterface:"WheelEvent"): WheelEvent;
+133
View File
@@ -45,6 +45,139 @@ interface ArrayBufferView {
byteOffset: number;
}
interface DataView {
buffer: ArrayBuffer;
byteLength: number;
byteOffset: number;
/**
* Gets the Float32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Float64 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getFloat64(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt8(byteOffset: number): number;
/**
* Gets the Int16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Int32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getInt32(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint8 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint8(byteOffset: number): number;
/**
* Gets the Uint16 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint16(byteOffset: number, littleEndian: boolean): number;
/**
* Gets the Uint32 value at the specified byte offset from the start of the view. There is
* no alignment constraint; multi-byte values may be fetched from any offset.
* @param byteOffset The place in the buffer at which the value should be retrieved.
*/
getUint32(byteOffset: number, littleEndian: boolean): number;
/**
* Stores an Float32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Float64 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setFloat64(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setInt8(byteOffset: number, value: number): void;
/**
* Stores an Int16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Int32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setInt32(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint8 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
*/
setUint8(byteOffset: number, value: number): void;
/**
* Stores an Uint16 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint16(byteOffset: number, value: number, littleEndian: boolean): void;
/**
* Stores an Uint32 value at the specified byte offset from the start of the view.
* @param byteOffset The place in the buffer at which the value should be set.
* @param value The value to set.
* @param littleEndian If false or undefined, a big-endian value should be written,
* otherwise a little-endian value should be written.
*/
setUint32(byteOffset: number, value: number, littleEndian: boolean): void;
}
interface DataViewConstructor {
new (buffer: ArrayBuffer, byteOffset?: number, byteLength?: number): DataView;
}
declare var DataView: DataViewConstructor;
/**
* A typed array of 8-bit integer values. The contents are initialized to 0. If the requested
* number of bytes could not be allocated an exception is raised.
+8
View File
@@ -533,6 +533,14 @@ module ts.server {
throw new Error("Not Implemented Yet.");
}
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications {
throw new Error("Not Implemented Yet.");
}
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications {
throw new Error("Not Implemented Yet.");
}
getProgram(): Program {
throw new Error("SourceFile objects are not serializable through the server protocol.");
}
+1 -1
View File
@@ -312,7 +312,7 @@ module ts.formatting {
this.NoSpaceAfterModuleImport = new Rule(RuleDescriptor.create2(Shared.TokenRange.FromTokens([SyntaxKind.ModuleKeyword, SyntaxKind.RequireKeyword]), SyntaxKind.OpenParenToken), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Delete));
// Add a space around certain TypeScript keywords
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceAfterCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.FromTokens([SyntaxKind.ClassKeyword, SyntaxKind.DeclareKeyword, SyntaxKind.EnumKeyword, SyntaxKind.ExportKeyword, SyntaxKind.ExtendsKeyword, SyntaxKind.GetKeyword, SyntaxKind.ImplementsKeyword, SyntaxKind.ImportKeyword, SyntaxKind.InterfaceKeyword, SyntaxKind.ModuleKeyword, SyntaxKind.NamespaceKeyword, SyntaxKind.PrivateKeyword, SyntaxKind.PublicKeyword, SyntaxKind.SetKeyword, SyntaxKind.StaticKeyword]), Shared.TokenRange.Any), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
this.SpaceBeforeCertainTypeScriptKeywords = new Rule(RuleDescriptor.create4(Shared.TokenRange.Any, Shared.TokenRange.FromTokens([SyntaxKind.ExtendsKeyword, SyntaxKind.ImplementsKeyword])), RuleOperation.create2(new RuleOperationContext(Rules.IsSameLineTokenContext), RuleAction.Space));
// Treat string literals in module names as identifiers, and add a space between the literal and the opening Brace braces, e.g.: module "m2" {
+255 -92
View File
@@ -197,6 +197,9 @@ module ts {
let list = createNode(SyntaxKind.SyntaxList, nodes.pos, nodes.end, NodeFlags.Synthetic, this);
list._children = [];
let pos = nodes.pos;
for (let node of nodes) {
if (pos < node.pos) {
pos = this.addSyntheticNodes(list._children, pos, node.pos);
@@ -969,9 +972,20 @@ module ts {
getSemanticDiagnostics(fileName: string): Diagnostic[];
getCompilerOptionsDiagnostics(): Diagnostic[];
/**
* @deprecated Use getEncodedSyntacticClassifications instead.
*/
getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
/**
* @deprecated Use getEncodedSemanticClassifications instead.
*/
getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[];
// Encoded as triples of [start, length, ClassificationType].
getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications;
getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications;
getCompletionsAtPosition(fileName: string, position: number): CompletionInfo;
getCompletionEntryDetails(fileName: string, position: number, entryName: string): CompletionEntryDetails;
@@ -1015,6 +1029,11 @@ module ts {
dispose(): void;
}
export interface Classifications {
spans: number[],
endOfLineState: EndOfLineState
}
export interface ClassifiedSpan {
textSpan: TextSpan;
classificationType: string; // ClassificationTypeNames
@@ -1258,7 +1277,7 @@ module ts {
}
export const enum EndOfLineState {
Start,
None,
InMultiLineCommentTrivia,
InSingleQuoteStringLiteral,
InDoubleQuoteStringLiteral,
@@ -1308,8 +1327,10 @@ module ts {
* classifications which may be incorrectly categorized will be given
* back as Identifiers in order to allow the syntactic classifier to
* subsume the classification.
* @deprecated Use getLexicalClassifications instead.
*/
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult;
getEncodedLexicalClassifications(text: string, endOfLineState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications;
}
/**
@@ -1484,7 +1505,28 @@ module ts {
public static interfaceName = "interface name";
public static moduleName = "module name";
public static typeParameterName = "type parameter name";
public static typeAlias = "type alias name";
public static typeAliasName = "type alias name";
public static parameterName = "parameter name";
}
export const enum ClassificationType {
comment = 1,
identifier = 2,
keyword = 3,
numericLiteral = 4,
operator = 5,
stringLiteral = 6,
regularExpressionLiteral = 7,
whiteSpace = 8,
text = 9,
punctuation = 10,
className = 11,
enumName = 12,
interfaceName = 13,
moduleName = 14,
typeParameterName = 15,
typeAliasName = 16,
parameterName = 17
}
/// Language Service
@@ -2991,7 +3033,8 @@ module ts {
case SyntaxKind.OpenBracketToken:
return containingNodeKind === SyntaxKind.ArrayLiteralExpression; // [ |
case SyntaxKind.ModuleKeyword: // module |
case SyntaxKind.ModuleKeyword: // module |
case SyntaxKind.NamespaceKeyword: // namespace |
return true;
case SyntaxKind.DotToken:
@@ -3644,7 +3687,9 @@ module ts {
}
if (symbolFlags & SymbolFlags.Module) {
addNewLineIfDisplayPartsExist();
displayParts.push(keywordPart(SyntaxKind.ModuleKeyword));
let declaration = <ModuleDeclaration>getDeclarationOfKind(symbol, SyntaxKind.ModuleDeclaration);
let isNamespace = declaration && declaration.name && declaration.name.kind === SyntaxKind.Identifier;
displayParts.push(keywordPart(isNamespace ? SyntaxKind.NamespaceKeyword : SyntaxKind.ModuleKeyword));
displayParts.push(spacePart());
addFullSymbolName(symbol);
}
@@ -5370,7 +5415,7 @@ module ts {
}
return;
function getPropertySymbolFromTypeReference(typeReference: HeritageClauseElement) {
function getPropertySymbolFromTypeReference(typeReference: ExpressionWithTypeArguments) {
if (typeReference) {
let type = typeChecker.getTypeAtLocation(typeReference);
if (type) {
@@ -5631,7 +5676,7 @@ module ts {
node = node.parent;
}
return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.HeritageClauseElement;
return node.parent.kind === SyntaxKind.TypeReference || node.parent.kind === SyntaxKind.ExpressionWithTypeArguments;
}
function isNamespaceReference(node: Node): boolean {
@@ -5649,7 +5694,7 @@ module ts {
isLastClause = (<PropertyAccessExpression>root).name === node;
}
if (!isLastClause && root.parent.kind === SyntaxKind.HeritageClauseElement && root.parent.parent.kind === SyntaxKind.HeritageClause) {
if (!isLastClause && root.parent.kind === SyntaxKind.ExpressionWithTypeArguments && root.parent.parent.kind === SyntaxKind.HeritageClause) {
let decl = root.parent.parent.parent;
return (decl.kind === SyntaxKind.ClassDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ImplementsKeyword) ||
(decl.kind === SyntaxKind.InterfaceDeclaration && (<HeritageClause>root.parent.parent).token === SyntaxKind.ExtendsKeyword);
@@ -5801,35 +5846,45 @@ module ts {
return NavigationBar.getNavigationBarItems(sourceFile);
}
function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
function getSemanticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]{
return convertClassifications(getEncodedSemanticClassifications(fileName, span));
}
function getEncodedSemanticClassifications(fileName: string, span: TextSpan): Classifications {
synchronizeHostData();
let sourceFile = getValidSourceFile(fileName);
let typeChecker = program.getTypeChecker();
let result: ClassifiedSpan[] = [];
let result: number[] = [];
processNode(sourceFile);
return result;
return { spans: result, endOfLineState: EndOfLineState.None };
function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning) {
function pushClassification(start: number, length: number, type: ClassificationType) {
result.push(start);
result.push(length);
result.push(type);
}
function classifySymbol(symbol: Symbol, meaningAtPosition: SemanticMeaning): ClassificationType {
let flags = symbol.getFlags();
if (flags & SymbolFlags.Class) {
return ClassificationTypeNames.className;
return ClassificationType.className;
}
else if (flags & SymbolFlags.Enum) {
return ClassificationTypeNames.enumName;
return ClassificationType.enumName;
}
else if (flags & SymbolFlags.TypeAlias) {
return ClassificationTypeNames.typeAlias;
return ClassificationType.typeAliasName;
}
else if (meaningAtPosition & SemanticMeaning.Type) {
if (flags & SymbolFlags.Interface) {
return ClassificationTypeNames.interfaceName;
return ClassificationType.interfaceName;
}
else if (flags & SymbolFlags.TypeParameter) {
return ClassificationTypeNames.typeParameterName;
return ClassificationType.typeParameterName;
}
}
else if (flags & SymbolFlags.Module) {
@@ -5838,7 +5893,7 @@ module ts {
// - There exists a module declaration which actually impacts the value side.
if (meaningAtPosition & SemanticMeaning.Namespace ||
(meaningAtPosition & SemanticMeaning.Value && hasValueSideModule(symbol))) {
return ClassificationTypeNames.moduleName;
return ClassificationType.moduleName;
}
}
@@ -5862,10 +5917,7 @@ module ts {
if (symbol) {
let type = classifySymbol(symbol, getMeaningFromLocation(node));
if (type) {
result.push({
textSpan: createTextSpan(node.getStart(), node.getWidth()),
classificationType: type
});
pushClassification(node.getStart(), node.getWidth(), type);
}
}
}
@@ -5875,7 +5927,46 @@ module ts {
}
}
function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[] {
function getClassificationTypeName(type: ClassificationType) {
switch (type) {
case ClassificationType.comment: return ClassificationTypeNames.comment;
case ClassificationType.identifier: return ClassificationTypeNames.identifier;
case ClassificationType.keyword: return ClassificationTypeNames.keyword;
case ClassificationType.numericLiteral: return ClassificationTypeNames.numericLiteral;
case ClassificationType.operator: return ClassificationTypeNames.operator;
case ClassificationType.stringLiteral: return ClassificationTypeNames.stringLiteral;
case ClassificationType.whiteSpace: return ClassificationTypeNames.whiteSpace;
case ClassificationType.text: return ClassificationTypeNames.text;
case ClassificationType.punctuation: return ClassificationTypeNames.punctuation;
case ClassificationType.className: return ClassificationTypeNames.className;
case ClassificationType.enumName: return ClassificationTypeNames.enumName;
case ClassificationType.interfaceName: return ClassificationTypeNames.interfaceName;
case ClassificationType.moduleName: return ClassificationTypeNames.moduleName;
case ClassificationType.typeParameterName: return ClassificationTypeNames.typeParameterName;
case ClassificationType.typeAliasName: return ClassificationTypeNames.typeAliasName;
case ClassificationType.parameterName: return ClassificationTypeNames.parameterName;
}
}
function convertClassifications(classifications: Classifications): ClassifiedSpan[] {
Debug.assert(classifications.spans.length % 3 === 0);
let dense = classifications.spans;
let result: ClassifiedSpan[] = [];
for (let i = 0, n = dense.length; i < n; i += 3) {
result.push({
textSpan: createTextSpan(dense[i], dense[i + 1]),
classificationType: getClassificationTypeName(dense[i + 2])
});
}
return result;
}
function getSyntacticClassifications(fileName: string, span: TextSpan): ClassifiedSpan[]{
return convertClassifications(getEncodedSyntacticClassifications(fileName, span));
}
function getEncodedSyntacticClassifications(fileName: string, span: TextSpan): Classifications {
// doesn't use compiler - no need to synchronize with host
let sourceFile = syntaxTreeCache.getCurrentSourceFile(fileName);
@@ -5883,10 +5974,16 @@ module ts {
let triviaScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text);
let mergeConflictScanner = createScanner(ScriptTarget.Latest, /*skipTrivia:*/ false, sourceFile.text);
let result: ClassifiedSpan[] = [];
let result: number[] = [];
processElement(sourceFile);
return result;
return { spans: result, endOfLineState: EndOfLineState.None };
function pushClassification(start: number, length: number, type: ClassificationType) {
result.push(start);
result.push(length);
result.push(type);
}
function classifyLeadingTrivia(token: Node): void {
let tokenStart = skipTrivia(sourceFile.text, token.pos, /*stopAfterLineBreak:*/ false);
@@ -5909,10 +6006,7 @@ module ts {
if (isComment(kind)) {
// Simple comment. Just add as is.
result.push({
textSpan: createTextSpan(start, width),
classificationType: ClassificationTypeNames.comment
})
pushClassification(start, width, ClassificationType.comment);
continue;
}
@@ -5923,10 +6017,7 @@ module ts {
// for the <<<<<<< and >>>>>>> markers, we just add them in as comments
// in the classification stream.
if (ch === CharacterCodes.lessThan || ch === CharacterCodes.greaterThan) {
result.push({
textSpan: createTextSpan(start, width),
classificationType: ClassificationTypeNames.comment
});
pushClassification(start, width, ClassificationType.comment);
continue;
}
@@ -5947,11 +6038,7 @@ module ts {
break;
}
}
result.push({
textSpan: createTextSpanFromBounds(start, i),
classificationType: ClassificationTypeNames.comment
});
pushClassification(start, i - start, ClassificationType.comment);
mergeConflictScanner.setTextPos(i);
while (mergeConflictScanner.getTextPos() < end) {
@@ -5966,10 +6053,7 @@ module ts {
let type = classifyTokenType(tokenKind);
if (type) {
result.push({
textSpan: createTextSpanFromBounds(start, end),
classificationType: type
});
pushClassification(start, end - start, type);
}
}
@@ -5979,10 +6063,7 @@ module ts {
if (token.getWidth() > 0) {
let type = classifyTokenType(token.kind, token);
if (type) {
result.push({
textSpan: createTextSpan(token.getStart(), token.getWidth()),
classificationType: type
});
pushClassification(token.getStart(), token.getWidth(), type);
}
}
}
@@ -5990,9 +6071,9 @@ module ts {
// for accurate classification, the actual token should be passed in. however, for
// cases like 'disabled merge code' classification, we just get the token kind and
// classify based on that instead.
function classifyTokenType(tokenKind: SyntaxKind, token?: Node): string {
function classifyTokenType(tokenKind: SyntaxKind, token?: Node): ClassificationType {
if (isKeyword(tokenKind)) {
return ClassificationTypeNames.keyword;
return ClassificationType.keyword;
}
// Special case < and > If they appear in a generic context they are punctuation,
@@ -6001,7 +6082,7 @@ module ts {
// If the node owning the token has a type argument list or type parameter list, then
// we can effectively assume that a '<' and '>' belong to those lists.
if (token && getTypeArgumentOrTypeParameterList(token.parent)) {
return ClassificationTypeNames.punctuation;
return ClassificationType.punctuation;
}
}
@@ -6012,7 +6093,7 @@ module ts {
if (token.parent.kind === SyntaxKind.VariableDeclaration ||
token.parent.kind === SyntaxKind.PropertyDeclaration ||
token.parent.kind === SyntaxKind.Parameter) {
return ClassificationTypeNames.operator;
return ClassificationType.operator;
}
}
@@ -6020,58 +6101,64 @@ module ts {
token.parent.kind === SyntaxKind.PrefixUnaryExpression ||
token.parent.kind === SyntaxKind.PostfixUnaryExpression ||
token.parent.kind === SyntaxKind.ConditionalExpression) {
return ClassificationTypeNames.operator;
return ClassificationType.operator;
}
}
return ClassificationTypeNames.punctuation;
return ClassificationType.punctuation;
}
else if (tokenKind === SyntaxKind.NumericLiteral) {
return ClassificationTypeNames.numericLiteral;
return ClassificationType.numericLiteral;
}
else if (tokenKind === SyntaxKind.StringLiteral) {
return ClassificationTypeNames.stringLiteral;
return ClassificationType.stringLiteral;
}
else if (tokenKind === SyntaxKind.RegularExpressionLiteral) {
// TODO: we should get another classification type for these literals.
return ClassificationTypeNames.stringLiteral;
return ClassificationType.stringLiteral;
}
else if (isTemplateLiteralKind(tokenKind)) {
// TODO (drosen): we should *also* get another classification type for these literals.
return ClassificationTypeNames.stringLiteral;
return ClassificationType.stringLiteral;
}
else if (tokenKind === SyntaxKind.Identifier) {
if (token) {
switch (token.parent.kind) {
case SyntaxKind.ClassDeclaration:
if ((<ClassDeclaration>token.parent).name === token) {
return ClassificationTypeNames.className;
return ClassificationType.className;
}
return;
case SyntaxKind.TypeParameter:
if ((<TypeParameterDeclaration>token.parent).name === token) {
return ClassificationTypeNames.typeParameterName;
return ClassificationType.typeParameterName;
}
return;
case SyntaxKind.InterfaceDeclaration:
if ((<InterfaceDeclaration>token.parent).name === token) {
return ClassificationTypeNames.interfaceName;
return ClassificationType.interfaceName;
}
return;
case SyntaxKind.EnumDeclaration:
if ((<EnumDeclaration>token.parent).name === token) {
return ClassificationTypeNames.enumName;
return ClassificationType.enumName;
}
return;
case SyntaxKind.ModuleDeclaration:
if ((<ModuleDeclaration>token.parent).name === token) {
return ClassificationTypeNames.moduleName;
return ClassificationType.moduleName;
}
return;
case SyntaxKind.Parameter:
if ((<ParameterDeclaration>token.parent).name === token) {
return ClassificationType.parameterName;
}
return;
}
}
return ClassificationTypeNames.text;
return ClassificationType.text;
}
}
@@ -6402,6 +6489,8 @@ module ts {
getCompilerOptionsDiagnostics,
getSyntacticClassifications,
getSemanticClassifications,
getEncodedSyntacticClassifications,
getEncodedSemanticClassifications,
getCompletionsAtPosition,
getCompletionEntryDetails,
getSignatureHelpItems,
@@ -6542,10 +6631,67 @@ module ts {
// if there are more cases we want the classifier to be better at.
return true;
}
function convertClassifications(classifications: Classifications, text: string): ClassificationResult {
var entries: ClassificationInfo[] = [];
let dense = classifications.spans;
let lastEnd = 0;
for (let i = 0, n = dense.length; i < n; i += 3) {
let start = dense[i];
let length = dense[i + 1];
let type = <ClassificationType>dense[i + 2];
// Make a whitespace entry between the last item and this one.
if (lastEnd >= 0) {
let whitespaceLength = start - lastEnd;
if (whitespaceLength > 0) {
entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace });
}
}
entries.push({ length, classification: convertClassification(type) });
lastEnd = start + length;
}
let whitespaceLength = text.length - lastEnd;
if (whitespaceLength > 0) {
entries.push({ length: whitespaceLength, classification: TokenClass.Whitespace });
}
return { entries, finalLexState: classifications.endOfLineState };
}
function convertClassification(type: ClassificationType): TokenClass {
switch (type) {
case ClassificationType.comment: return TokenClass.Comment;
case ClassificationType.keyword: return TokenClass.Keyword;
case ClassificationType.numericLiteral: return TokenClass.NumberLiteral;
case ClassificationType.operator: return TokenClass.Operator;
case ClassificationType.stringLiteral: return TokenClass.StringLiteral;
case ClassificationType.whiteSpace: return TokenClass.Whitespace;
case ClassificationType.punctuation: return TokenClass.Punctuation;
case ClassificationType.identifier:
case ClassificationType.className:
case ClassificationType.enumName:
case ClassificationType.interfaceName:
case ClassificationType.moduleName:
case ClassificationType.typeParameterName:
case ClassificationType.typeAliasName:
case ClassificationType.text:
case ClassificationType.parameterName:
default:
return TokenClass.Identifier;
}
}
function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult {
return convertClassifications(getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent), text);
}
// If there is a syntactic classifier ('syntacticClassifierAbsent' is false),
// we will be more conservative in order to avoid conflicting with the syntactic classifier.
function getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): ClassificationResult {
function getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent: boolean): Classifications {
let offset = 0;
let token = SyntaxKind.Unknown;
let lastNonTriviaToken = SyntaxKind.Unknown;
@@ -6588,9 +6734,9 @@ module ts {
scanner.setText(text);
let result: ClassificationResult = {
finalLexState: EndOfLineState.Start,
entries: []
let result: Classifications = {
endOfLineState: EndOfLineState.None,
spans: []
};
// We can run into an unfortunate interaction between the lexical and syntactic classifier
@@ -6703,7 +6849,7 @@ module ts {
let start = scanner.getTokenPos();
let end = scanner.getTextPos();
addResult(end - start, classFromKind(token));
addResult(start, end, classFromKind(token));
if (end >= text.length) {
if (token === SyntaxKind.StringLiteral) {
@@ -6720,7 +6866,7 @@ module ts {
// If we have an odd number of backslashes, then the multiline string is unclosed
if (numBackslashes & 1) {
let quoteChar = tokenText.charCodeAt(0);
result.finalLexState = quoteChar === CharacterCodes.doubleQuote
result.endOfLineState = quoteChar === CharacterCodes.doubleQuote
? EndOfLineState.InDoubleQuoteStringLiteral
: EndOfLineState.InSingleQuoteStringLiteral;
}
@@ -6729,16 +6875,16 @@ module ts {
else if (token === SyntaxKind.MultiLineCommentTrivia) {
// Check to see if the multiline comment was unclosed.
if (scanner.isUnterminated()) {
result.finalLexState = EndOfLineState.InMultiLineCommentTrivia;
result.endOfLineState = EndOfLineState.InMultiLineCommentTrivia;
}
}
else if (isTemplateLiteralKind(token)) {
if (scanner.isUnterminated()) {
if (token === SyntaxKind.TemplateTail) {
result.finalLexState = EndOfLineState.InTemplateMiddleOrTail;
result.endOfLineState = EndOfLineState.InTemplateMiddleOrTail;
}
else if (token === SyntaxKind.NoSubstitutionTemplateLiteral) {
result.finalLexState = EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate;
result.endOfLineState = EndOfLineState.InTemplateHeadOrNoSubstitutionTemplate;
}
else {
Debug.fail("Only 'NoSubstitutionTemplateLiteral's and 'TemplateTail's can be unterminated; got SyntaxKind #" + token);
@@ -6746,20 +6892,34 @@ module ts {
}
}
else if (templateStack.length > 0 && lastOrUndefined(templateStack) === SyntaxKind.TemplateHead) {
result.finalLexState = EndOfLineState.InTemplateSubstitutionPosition;
result.endOfLineState = EndOfLineState.InTemplateSubstitutionPosition;
}
}
}
function addResult(length: number, classification: TokenClass): void {
if (length > 0) {
// If this is the first classification we're adding to the list, then remove any
// offset we have if we were continuing a construct from the previous line.
if (result.entries.length === 0) {
length -= offset;
}
function addResult(start: number, end: number, classification: ClassificationType): void {
if (classification === ClassificationType.whiteSpace) {
// Don't bother with whitespace classifications. They're not needed.
return;
}
result.entries.push({ length: length, classification: classification });
if (start === 0 && offset > 0) {
// We're classifying the first token, and this was a case where we prepended
// text. We should consider the start of this token to be at the start of
// the original text.
start += offset;
}
// All our tokens are in relation to the augmented text. Move them back to be
// relative to the original text.
start -= offset;
end -= offset;
let length = end - start;
if (length > 0) {
result.spans.push(start);
result.spans.push(length);
result.spans.push(classification);
}
}
}
@@ -6826,41 +6986,44 @@ module ts {
return token >= SyntaxKind.FirstKeyword && token <= SyntaxKind.LastKeyword;
}
function classFromKind(token: SyntaxKind) {
function classFromKind(token: SyntaxKind): ClassificationType {
if (isKeyword(token)) {
return TokenClass.Keyword;
return ClassificationType.keyword;
}
else if (isBinaryExpressionOperatorToken(token) || isPrefixUnaryExpressionOperatorToken(token)) {
return TokenClass.Operator;
return ClassificationType.operator;
}
else if (token >= SyntaxKind.FirstPunctuation && token <= SyntaxKind.LastPunctuation) {
return TokenClass.Punctuation;
return ClassificationType.punctuation;
}
switch (token) {
case SyntaxKind.NumericLiteral:
return TokenClass.NumberLiteral;
return ClassificationType.numericLiteral;
case SyntaxKind.StringLiteral:
return TokenClass.StringLiteral;
return ClassificationType.stringLiteral;
case SyntaxKind.RegularExpressionLiteral:
return TokenClass.RegExpLiteral;
return ClassificationType.regularExpressionLiteral;
case SyntaxKind.ConflictMarkerTrivia:
case SyntaxKind.MultiLineCommentTrivia:
case SyntaxKind.SingleLineCommentTrivia:
return TokenClass.Comment;
return ClassificationType.comment;
case SyntaxKind.WhitespaceTrivia:
case SyntaxKind.NewLineTrivia:
return TokenClass.Whitespace;
return ClassificationType.whiteSpace;
case SyntaxKind.Identifier:
default:
if (isTemplateLiteralKind(token)) {
return TokenClass.StringLiteral;
return ClassificationType.stringLiteral;
}
return TokenClass.Identifier;
return ClassificationType.identifier;
}
}
return { getClassificationsForLine };
return {
getClassificationsForLine,
getEncodedLexicalClassifications
};
}
/// getDefaultLibraryFilePath
+61 -19
View File
@@ -99,6 +99,8 @@ module ts {
getSyntacticClassifications(fileName: string, start: number, length: number): string;
getSemanticClassifications(fileName: string, start: number, length: number): string;
getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string;
getEncodedSemanticClassifications(fileName: string, start: number, length: number): string;
getCompletionsAtPosition(fileName: string, position: number): string;
getCompletionEntryDetails(fileName: string, position: number, entryName: string): string;
@@ -189,6 +191,7 @@ module ts {
}
export interface ClassifierShim extends Shim {
getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string;
getClassificationsForLine(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string;
}
@@ -199,7 +202,9 @@ module ts {
}
function logInternalError(logger: Logger, err: Error) {
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
if (logger) {
logger.log("*INTERNAL ERROR* - Exception in typescript services: " + err.message);
}
}
class ScriptSnapshotShimAdapter implements IScriptSnapshot {
@@ -321,25 +326,32 @@ module ts {
}
}
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any): any {
logger.log(actionDescription);
var start = Date.now();
var result = action();
var end = Date.now();
logger.log(actionDescription + " completed in " + (end - start) + " msec");
if (typeof (result) === "string") {
var str = <string>result;
if (str.length > 128) {
str = str.substring(0, 128) + "...";
}
logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
function simpleForwardCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): any {
if (!noPerfLogging) {
logger.log(actionDescription);
var start = Date.now();
}
var result = action();
if (!noPerfLogging) {
var end = Date.now();
logger.log(actionDescription + " completed in " + (end - start) + " msec");
if (typeof (result) === "string") {
var str = <string>result;
if (str.length > 128) {
str = str.substring(0, 128) + "...";
}
logger.log(" result.length=" + str.length + ", result='" + JSON.stringify(str) + "'");
}
}
return result;
}
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any): string {
function forwardJSONCall(logger: Logger, actionDescription: string, action: () => any, noPerfLogging: boolean): string {
try {
var result = simpleForwardCall(logger, actionDescription, action);
var result = simpleForwardCall(logger, actionDescription, action, noPerfLogging);
return JSON.stringify({ result: result });
}
catch (err) {
@@ -387,7 +399,7 @@ module ts {
}
public forwardJSONCall(actionDescription: string, action: () => any): string {
return forwardJSONCall(this.logger, actionDescription, action);
return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false);
}
/// DISPOSE
@@ -457,6 +469,26 @@ module ts {
});
}
public getEncodedSyntacticClassifications(fileName: string, start: number, length: number): string {
return this.forwardJSONCall(
"getEncodedSyntacticClassifications('" + fileName + "', " + start + ", " + length + ")",
() => {
// directly serialize the spans out to a string. This is much faster to decode
// on the managed side versus a full JSON array.
return convertClassifications(this.languageService.getEncodedSyntacticClassifications(fileName, createTextSpan(start, length)));
});
}
public getEncodedSemanticClassifications(fileName: string, start: number, length: number): string {
return this.forwardJSONCall(
"getEncodedSemanticClassifications('" + fileName + "', " + start + ", " + length + ")",
() => {
// directly serialize the spans out to a string. This is much faster to decode
// on the managed side versus a full JSON array.
return convertClassifications(this.languageService.getEncodedSemanticClassifications(fileName, createTextSpan(start, length)));
});
}
private getNewLine(): string {
return this.host.getNewLine ? this.host.getNewLine() : "\r\n";
}
@@ -736,14 +768,24 @@ module ts {
}
}
function convertClassifications(classifications: Classifications): { spans: string, endOfLineState: EndOfLineState } {
return { spans: classifications.spans.join(","), endOfLineState: classifications.endOfLineState };
}
class ClassifierShimObject extends ShimBase implements ClassifierShim {
public classifier: Classifier;
constructor(factory: ShimFactory) {
constructor(factory: ShimFactory, private logger: Logger) {
super(factory);
this.classifier = createClassifier();
}
public getEncodedLexicalClassifications(text: string, lexState: EndOfLineState, syntacticClassifierAbsent?: boolean): string {
return forwardJSONCall(this.logger, "getEncodedLexicalClassifications",
() => convertClassifications(this.classifier.getEncodedLexicalClassifications(text, lexState, syntacticClassifierAbsent)),
/*noPerfLogging:*/ true);
}
/// COLORIZATION
public getClassificationsForLine(text: string, lexState: EndOfLineState, classifyKeywordsInGenerics?: boolean): string {
var classification = this.classifier.getClassificationsForLine(text, lexState, classifyKeywordsInGenerics);
@@ -765,7 +807,7 @@ module ts {
}
private forwardJSONCall(actionDescription: string, action: () => any): any {
return forwardJSONCall(this.logger, actionDescription, action);
return forwardJSONCall(this.logger, actionDescription, action, /*noPerfLogging:*/ false);
}
public getPreProcessedFileInfo(fileName: string, sourceTextSnapshot: IScriptSnapshot): string {
@@ -858,7 +900,7 @@ module ts {
public createClassifierShim(logger: Logger): ClassifierShim {
try {
return new ClassifierShimObject(this);
return new ClassifierShimObject(this, logger);
}
catch (err) {
logInternalError(logger, err);
+10 -10
View File
@@ -75,26 +75,26 @@ function delint(sourceFile) {
delintNode(sourceFile);
function delintNode(node) {
switch (node.kind) {
case 186 /* ForStatement */:
case 187 /* ForInStatement */:
case 185 /* WhileStatement */:
case 184 /* DoStatement */:
if (node.statement.kind !== 179 /* Block */) {
case 187 /* ForStatement */:
case 188 /* ForInStatement */:
case 186 /* WhileStatement */:
case 185 /* DoStatement */:
if (node.statement.kind !== 180 /* Block */) {
report(node, "A looping statement's contents should be wrapped in a block body.");
}
break;
case 183 /* IfStatement */:
case 184 /* IfStatement */:
var ifStatement = node;
if (ifStatement.thenStatement.kind !== 179 /* Block */) {
if (ifStatement.thenStatement.kind !== 180 /* Block */) {
report(ifStatement.thenStatement, "An if statement's contents should be wrapped in a block body.");
}
if (ifStatement.elseStatement &&
ifStatement.elseStatement.kind !== 179 /* Block */ &&
ifStatement.elseStatement.kind !== 183 /* IfStatement */) {
ifStatement.elseStatement.kind !== 180 /* Block */ &&
ifStatement.elseStatement.kind !== 184 /* IfStatement */) {
report(ifStatement.elseStatement, "An else statement's contents should be wrapped in a block body.");
}
break;
case 169 /* BinaryExpression */:
case 170 /* BinaryExpression */:
var op = node.operatorToken.kind;
if (op === 28 /* EqualsEqualsToken */ || op == 29 /* ExclamationEqualsToken */) {
report(node, "Use '===' and '!=='.");
@@ -1,4 +1,4 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
@@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro
module X.Y {
export module Point {
~~~~~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var Origin = new Point(0, 0);
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/class.ts (0 errors) ====
@@ -17,7 +17,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): erro
module X.Y {
export module Point {
~~~~~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var Origin = new Point(0, 0);
}
}
@@ -1,4 +1,4 @@
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment7.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment7.ts(4,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name 'B'.
@@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment7.ts(4,10): error TS2304: Cannot find name
==== tests/cases/compiler/ExportAssignment7.ts (3 errors) ====
export class C {
~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
}
export = B;
@@ -1,4 +1,4 @@
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/compiler/ExportAssignment8.ts(1,1): error TS2309: An export assignment cannot be used in a module with other exported elements.
tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name 'B'.
@@ -6,7 +6,7 @@ tests/cases/compiler/ExportAssignment8.ts(1,10): error TS2304: Cannot find name
==== tests/cases/compiler/ExportAssignment8.ts (3 errors) ====
export = B;
~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! error TS2309: An export assignment cannot be used in a module with other exported elements.
~
@@ -1,4 +1,4 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(13,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error TS2403: Subsequent variable declarations must have the same type. Variable 'fn' must be of type '() => { x: number; y: number; }', but here has type 'typeof Point'.
@@ -14,7 +14,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/test.ts(2,5): error T
module A {
export module Point {
~~~~~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}
}
@@ -1,12 +1,12 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
module X.Y {
export module Point {
~~~~~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var Origin = new Point(0, 0);
}
}
@@ -27,7 +27,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(1,8): error
==== tests/cases/conformance/internalModules/DeclarationMerging/simple.ts (1 errors) ====
module A {
~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
export var Instance = new A();
}
@@ -1,12 +1,12 @@
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/module.ts(2,19): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/conformance/internalModules/DeclarationMerging/module.ts (1 errors) ====
module A {
export module Point {
~~~~~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}
}
@@ -24,7 +24,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/simple.ts(3,19): erro
export module Point {
~~~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
export var Origin = { x: 0, y: 0 };
}
@@ -1,4 +1,4 @@
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/internalModules/DeclarationMerging/part1.ts(1,15): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(3,24): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,36): error TS2304: Cannot find name 'Point'.
tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error TS2304: Cannot find name 'Point'.
@@ -7,7 +7,7 @@ tests/cases/conformance/internalModules/DeclarationMerging/part2.ts(7,54): error
==== tests/cases/conformance/internalModules/DeclarationMerging/part1.ts (1 errors) ====
export module A {
~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
export interface Point {
x: number;
y: number;
@@ -1,11 +1,11 @@
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/ambient/consumer.ts(2,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
==== tests/cases/conformance/ambient/consumer.ts (1 errors) ====
/// <reference path="decls.ts" />
import imp1 = require('equ');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
// Ambient external module members are always exported with or without export keyword when module lacks export assignment
@@ -11,8 +11,8 @@ tests/cases/conformance/ambient/ambientErrors.ts(38,13): error TS1039: Initializ
tests/cases/conformance/ambient/ambientErrors.ts(39,23): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(40,14): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(41,22): error TS1184: An implementation cannot be declared in ambient contexts.
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient external module declaration cannot specify relative module name.
tests/cases/conformance/ambient/ambientErrors.ts(47,20): error TS2435: Ambient modules cannot be nested in other modules.
tests/cases/conformance/ambient/ambientErrors.ts(51,16): error TS2436: Ambient module declaration cannot specify relative module name.
tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export assignment cannot be used in a module with other exported elements.
@@ -91,13 +91,13 @@ tests/cases/conformance/ambient/ambientErrors.ts(57,5): error TS2309: An export
module M2 {
declare module 'nope' { }
~~~~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient modules cannot be nested in other modules.
}
// Ambient external module with a string literal name that isn't a top level external module name
declare module '../foo' { }
~~~~~~~~
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient module declaration cannot specify relative module name.
// Ambient external module with export assignment and other exported members
declare module 'bar' {
@@ -1,5 +1,5 @@
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find external module 'ext'.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(5,16): error TS2435: Ambient modules cannot be nested in other modules.
tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): error TS2307: Cannot find module 'ext'.
==== tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts (2 errors) ====
@@ -9,12 +9,12 @@ tests/cases/compiler/ambientExternalModuleInAnotherExternalModule.ts(10,22): err
declare module "ext" {
~~~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient modules cannot be nested in other modules.
export class C { }
}
// Cannot resolve this ext module reference
import ext = require("ext");
~~~~~
!!! error TS2307: Cannot find external module 'ext'.
!!! error TS2307: Cannot find module 'ext'.
var x = ext;
@@ -1,9 +1,9 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts(2,27): error TS2435: Ambient modules cannot be nested in other modules.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbient.ts (1 errors) ====
module M {
export declare module "M" { }
~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient modules cannot be nested in other modules.
}
@@ -1,7 +1,7 @@
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient external modules cannot be nested in other modules.
tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts(1,23): error TS2435: Ambient modules cannot be nested in other modules.
==== tests/cases/conformance/ambient/ambientExternalModuleInsideNonAmbientExternalModule.ts (1 errors) ====
export declare module "M" { }
~~~
!!! error TS2435: Ambient external modules cannot be nested in other modules.
!!! error TS2435: Ambient modules cannot be nested in other modules.
@@ -1,14 +1,14 @@
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find external module './SubModule'.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,5): error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts(2,25): error TS2307: Cannot find module './SubModule'.
==== tests/cases/compiler/ambientExternalModuleWithRelativeExternalImportDeclaration.ts (2 errors) ====
declare module "OuterModule" {
import m2 = require("./SubModule");
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2439: Import or export declaration in an ambient external module declaration cannot reference external module through relative external module name.
!!! error TS2439: Import or export declaration in an ambient module declaration cannot reference module through relative module name.
~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module './SubModule'.
!!! error TS2307: Cannot find module './SubModule'.
class SubModule {
public static StaticVar: number;
public InstanceVar: number;
@@ -1,16 +1,16 @@
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient external module declaration cannot specify relative module name.
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient external module declaration cannot specify relative module name.
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(1,16): error TS2436: Ambient module declaration cannot specify relative module name.
tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts(5,16): error TS2436: Ambient module declaration cannot specify relative module name.
==== tests/cases/compiler/ambientExternalModuleWithRelativeModuleName.ts (2 errors) ====
declare module "./relativeModule" {
~~~~~~~~~~~~~~~~~~
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient module declaration cannot specify relative module name.
var x: string;
}
declare module ".\\relativeModule" {
~~~~~~~~~~~~~~~~~~~
!!! error TS2436: Ambient external module declaration cannot specify relative module name.
!!! error TS2436: Ambient module declaration cannot specify relative module name.
var x: string;
}
@@ -1,4 +1,4 @@
tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find external module 'm2'.
tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find module 'm2'.
==== tests/cases/compiler/amdDependencyComment1.ts (1 errors) ====
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyComment1.ts(3,21): error TS2307: Cannot find e
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
!!! error TS2307: Cannot find module 'm2'.
m1.f();
@@ -1,4 +1,4 @@
tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find external module 'm2'.
tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find module 'm2'.
==== tests/cases/compiler/amdDependencyComment2.ts (1 errors) ====
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyComment2.ts(3,21): error TS2307: Cannot find e
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
!!! error TS2307: Cannot find module 'm2'.
m1.f();
@@ -1,4 +1,4 @@
tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find external module 'm2'.
tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot find module 'm2'.
==== tests/cases/compiler/amdDependencyCommentName1.ts (1 errors) ====
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyCommentName1.ts(3,21): error TS2307: Cannot fi
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
!!! error TS2307: Cannot find module 'm2'.
m1.f();
@@ -1,4 +1,4 @@
tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find external module 'm2'.
tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot find module 'm2'.
==== tests/cases/compiler/amdDependencyCommentName2.ts (1 errors) ====
@@ -6,5 +6,5 @@ tests/cases/compiler/amdDependencyCommentName2.ts(3,21): error TS2307: Cannot fi
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
!!! error TS2307: Cannot find module 'm2'.
m1.f();
@@ -1,4 +1,4 @@
tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find external module 'm2'.
tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot find module 'm2'.
==== tests/cases/compiler/amdDependencyCommentName3.ts (1 errors) ====
@@ -8,5 +8,5 @@ tests/cases/compiler/amdDependencyCommentName3.ts(5,21): error TS2307: Cannot fi
import m1 = require("m2")
~~~~
!!! error TS2307: Cannot find external module 'm2'.
!!! error TS2307: Cannot find module 'm2'.
m1.f();
@@ -1,7 +1,7 @@
tests/cases/compiler/amdDependencyCommentName4.ts(8,21): error TS2307: Cannot find external module 'aliasedModule1'.
tests/cases/compiler/amdDependencyCommentName4.ts(11,26): error TS2307: Cannot find external module 'aliasedModule2'.
tests/cases/compiler/amdDependencyCommentName4.ts(14,15): error TS2307: Cannot find external module 'aliasedModule3'.
tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot find external module 'aliasedModule4'.
tests/cases/compiler/amdDependencyCommentName4.ts(8,21): error TS2307: Cannot find module 'aliasedModule1'.
tests/cases/compiler/amdDependencyCommentName4.ts(11,26): error TS2307: Cannot find module 'aliasedModule2'.
tests/cases/compiler/amdDependencyCommentName4.ts(14,15): error TS2307: Cannot find module 'aliasedModule3'.
tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot find module 'aliasedModule4'.
==== tests/cases/compiler/amdDependencyCommentName4.ts (4 errors) ====
@@ -14,22 +14,22 @@ tests/cases/compiler/amdDependencyCommentName4.ts(17,21): error TS2307: Cannot f
import r1 = require("aliasedModule1");
~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'aliasedModule1'.
!!! error TS2307: Cannot find module 'aliasedModule1'.
r1;
import {p1, p2, p3} from "aliasedModule2";
~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'aliasedModule2'.
!!! error TS2307: Cannot find module 'aliasedModule2'.
p1;
import d from "aliasedModule3";
~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'aliasedModule3'.
!!! error TS2307: Cannot find module 'aliasedModule3'.
d;
import * as ns from "aliasedModule4";
~~~~~~~~~~~~~~~~
!!! error TS2307: Cannot find external module 'aliasedModule4'.
!!! error TS2307: Cannot find module 'aliasedModule4'.
ns;
import "unaliasedModule2";
@@ -4,9 +4,9 @@ tests/cases/compiler/augmentedTypesModules.ts(8,8): error TS2300: Duplicate iden
tests/cases/compiler/augmentedTypesModules.ts(9,5): error TS2300: Duplicate identifier 'm1b'.
tests/cases/compiler/augmentedTypesModules.ts(16,8): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(19,5): error TS2300: Duplicate identifier 'm1d'.
tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(25,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(28,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/compiler/augmentedTypesModules.ts (9 errors) ====
@@ -48,12 +48,12 @@ tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module decl
module m2a { var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
function m2a() { }; // error since the module is instantiated
module m2b { export var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
function m2b() { }; // error since the module is instantiated
// should be errors to have function first
@@ -78,7 +78,7 @@ tests/cases/compiler/augmentedTypesModules.ts(51,8): error TS2434: A module decl
module m3a { var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
class m3a { foo() { } } // error, class isn't ambient or declared before the module
class m3b { foo() { } }
@@ -1,6 +1,6 @@
tests/cases/compiler/augmentedTypesModules2.ts(5,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules2.ts(8,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules2.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules2.ts(8,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/compiler/augmentedTypesModules2.ts (3 errors) ====
@@ -10,12 +10,12 @@ tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A module dec
module m2a { var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
function m2a() { }; // error since the module is instantiated
module m2b { export var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
function m2b() { }; // error since the module is instantiated
function m2c() { };
@@ -23,7 +23,7 @@ tests/cases/compiler/augmentedTypesModules2.ts(14,8): error TS2434: A module dec
module m2cc { export var y = 2; }
~~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
function m2cc() { }; // error to have module first
module m2d { }
@@ -1,4 +1,4 @@
tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/compiler/augmentedTypesModules3.ts (1 errors) ====
@@ -8,5 +8,5 @@ tests/cases/compiler/augmentedTypesModules3.ts(5,8): error TS2434: A module decl
module m3a { var y = 2; }
~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
class m3a { foo() { } } // error, class isn't ambient or declared before the module
@@ -1,10 +1,10 @@
tests/cases/compiler/badExternalModuleReference.ts(1,21): error TS2307: Cannot find external module 'garbage'.
tests/cases/compiler/badExternalModuleReference.ts(1,21): error TS2307: Cannot find module 'garbage'.
==== tests/cases/compiler/badExternalModuleReference.ts (1 errors) ====
import a1 = require("garbage");
~~~~~~~~~
!!! error TS2307: Cannot find external module 'garbage'.
!!! error TS2307: Cannot find module 'garbage'.
export declare var a: {
test1: a1.connectModule;
(): a1.connectExport;
@@ -1,4 +1,4 @@
tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/externalModules/foo1.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/externalModules/foo1.ts(9,12): error TS2339: Property 'x' does not exist on type 'C1'.
tests/cases/conformance/externalModules/foo2.ts(8,12): error TS2339: Property 'y' does not exist on type 'C1'.
tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x' does not exist on type 'C1'.
@@ -29,7 +29,7 @@ tests/cases/conformance/externalModules/foo2.ts(13,8): error TS2339: Property 'x
==== tests/cases/conformance/externalModules/foo1.ts (2 errors) ====
import foo2 = require('./foo2');
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
export module M1 {
export class C1 {
m1: foo2.M1.C1;
@@ -1,4 +1,4 @@
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(4,14): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2301: Initializer of instance member variable 'messageHandler' cannot reference identifier 'field1' declared in the constructor.
@@ -11,7 +11,7 @@ tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error T
};
export class Test1 {
~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
constructor(private field1: string) {
}
messageHandler = () => {
@@ -1,11 +1,11 @@
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts(8,21): error TS2304: Cannot find name 'field1'.
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_0.ts (1 errors) ====
export var field1: string;
~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
==== tests/cases/compiler/classMemberInitializerWithLamdaScoping3_1.ts (1 errors) ====
declare var console: {
@@ -1,4 +1,4 @@
tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
==== tests/cases/compiler/cloduleSplitAcrossFiles_class.ts (0 errors) ====
@@ -7,7 +7,7 @@ tests/cases/compiler/cloduleSplitAcrossFiles_module.ts(1,8): error TS2433: A mod
==== tests/cases/compiler/cloduleSplitAcrossFiles_module.ts (1 errors) ====
module D {
~
!!! error TS2433: A module declaration cannot be in a different file from a class or function with which it is merged
!!! error TS2433: A namespace declaration cannot be in a different file from a class or function with which it is merged
export var y = "hi";
}
D.y;
@@ -1,11 +1,11 @@
tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts(2,8): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
==== tests/cases/compiler/cloduleWithPriorInstantiatedModule.ts (1 errors) ====
// Non-ambient & instantiated module.
module Moclodule {
~~~~~~~~~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
export interface Someinterface {
foo(): void;
}
@@ -1,14 +1,14 @@
tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(1,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(2,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(1,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts(2,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndAlias_file2.ts (2 errors) ====
import require = require('collisionExportsRequireAndAlias_file1'); // Error
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
import exports = require('collisionExportsRequireAndAlias_file3333'); // Error
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
export function foo() {
require.bar();
}
@@ -1,15 +1,15 @@
tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(1,14): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(3,14): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(1,14): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts(3,14): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndClass_externalmodule.ts (2 errors) ====
export class require {
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
}
export class exports {
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
}
module m1 {
class require {
@@ -1,17 +1,17 @@
tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(1,13): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(1,13): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts(5,13): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndEnum_externalmodule.ts (2 errors) ====
export enum require { // Error
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
_thisVal1,
_thisVal2,
}
export enum exports { // Error
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
_thisVal1,
_thisVal2,
}
@@ -1,16 +1,16 @@
tests/cases/compiler/collisionExportsRequireAndFunction.ts(1,17): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndFunction.ts(1,17): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndFunction.ts(4,17): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndFunction.ts (2 errors) ====
export function exports() {
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
return 1;
}
export function require() {
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
return "require";
}
module m1 {
@@ -1,5 +1,5 @@
tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(5,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(5,8): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(6,8): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts (2 errors) ====
@@ -9,10 +9,10 @@ tests/cases/compiler/collisionExportsRequireAndInternalModuleAlias.ts(6,8): erro
}
import exports = m.c;
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
import require = m.c;
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
new exports();
new require();
@@ -1,11 +1,11 @@
tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(1,15): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(1,15): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(10,15): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts (2 errors) ====
export module require {
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
export interface I {
}
export class C {
@@ -16,7 +16,7 @@ tests/cases/compiler/collisionExportsRequireAndModule_externalmodule.ts(10,15):
}
export module exports {
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
export interface I {
}
export class C {
@@ -1,5 +1,5 @@
tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(4,5): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(3,5): error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(4,5): error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
==== tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts (2 errors) ====
@@ -7,10 +7,10 @@ tests/cases/compiler/collisionExportsRequireAndVar_externalmodule.ts(4,5): error
}
var exports = 1;
~~~~~~~
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'exports'. Compiler reserves name 'exports' in top level scope of a module.
var require = "require";
~~~~~~~
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of an external module.
!!! error TS2441: Duplicate identifier 'require'. Compiler reserves name 'require' in top level scope of a module.
module m1 {
var exports = 0;
var require = "require";
@@ -1,4 +1,4 @@
tests/cases/compiler/commentOnImportStatement1.ts(3,22): error TS2307: Cannot find external module './foo'.
tests/cases/compiler/commentOnImportStatement1.ts(3,22): error TS2307: Cannot find module './foo'.
==== tests/cases/compiler/commentOnImportStatement1.ts (1 errors) ====
@@ -6,5 +6,5 @@ tests/cases/compiler/commentOnImportStatement1.ts(3,22): error TS2307: Cannot fi
import foo = require('./foo');
~~~~~~~
!!! error TS2307: Cannot find external module './foo'.
!!! error TS2307: Cannot find module './foo'.
@@ -1,8 +1,8 @@
tests/cases/compiler/commentOnImportStatement2.ts(2,22): error TS2307: Cannot find external module './foo'.
tests/cases/compiler/commentOnImportStatement2.ts(2,22): error TS2307: Cannot find module './foo'.
==== tests/cases/compiler/commentOnImportStatement2.ts (1 errors) ====
/* not copyright */
import foo = require('./foo');
~~~~~~~
!!! error TS2307: Cannot find external module './foo'.
!!! error TS2307: Cannot find module './foo'.
@@ -1,4 +1,4 @@
tests/cases/compiler/commentOnImportStatement3.ts(4,22): error TS2307: Cannot find external module './foo'.
tests/cases/compiler/commentOnImportStatement3.ts(4,22): error TS2307: Cannot find module './foo'.
==== tests/cases/compiler/commentOnImportStatement3.ts (1 errors) ====
@@ -7,4 +7,4 @@ tests/cases/compiler/commentOnImportStatement3.ts(4,22): error TS2307: Cannot fi
/* not copyright */
import foo = require('./foo');
~~~~~~~
!!! error TS2307: Cannot find external module './foo'.
!!! error TS2307: Cannot find module './foo'.
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module body.
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,10): error TS2331: 'this' cannot be referenced in a module or namespace body.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES5.ts(3,
var obj = {
[this.bar]: 0
~~~~
!!! error TS2331: 'this' cannot be referenced in a module body.
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module body.
tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,10): error TS2331: 'this' cannot be referenced in a module or namespace body.
==== tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts (1 errors) ====
@@ -6,6 +6,6 @@ tests/cases/conformance/es6/computedProperties/computedPropertyNames19_ES6.ts(3,
var obj = {
[this.bar]: 0
~~~~
!!! error TS2331: 'this' cannot be referenced in a module body.
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
}
}
@@ -1,4 +1,4 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
tests/cases/compiler/constDeclarations_access_2.ts(2,1): error TS1202: Import assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'import * as ns from "mod"', 'import {a} from "mod"' or 'import d from "mod"' instead.
tests/cases/compiler/constDeclarations_access_2.ts(4,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
tests/cases/compiler/constDeclarations_access_2.ts(5,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
@@ -20,7 +20,7 @@ tests/cases/compiler/constDeclarations_access_2.ts(22,3): error TS2449: The oper
tests/cases/compiler/constDeclarations_access_2.ts(24,1): error TS2450: Left-hand side of assignment expression cannot be a constant.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/constDeclarations_access_2.ts (19 errors) ====
///<reference path='constDeclarations_access_1.ts'/>
import m = require('constDeclarations_access_1');
@@ -1,4 +1,4 @@
tests/cases/compiler/copyrightWithNewLine1.ts(5,24): error TS2307: Cannot find external module './greeter'.
tests/cases/compiler/copyrightWithNewLine1.ts(5,24): error TS2307: Cannot find module './greeter'.
tests/cases/compiler/copyrightWithNewLine1.ts(6,10): error TS2304: Cannot find name 'document'.
@@ -9,7 +9,7 @@ tests/cases/compiler/copyrightWithNewLine1.ts(6,10): error TS2304: Cannot find n
import model = require("./greeter")
~~~~~~~~~~~
!!! error TS2307: Cannot find external module './greeter'.
!!! error TS2307: Cannot find module './greeter'.
var el = document.getElementById('content');
~~~~~~~~
!!! error TS2304: Cannot find name 'document'.
@@ -1,4 +1,4 @@
tests/cases/compiler/copyrightWithoutNewLine1.ts(4,24): error TS2307: Cannot find external module './greeter'.
tests/cases/compiler/copyrightWithoutNewLine1.ts(4,24): error TS2307: Cannot find module './greeter'.
tests/cases/compiler/copyrightWithoutNewLine1.ts(5,10): error TS2304: Cannot find name 'document'.
@@ -8,7 +8,7 @@ tests/cases/compiler/copyrightWithoutNewLine1.ts(5,10): error TS2304: Cannot fin
****************************/
import model = require("./greeter")
~~~~~~~~~~~
!!! error TS2307: Cannot find external module './greeter'.
!!! error TS2307: Cannot find module './greeter'.
var el = document.getElementById('content');
~~~~~~~~
!!! error TS2304: Cannot find name 'document'.
@@ -1,4 +1,4 @@
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts(5,10): error TS2331: 'this' cannot be referenced in a module body.
tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts(5,10): error TS2331: 'this' cannot be referenced in a module or namespace body.
==== tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts (1 errors) ====
@@ -8,7 +8,7 @@ tests/cases/conformance/decorators/class/method/decoratorOnClassMethod11.ts(5,10
@this.decorator
~~~~
!!! error TS2331: 'this' cannot be referenced in a module body.
!!! error TS2331: 'this' cannot be referenced in a module or namespace body.
method() { }
}
}
@@ -1,4 +1,4 @@
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
tests/cases/conformance/externalModules/foo1.ts(3,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo1.ts(4,1): error TS2300: Duplicate identifier 'export='.
tests/cases/conformance/externalModules/foo2.ts(3,1): error TS2300: Duplicate identifier 'export='.
@@ -17,7 +17,7 @@ tests/cases/conformance/externalModules/foo5.ts(6,1): error TS2300: Duplicate id
var y = 20;
export = x;
~~~~~~~~~~~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
~~~~~~~~~~~
!!! error TS2300: Duplicate identifier 'export='.
export = y;
@@ -9,7 +9,7 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(43,16): error TS2395: Ind
tests/cases/compiler/duplicateSymbolsExportMatching.ts(44,9): error TS2395: Individual declarations in merged declaration w must be all exported or all local.
tests/cases/compiler/duplicateSymbolsExportMatching.ts(45,16): error TS2395: Individual declarations in merged declaration w must be all exported or all local.
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2395: Individual declarations in merged declaration F must be all exported or all local.
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/duplicateSymbolsExportMatching.ts(49,12): error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
tests/cases/compiler/duplicateSymbolsExportMatching.ts(52,21): error TS2395: Individual declarations in merged declaration F must be all exported or all local.
tests/cases/compiler/duplicateSymbolsExportMatching.ts(56,11): error TS2395: Individual declarations in merged declaration C must be all exported or all local.
tests/cases/compiler/duplicateSymbolsExportMatching.ts(57,12): error TS2395: Individual declarations in merged declaration C must be all exported or all local.
@@ -91,7 +91,7 @@ tests/cases/compiler/duplicateSymbolsExportMatching.ts(65,18): error TS2395: Ind
~
!!! error TS2395: Individual declarations in merged declaration F must be all exported or all local.
~
!!! error TS2434: A module declaration cannot be located prior to a class or function with which it is merged
!!! error TS2434: A namespace declaration cannot be located prior to a class or function with which it is merged
var t;
}
export function F() { } // Only one error for duplicate identifier (don't consider visibility)
@@ -1,11 +1,11 @@
tests/cases/compiler/es5ModuleInternalNamedImports.ts(23,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(24,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(25,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(26,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(27,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(28,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(29,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(30,5): error TS1194: Export declarations are not permitted in an internal module.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(23,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(24,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(25,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(26,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(27,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(28,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(29,5): error TS1194: Export declarations are not permitted in a namespace.
tests/cases/compiler/es5ModuleInternalNamedImports.ts(30,5): error TS1194: Export declarations are not permitted in a namespace.
==== tests/cases/compiler/es5ModuleInternalNamedImports.ts (8 errors) ====
@@ -33,27 +33,27 @@ tests/cases/compiler/es5ModuleInternalNamedImports.ts(30,5): error TS1194: Expor
// Reexports
export {M_V as v};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_I as i};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_C as c};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_M as m};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_MU as mu};
~~~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_F as f};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_E as e};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
export {M_A as a};
~~~~~~~~~~~~~~~~~~
!!! error TS1194: Export declarations are not permitted in an internal module.
!!! error TS1194: Export declarations are not permitted in a namespace.
}
@@ -1,10 +1,10 @@
tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile external modules unless the '--module' flag is provided.
tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts(1,14): error TS1148: Cannot compile modules unless the '--module' flag is provided.
==== tests/cases/compiler/es5ModuleWithoutModuleGenTarget.ts (1 errors) ====
export class A
~
!!! error TS1148: Cannot compile external modules unless the '--module' flag is provided.
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
{
constructor ()
{
+2 -2
View File
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-amd.ts (0 errors) ====
class A
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-declaration-amd.ts (0 errors) ====
class A
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-sourcemap-amd.ts (0 errors) ====
class A
+2 -2
View File
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd.ts (0 errors) ====
class A
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6-umd2.ts (0 errors) ====
export class A
@@ -0,0 +1,13 @@
tests/cases/compiler/a.ts(3,1): error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/a.ts (1 errors) ====
var a = 10;
export = a; // Error: export = not allowed in ES6
~~~~~~~~~~~
!!! error TS1203: Export assignment cannot be used when targeting ECMAScript 6 or higher. Consider using 'export default' instead.
==== tests/cases/compiler/b.ts (0 errors) ====
import * as a from "a";
@@ -0,0 +1,14 @@
//// [tests/cases/compiler/es6ExportAssignment2.ts] ////
//// [a.ts]
var a = 10;
export = a; // Error: export = not allowed in ES6
//// [b.ts]
import * as a from "a";
//// [a.js]
var a = 10;
//// [b.js]
@@ -0,0 +1,12 @@
//// [tests/cases/compiler/es6ExportAssignment3.ts] ////
//// [a.d.ts]
declare var a: number;
export = a; // OK, in ambient context
//// [b.ts]
import * as a from "a";
//// [b.js]
@@ -0,0 +1,12 @@
=== tests/cases/compiler/a.d.ts ===
declare var a: number;
>a : Symbol(a, Decl(a.d.ts, 1, 11))
export = a; // OK, in ambient context
>a : Symbol(a, Decl(a.d.ts, 1, 11))
=== tests/cases/compiler/b.ts ===
import * as a from "a";
>a : Symbol(a, Decl(b.ts, 0, 6))
@@ -0,0 +1,12 @@
=== tests/cases/compiler/a.d.ts ===
declare var a: number;
>a : number
export = a; // OK, in ambient context
>a : number
=== tests/cases/compiler/b.ts ===
import * as a from "a";
>a : number
@@ -0,0 +1,14 @@
//// [tests/cases/compiler/es6ExportAssignment4.ts] ////
//// [modules.d.ts]
declare module "a" {
var a: number;
export = a; // OK, in ambient context
}
//// [b.ts]
import * as a from "a";
//// [b.js]
@@ -0,0 +1,14 @@
=== tests/cases/compiler/modules.d.ts ===
declare module "a" {
var a: number;
>a : Symbol(a, Decl(modules.d.ts, 2, 7))
export = a; // OK, in ambient context
>a : Symbol(a, Decl(modules.d.ts, 2, 7))
}
=== tests/cases/compiler/b.ts ===
import * as a from "a";
>a : Symbol(a, Decl(b.ts, 0, 6))
@@ -0,0 +1,14 @@
=== tests/cases/compiler/modules.d.ts ===
declare module "a" {
var a: number;
>a : number
export = a; // OK, in ambient context
>a : number
}
=== tests/cases/compiler/b.ts ===
import * as a from "a";
>a : number
@@ -1,35 +1,35 @@
tests/cases/compiler/main.ts(15,1): error TS2304: Cannot find name 'z1'.
tests/cases/compiler/main.ts(21,4): error TS2339: Property 'a' does not exist on type '() => any'.
tests/cases/compiler/main.ts(23,4): error TS2339: Property 'a' does not exist on type 'typeof Foo'.
tests/cases/compiler/main.ts(27,8): error TS1192: External module '"interface"' has no default export.
tests/cases/compiler/main.ts(28,8): error TS1192: External module '"variable"' has no default export.
tests/cases/compiler/main.ts(29,8): error TS1192: External module '"interface-variable"' has no default export.
tests/cases/compiler/main.ts(30,8): error TS1192: External module '"module"' has no default export.
tests/cases/compiler/main.ts(31,8): error TS1192: External module '"interface-module"' has no default export.
tests/cases/compiler/main.ts(32,8): error TS1192: External module '"variable-module"' has no default export.
tests/cases/compiler/main.ts(33,8): error TS1192: External module '"function"' has no default export.
tests/cases/compiler/main.ts(34,8): error TS1192: External module '"function-module"' has no default export.
tests/cases/compiler/main.ts(35,8): error TS1192: External module '"class"' has no default export.
tests/cases/compiler/main.ts(36,8): error TS1192: External module '"class-module"' has no default export.
tests/cases/compiler/main.ts(39,21): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(45,21): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(47,21): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(62,25): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(68,25): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(70,25): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(85,25): error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(91,25): error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(93,25): error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(97,15): error TS2498: External module '"interface"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(98,15): error TS2498: External module '"variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(99,15): error TS2498: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(100,15): error TS2498: External module '"module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(101,15): error TS2498: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(102,15): error TS2498: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(103,15): error TS2498: External module '"function"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(104,15): error TS2498: External module '"function-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(105,15): error TS2498: External module '"class"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(27,8): error TS1192: Module '"interface"' has no default export.
tests/cases/compiler/main.ts(28,8): error TS1192: Module '"variable"' has no default export.
tests/cases/compiler/main.ts(29,8): error TS1192: Module '"interface-variable"' has no default export.
tests/cases/compiler/main.ts(30,8): error TS1192: Module '"module"' has no default export.
tests/cases/compiler/main.ts(31,8): error TS1192: Module '"interface-module"' has no default export.
tests/cases/compiler/main.ts(32,8): error TS1192: Module '"variable-module"' has no default export.
tests/cases/compiler/main.ts(33,8): error TS1192: Module '"function"' has no default export.
tests/cases/compiler/main.ts(34,8): error TS1192: Module '"function-module"' has no default export.
tests/cases/compiler/main.ts(35,8): error TS1192: Module '"class"' has no default export.
tests/cases/compiler/main.ts(36,8): error TS1192: Module '"class-module"' has no default export.
tests/cases/compiler/main.ts(39,21): error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(45,21): error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(47,21): error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(62,25): error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(68,25): error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(70,25): error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(85,25): error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(91,25): error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(93,25): error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
tests/cases/compiler/main.ts(97,15): error TS2498: Module '"interface"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(98,15): error TS2498: Module '"variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(99,15): error TS2498: Module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(100,15): error TS2498: Module '"module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(101,15): error TS2498: Module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(102,15): error TS2498: Module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(103,15): error TS2498: Module '"function"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(104,15): error TS2498: Module '"function-module"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(105,15): error TS2498: Module '"class"' uses 'export =' and cannot be used with 'export *'.
tests/cases/compiler/main.ts(106,15): error TS2498: Module '"class-module"' uses 'export =' and cannot be used with 'export *'.
==== tests/cases/compiler/main.ts (32 errors) ====
@@ -67,39 +67,39 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
// default import
import x1 from "interface";
~~
!!! error TS1192: External module '"interface"' has no default export.
!!! error TS1192: Module '"interface"' has no default export.
import x2 from "variable";
~~
!!! error TS1192: External module '"variable"' has no default export.
!!! error TS1192: Module '"variable"' has no default export.
import x3 from "interface-variable";
~~
!!! error TS1192: External module '"interface-variable"' has no default export.
!!! error TS1192: Module '"interface-variable"' has no default export.
import x4 from "module";
~~
!!! error TS1192: External module '"module"' has no default export.
!!! error TS1192: Module '"module"' has no default export.
import x5 from "interface-module";
~~
!!! error TS1192: External module '"interface-module"' has no default export.
!!! error TS1192: Module '"interface-module"' has no default export.
import x6 from "variable-module";
~~
!!! error TS1192: External module '"variable-module"' has no default export.
!!! error TS1192: Module '"variable-module"' has no default export.
import x7 from "function";
~~
!!! error TS1192: External module '"function"' has no default export.
!!! error TS1192: Module '"function"' has no default export.
import x8 from "function-module";
~~
!!! error TS1192: External module '"function-module"' has no default export.
!!! error TS1192: Module '"function-module"' has no default export.
import x9 from "class";
~~
!!! error TS1192: External module '"class"' has no default export.
!!! error TS1192: Module '"class"' has no default export.
import x0 from "class-module";
~~
!!! error TS1192: External module '"class-module"' has no default export.
!!! error TS1192: Module '"class-module"' has no default export.
// namespace import
import * as y1 from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
import * as y2 from "variable";
import * as y3 from "interface-variable";
import * as y4 from "module";
@@ -107,11 +107,11 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
import * as y6 from "variable-module";
import * as y7 from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
import * as y8 from "function-module";
import * as y9 from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
import * as y0 from "class-module";
y1.a;
@@ -128,7 +128,7 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
// named import
import { a as a1 } from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a2 } from "variable";
import { a as a3 } from "interface-variable";
import { a as a4 } from "module";
@@ -136,11 +136,11 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
import { a as a6 } from "variable-module";
import { a as a7 } from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a8 } from "function-module";
import { a as a9 } from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
import { a as a0 } from "class-module";
a1;
@@ -157,7 +157,7 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
// named export
export { a as a1 } from "interface";
~~~~~~~~~~~
!!! error TS2497: External module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"interface"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a2 } from "variable";
export { a as a3 } from "interface-variable";
export { a as a4 } from "module";
@@ -165,44 +165,44 @@ tests/cases/compiler/main.ts(106,15): error TS2498: External module '"class-modu
export { a as a6 } from "variable-module";
export { a as a7 } from "function";
~~~~~~~~~~
!!! error TS2497: External module '"function"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"function"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a8 } from "function-module";
export { a as a9 } from "class";
~~~~~~~
!!! error TS2497: External module '"class"' resolves to a non-module entity and cannot be imported using this construct.
!!! error TS2497: Module '"class"' resolves to a non-module entity and cannot be imported using this construct.
export { a as a0 } from "class-module";
// export-star
export * from "interface";
~~~~~~~~~~~
!!! error TS2498: External module '"interface"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"interface"' uses 'export =' and cannot be used with 'export *'.
export * from "variable";
~~~~~~~~~~
!!! error TS2498: External module '"variable"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"variable"' uses 'export =' and cannot be used with 'export *'.
export * from "interface-variable";
~~~~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"interface-variable"' uses 'export =' and cannot be used with 'export *'.
export * from "module";
~~~~~~~~
!!! error TS2498: External module '"module"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"module"' uses 'export =' and cannot be used with 'export *'.
export * from "interface-module";
~~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"interface-module"' uses 'export =' and cannot be used with 'export *'.
export * from "variable-module";
~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"variable-module"' uses 'export =' and cannot be used with 'export *'.
export * from "function";
~~~~~~~~~~
!!! error TS2498: External module '"function"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"function"' uses 'export =' and cannot be used with 'export *'.
export * from "function-module";
~~~~~~~~~~~~~~~~~
!!! error TS2498: External module '"function-module"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"function-module"' uses 'export =' and cannot be used with 'export *'.
export * from "class";
~~~~~~~
!!! error TS2498: External module '"class"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"class"' uses 'export =' and cannot be used with 'export *'.
export * from "class-module";
~~~~~~~~~~~~~~
!!! error TS2498: External module '"class-module"' uses 'export =' and cannot be used with 'export *'.
!!! error TS2498: Module '"class-module"' uses 'export =' and cannot be used with 'export *'.
==== tests/cases/compiler/modules.d.ts (0 errors) ====
@@ -1,7 +1,7 @@
error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile external modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
!!! error TS1204: Cannot compile modules into 'commonjs', 'amd', 'system' or 'umd' when targeting 'ES6' or higher.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImport_0.ts (0 errors) ====
export var a = 10;
@@ -1,9 +1,9 @@
tests/cases/compiler/client.ts(1,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(2,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(4,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(6,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(9,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(11,8): error TS1192: External module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(1,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(2,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(4,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(6,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(9,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
tests/cases/compiler/client.ts(11,8): error TS1192: Module '"tests/cases/compiler/server"' has no default export.
==== tests/cases/compiler/server.ts (0 errors) ====
@@ -18,26 +18,26 @@ tests/cases/compiler/client.ts(11,8): error TS1192: External module '"tests/case
==== tests/cases/compiler/client.ts (6 errors) ====
import defaultBinding1, { } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
import defaultBinding2, { a } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
export var x1 = new a();
import defaultBinding3, { a11 as b } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
export var x2 = new b();
import defaultBinding4, { x, a12 as y } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
export var x4 = new x();
export var x5 = new y();
import defaultBinding5, { x11 as z, } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
export var x3 = new z();
import defaultBinding6, { m, } from "server";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/server"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/server"' has no default export.
export var x6 = new m();
@@ -1,9 +1,9 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(9,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(1,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(2,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(4,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(6,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(9,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0.ts (0 errors) ====
@@ -15,26 +15,26 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts(11
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_1.ts (6 errors) ====
import defaultBinding1, { } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
import defaultBinding2, { a } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = a;
import defaultBinding3, { a as b } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = b;
import defaultBinding4, { x, a as y } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = x;
var x1: number = y;
import defaultBinding5, { x as z, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = z;
import defaultBinding6, { m, } from "es6ImportDefaultBindingFollowedWithNamedImportInEs5_0";
~~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamedImportInEs5_0"' has no default export.
var x1: number = m;
@@ -1,4 +1,4 @@
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,8): error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0.ts (0 errors) ====
@@ -8,5 +8,5 @@ tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts(1,
==== tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_1.ts (1 errors) ====
import defaultBinding, * as nameSpaceBinding from "es6ImportDefaultBindingFollowedWithNamespaceBinding_0";
~~~~~~~~~~~~~~
!!! error TS1192: External module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
!!! error TS1192: Module '"tests/cases/compiler/es6ImportDefaultBindingFollowedWithNamespaceBinding_0"' has no default export.
var x: number = nameSpaceBinding.a;

Some files were not shown because too many files have changed in this diff Show More