├── .gitmodules ├── library └── plugins │ ├── traceur-compiler │ ├── test │ │ ├── wiki │ │ │ ├── .gitignore │ │ │ └── CompilingOffline │ │ │ │ ├── greeter.js │ │ │ │ └── UsingCompiledFiles.html │ │ ├── feature │ │ │ ├── Syntax │ │ │ │ ├── Empty.js │ │ │ │ ├── null.js │ │ │ │ ├── RegularExpression.js │ │ │ │ ├── ImplicitSemiColon.js │ │ │ │ ├── Error_RegExpNotClosed.js │ │ │ │ ├── UnicodeEscapeSequenceInName.js │ │ │ │ ├── Error_Arguments.js │ │ │ │ ├── Error_FunctionParam.js │ │ │ │ ├── Error_WithInModule.module.js │ │ │ │ ├── Error_NoLineTerminatorPostfix.js │ │ │ │ ├── Error_YieldStarNewLine.js │ │ │ │ ├── Error_UnicodeEscapeSequenceInName.js │ │ │ │ ├── Error_WithInStrictProgram.js │ │ │ │ ├── Error_WithInClass.js │ │ │ │ ├── NumberLiteralMemberExpression.js │ │ │ │ ├── UseStrictEscapeSequence.js │ │ │ │ ├── UseStrictLineContinuation.js │ │ │ │ ├── Error_StrictKeywordsInStrict.js │ │ │ │ ├── Error_StrictKeywordsInArguments.js │ │ │ │ ├── Error_StrictKeywordsInArgumentsPattern.js │ │ │ │ ├── Error_WithInStrictFunction.js │ │ │ │ ├── ArrayWithHoles.js │ │ │ │ ├── Error_StrictKeywordsInPropertyDefinitionIdentifierReference.js │ │ │ │ ├── StringEscapes.js │ │ │ │ └── ExpressionValidation.js │ │ │ ├── Modules │ │ │ │ ├── resources │ │ │ │ │ ├── a.js │ │ │ │ │ ├── c.js │ │ │ │ │ ├── x.js │ │ │ │ │ ├── a2.js │ │ │ │ │ ├── b.js │ │ │ │ │ ├── d.js │ │ │ │ │ ├── default.js │ │ │ │ │ ├── f.js │ │ │ │ │ ├── side-effect.js │ │ │ │ │ ├── m2.js │ │ │ │ │ ├── side-effect2.js │ │ │ │ │ ├── m.js │ │ │ │ │ ├── n.js │ │ │ │ │ ├── default-name.js │ │ │ │ │ ├── m3.js │ │ │ │ │ ├── o.js │ │ │ │ │ ├── i.js │ │ │ │ │ ├── export-conflict.js │ │ │ │ │ ├── default-class.js │ │ │ │ │ ├── TestClass.js │ │ │ │ │ └── clockwise.js │ │ │ │ ├── EmptyNamedImport.js │ │ │ │ ├── ImportAsExportAs.js │ │ │ │ ├── ModuleName.module.js │ │ │ │ ├── ModuleDefault.js │ │ │ │ ├── StaticMethod.js │ │ │ │ ├── ThisInModules.js │ │ │ │ ├── Error_ExportKeyword.module.js │ │ │ │ ├── Error_ModuleNoNewline.js │ │ │ │ ├── Error_ExportKeyword2.module.js │ │ │ │ ├── Error_InvalidExport.module.js │ │ │ │ ├── Error_InvalidModuleDeclaration2.js │ │ │ │ ├── ImportNoImportClause.js │ │ │ │ ├── Error_InvalidExport2.module.js │ │ │ │ ├── ExportStar.js │ │ │ │ ├── ImportEmptyImportClause.js │ │ │ │ ├── Error_ImportStar.js │ │ │ │ ├── Error_ImportDefault.js │ │ │ │ ├── Error_InvalidExport3.module.js │ │ │ │ ├── ImportDefault.js │ │ │ │ ├── ModuleNoNewline.js │ │ │ │ ├── Error_ExportStarConflict.js │ │ │ │ ├── ImportCircular.module.js │ │ │ │ ├── Error_ExportStarDuplicateExport.module.js │ │ │ │ ├── Error_MissingExport.js │ │ │ │ ├── Exports.js │ │ │ │ ├── ImportFromModule.js │ │ │ │ └── Error_InvalidModuleDeclaration.js │ │ │ ├── Classes │ │ │ │ ├── SemiColon.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── ExtendObject.js │ │ │ │ ├── StaticSymbol.js │ │ │ │ ├── DeriveFromObject.js │ │ │ │ ├── Error_Super.js │ │ │ │ ├── Error_SuperAsTemplateTag.js │ │ │ │ ├── PrototypeDescriptor.js │ │ │ │ ├── ExtendNonConstructableFunction.js │ │ │ │ ├── SuperWithoutExtends.js │ │ │ │ ├── NewClassExpression.js │ │ │ │ ├── InheritanceNameBinding.js │ │ │ │ ├── Inheritance.js │ │ │ │ ├── RestParams.js │ │ │ │ ├── SuperChangeProto.js │ │ │ │ ├── Types.js │ │ │ │ ├── SuperPostfix.js │ │ │ │ ├── Fields.js │ │ │ │ ├── InheritanceFromNonclass.js │ │ │ │ ├── OptionalParams.js │ │ │ │ ├── Getters.js │ │ │ │ ├── ConstructorChaining.js │ │ │ │ ├── FieldInitializers.js │ │ │ │ ├── Method.js │ │ │ │ ├── SuperUnary.js │ │ │ │ ├── SuperChaining.js │ │ │ │ └── Skip_HTMLBlockquoteElement.js │ │ │ ├── TemplateLiterals │ │ │ │ ├── resources │ │ │ │ │ ├── f.js │ │ │ │ │ ├── m.js │ │ │ │ │ └── n.js │ │ │ │ ├── InModule.js │ │ │ │ ├── Error_NotClosed.js │ │ │ │ ├── Error_InvalidSubstitution.js │ │ │ │ ├── Error_InvalidSubstitution2.js │ │ │ │ ├── Strict.js │ │ │ │ ├── InBlock.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── CommaExpression.js │ │ │ │ ├── StringRaw.js │ │ │ │ ├── CallExpression.js │ │ │ │ └── MemberExpression.js │ │ │ ├── ObjectInitialiserShorthand │ │ │ │ ├── Error_Keyword.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── Error_MissingVar.js │ │ │ │ └── Ok.js │ │ │ ├── Rest │ │ │ │ ├── Strict.js │ │ │ │ ├── Error_SetAccessor.js │ │ │ │ ├── Error_NotLast.js │ │ │ │ └── Simple.js │ │ │ ├── Spread │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── CallWithUndefined.js │ │ │ │ ├── Call.js │ │ │ │ ├── NewBuiltin.js │ │ │ │ ├── Array.js │ │ │ │ ├── MethodCall.js │ │ │ │ ├── New.js │ │ │ │ ├── MethodCallQuotedName.js │ │ │ │ ├── Class.js │ │ │ │ └── New2.js │ │ │ ├── Yield │ │ │ │ ├── Error_MissingStar.js │ │ │ │ ├── DefaultArguments.js │ │ │ │ ├── EmptyGenerator.js │ │ │ │ ├── This.js │ │ │ │ ├── Error_Disabled2.js │ │ │ │ ├── Arguments.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── GeneratorWithoutYieldOrReturn.js │ │ │ │ ├── CommaOperator.js │ │ │ │ ├── BinaryOperator.js │ │ │ │ ├── LabelledBlockGenerator.js │ │ │ │ ├── ReturnYieldFor.js │ │ │ │ ├── IfStatementWithYield.js │ │ │ │ ├── SimpleGenerator.js │ │ │ │ ├── ForEmptyGenerator.js │ │ │ │ ├── Continue.js │ │ │ │ ├── DoGenerator.js │ │ │ │ ├── YieldAssignThrow.js │ │ │ │ ├── ForLexicallyNestedGenerator.js │ │ │ │ ├── Finally.js │ │ │ │ ├── SequenceGenerator.js │ │ │ │ ├── TryCatchYieldGenerator.js │ │ │ │ ├── YieldIdentifier.js │ │ │ │ ├── YieldYield.js │ │ │ │ ├── ForInGenerator3.js │ │ │ │ ├── IfGenerator.js │ │ │ │ ├── WhileGenerator.js │ │ │ │ ├── ForInGenerator.js │ │ │ │ ├── SwitchStatementWithYield.js │ │ │ │ ├── YieldUndefinedGenerator.js │ │ │ │ ├── ForGenerator.js │ │ │ │ └── ForInGenerator2.js │ │ │ ├── ArrowFunctions │ │ │ │ ├── Error_FreeVariableChecker.js │ │ │ │ ├── Error_CoverInitialiser2.js │ │ │ │ ├── FreeVariableChecker.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── Arguments.js │ │ │ │ ├── Error_SpreadOutsideFormals.js │ │ │ │ ├── Error_Precedence.js │ │ │ │ ├── Error_InvalidFormalParameters.js │ │ │ │ ├── CoverInitialiser.js │ │ │ │ ├── Error_Precedence3.js │ │ │ │ ├── Error_CoverInitialiser.js │ │ │ │ ├── Error_Precedence2.js │ │ │ │ ├── Error_SpreadNotLast.js │ │ │ │ ├── AlphaRename.js │ │ │ │ ├── Skip_SoftBind.js │ │ │ │ ├── ThisBindings.js │ │ │ │ └── Skip_InitialiserShorthand.js │ │ │ ├── Destructuring │ │ │ │ ├── DefaultParams.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── Strict.js │ │ │ │ ├── Error_InvalidCoverInitialisedName.js │ │ │ │ ├── Error_InvalidArrowRest.js │ │ │ │ ├── FunctionObjectPattern.js │ │ │ │ ├── Error_ForInWithInitializer.js │ │ │ │ ├── Error_Catch.js │ │ │ │ ├── Error_ForOfWithInitializer.js │ │ │ │ ├── Method.js │ │ │ │ ├── SetAccessor.js │ │ │ │ ├── Arguments.js │ │ │ │ ├── EvaluatesToRvalue.js │ │ │ │ ├── EvaluationOrder.js │ │ │ │ ├── TopLevel.js │ │ │ │ ├── FunctionArrayPattern.js │ │ │ │ ├── ScopeThis.js │ │ │ │ ├── Empty.js │ │ │ │ ├── NestedScopeArguments.js │ │ │ │ ├── ArrowFunction.js │ │ │ │ ├── Catch.js │ │ │ │ ├── Rest.js │ │ │ │ ├── Array.js │ │ │ │ └── ForOfLoop.js │ │ │ ├── Scope │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── Error_ForInWithInitializerLet.js │ │ │ │ ├── Error_ConstMissingInitializer.js │ │ │ │ ├── LetNoInitializerGlobal.js │ │ │ │ ├── Error_ForWithoutInitializerConst.js │ │ │ │ ├── ForInWithInitializerVar.js │ │ │ │ ├── Error_ForOfWithInitializerLet.js │ │ │ │ ├── Error_ForOfWithInitializerVar.js │ │ │ │ ├── NameBindingInFunction.js │ │ │ │ ├── TopLevelLet.js │ │ │ │ ├── Error_ForOfWithInitializerConst.js │ │ │ │ ├── LetInitializerFor1.js │ │ │ │ ├── Error_ForInWithInitializerConst.js │ │ │ │ ├── LetInFor.js │ │ │ │ ├── LetNoInitializer.js │ │ │ │ ├── LetInitializerFor2.js │ │ │ │ ├── NestedLet.js │ │ │ │ ├── NestedFunction3.js │ │ │ │ ├── LetInitializerForIn.js │ │ │ │ ├── NestedFunction1.js │ │ │ │ ├── TopLevelLetVar.js │ │ │ │ ├── TopLevelLetConst.js │ │ │ │ ├── BlockBinding8.js │ │ │ │ ├── BlockBinding9.js │ │ │ │ ├── LetInForBreak.js │ │ │ │ ├── LetInForContinue.js │ │ │ │ ├── BlockBinding10.js │ │ │ │ ├── LetInitializerFor3.js │ │ │ │ ├── LetWithForIn.js │ │ │ │ ├── DeepNestedLet.js │ │ │ │ ├── LetWithFor.js │ │ │ │ ├── NestedFunction2.js │ │ │ │ ├── DeepNestedLetVarNoInit.js │ │ │ │ ├── DeepNestedLetVar.js │ │ │ │ ├── DeepNestedLetConst.js │ │ │ │ ├── LetInForBreakInner.js │ │ │ │ ├── Error_FunctionExpressionInBlock.js │ │ │ │ ├── LetInForContinueInner.js │ │ │ │ ├── Error_BlockBinding1.js │ │ │ │ ├── LetInForBreakNamed.js │ │ │ │ ├── LetInForContinueNamed.js │ │ │ │ ├── LetWithSwitch.js │ │ │ │ ├── BlockBinding7.js │ │ │ │ ├── LetWithSwitch2.js │ │ │ │ ├── DeconstructingBlockBinding.js │ │ │ │ ├── LetInClass.js │ │ │ │ ├── BlockBinding6.js │ │ │ │ ├── BlockBinding3.js │ │ │ │ ├── BlockBinding4.js │ │ │ │ ├── LetInProperties.js │ │ │ │ ├── LetForInitializers1.js │ │ │ │ ├── BlockBinding2.js │ │ │ │ ├── BlockBinding5.js │ │ │ │ └── LetInClosure.js │ │ │ ├── DefaultParameters │ │ │ │ ├── Strict.js │ │ │ │ └── Error_SetAccessor.js │ │ │ ├── ArrayComprehension │ │ │ │ ├── Error_NotDefined.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ └── Closure.js │ │ │ ├── Annotations │ │ │ │ ├── resources │ │ │ │ │ ├── exported-default-function.js │ │ │ │ │ ├── exported-default-class.js │ │ │ │ │ ├── exported-functions.js │ │ │ │ │ ├── exported-classes.js │ │ │ │ │ └── setup.js │ │ │ │ ├── UnannotatedUntypedFunction.js │ │ │ │ ├── SimpleFunction.js │ │ │ │ ├── GeneratorFunction.js │ │ │ │ ├── Error_annotated_var.js │ │ │ │ ├── FunctionParameter.js │ │ │ │ ├── ConstructorParam.js │ │ │ │ ├── Constructor.js │ │ │ │ ├── MethodParam.js │ │ │ │ ├── AnnotatedTypedParam.js │ │ │ │ ├── FunctionMultipleParameters.js │ │ │ │ ├── AnnotatedFunctionTypedParam.js │ │ │ │ ├── MultipleAnnotatedFunction.js │ │ │ │ ├── ClassConstructor.js │ │ │ │ ├── SetterParam.js │ │ │ │ ├── StaticGetter.js │ │ │ │ ├── FunctionMultipleAnnotatedParameter.js │ │ │ │ ├── StaticMethod.js │ │ │ │ ├── ClassInsideObjectGetter.js │ │ │ │ ├── NestedFunction.js │ │ │ │ ├── PropertyMethodStringName.js │ │ │ │ ├── FunctionInsideClassGetter.js │ │ │ │ ├── MultipleParameterTypes.js │ │ │ │ ├── StaticSetter.js │ │ │ │ ├── ClassGeneratorMethod.js │ │ │ │ ├── GetAccessorStringName.js │ │ │ │ ├── ExportedFunction.js │ │ │ │ ├── ExportedClass.js │ │ │ │ ├── AnnotatedTypedClass.js │ │ │ │ └── UnannotatedTypedClass.js │ │ │ ├── GeneratorComprehension │ │ │ │ ├── Error_NotDefined.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ └── Skip_Closure.js │ │ │ ├── FreeVariableChecker │ │ │ │ ├── Typeof.js │ │ │ │ ├── Error_With.js │ │ │ │ ├── WithBasic.js │ │ │ │ └── WithVarDecl.js │ │ │ ├── NumericLiteral │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── Error_NoOctalDigits.js │ │ │ │ └── Error_NoBinaryDigits.js │ │ │ ├── PropertyMethodAssignment │ │ │ │ ├── Error_NotNamed.js │ │ │ │ └── Error_Disabled.js │ │ │ ├── ComputedPropertyNames │ │ │ │ ├── Symbol.js │ │ │ │ └── Error_Disabled.js │ │ │ ├── Promise.js │ │ │ ├── TypeAssertions │ │ │ │ ├── resources │ │ │ │ │ └── exported-function.js │ │ │ │ ├── DefaultParam.js │ │ │ │ ├── ExportedFunction.js │ │ │ │ ├── Variables.js │ │ │ │ └── PrimitiveValueTypes.js │ │ │ ├── Types │ │ │ │ ├── TypeAnnotations.js │ │ │ │ └── TypeSyntax.js │ │ │ ├── Symbol │ │ │ │ ├── TransformationOff.js │ │ │ │ ├── GetOwnPropertySymbols.js │ │ │ │ ├── ObjectModel.js │ │ │ │ └── Inherited.js │ │ │ ├── AsyncFunctions │ │ │ │ ├── PromiseCast.js │ │ │ │ ├── AsyncSyntax.js │ │ │ │ ├── Yield.js │ │ │ │ ├── Complete.js │ │ │ │ ├── Error_Disabled.js │ │ │ │ ├── AsyncMethodObjectLiteral.js │ │ │ │ ├── AlphaRenaming.js │ │ │ │ ├── Finally.js │ │ │ │ ├── Timeout.js │ │ │ │ ├── Value.js │ │ │ │ ├── Throw.js │ │ │ │ └── AsyncMethod.js │ │ │ ├── Tools │ │ │ │ └── FreeVariableChecker.js │ │ │ ├── TempVarTransformer │ │ │ │ └── UseStrictDirective.js │ │ │ ├── ObjectMixin.js │ │ │ ├── ObjectAssign.js │ │ │ ├── PromiseThrowInResolve.js │ │ │ └── ArrayIterator.js │ │ ├── amd │ │ │ ├── deps │ │ │ │ ├── side-effect.js │ │ │ │ ├── side-effect2.js │ │ │ │ ├── foo.js │ │ │ │ └── bar.js │ │ │ ├── NamedExports.js │ │ │ ├── BasicImport.js │ │ │ ├── NestedImport.js │ │ │ ├── ImportNoImportClause.js │ │ │ ├── ImportEmptyImportClause.js │ │ │ ├── MultipleImports.js │ │ │ └── NamedImports.js │ │ ├── unit │ │ │ ├── node │ │ │ │ └── resources │ │ │ │ │ ├── x.js │ │ │ │ │ ├── only-export.js │ │ │ │ │ ├── reexport-x.js │ │ │ │ │ ├── compile-dir │ │ │ │ │ ├── dep.js │ │ │ │ │ └── file.js │ │ │ │ │ ├── import-export.js │ │ │ │ │ ├── iAmScript.js │ │ │ │ │ ├── iAmScriptAlso.es │ │ │ │ │ ├── import-x.js │ │ │ │ │ ├── import-another-x.js │ │ │ │ │ ├── export-default.js │ │ │ │ │ ├── export-default-class.js │ │ │ │ │ ├── class.js │ │ │ │ │ └── generator.js │ │ │ └── runtime │ │ │ │ ├── test_a.js │ │ │ │ ├── test_c.js │ │ │ │ ├── subdir │ │ │ │ ├── test_e.js │ │ │ │ └── test_d.js │ │ │ │ ├── throwsError.js │ │ │ │ ├── test_b.js │ │ │ │ ├── side-effect.js │ │ │ │ ├── throwsError.output │ │ │ │ ├── test_script.js │ │ │ │ ├── test_module.js │ │ │ │ └── test_source_map_module.js │ │ ├── commonjs │ │ │ ├── deps │ │ │ │ ├── side-effect.js │ │ │ │ ├── side-effect2.js │ │ │ │ ├── foo.js │ │ │ │ └── bar.js │ │ │ ├── BasicImport.js │ │ │ ├── NestedImport.js │ │ │ ├── ImportNoImportClause.js │ │ │ ├── ImportEmptyImportClause.js │ │ │ ├── MultipleImports.js │ │ │ └── NamedImports.js │ │ └── node-commonjs-test.js │ ├── traceur │ ├── traceur-build │ ├── third_party │ │ ├── codemirror-3.22 │ │ │ ├── .travis.yml │ │ │ ├── .gitignore │ │ │ ├── doc │ │ │ │ └── logo.png │ │ │ ├── .gitattributes │ │ │ ├── theme │ │ │ │ └── ambiance-mobile.css │ │ │ ├── addon │ │ │ │ ├── display │ │ │ │ │ └── fullscreen.css │ │ │ │ ├── lint │ │ │ │ │ └── yaml-lint.js │ │ │ │ ├── fold │ │ │ │ │ └── foldgutter.css │ │ │ │ └── edit │ │ │ │ │ └── trailingspace.js │ │ │ ├── test │ │ │ │ └── mode_test.css │ │ │ ├── mode │ │ │ │ ├── rpm │ │ │ │ │ └── spec │ │ │ │ │ │ └── spec.css │ │ │ │ ├── tiddlywiki │ │ │ │ │ └── tiddlywiki.css │ │ │ │ ├── ruby │ │ │ │ │ └── test.js │ │ │ │ └── tiki │ │ │ │ │ └── tiki.css │ │ │ ├── bower.json │ │ │ └── bin │ │ │ │ ├── authors.sh │ │ │ │ └── lint │ │ └── README │ ├── logo │ │ ├── tc.ai │ │ ├── tc.eps │ │ ├── tc.jpg │ │ └── tc.png │ ├── index.html │ ├── codereview.settings │ ├── build │ │ └── parse-tree-visitor.header │ └── demo │ │ ├── async-read-file.js │ │ └── expressServer.js │ └── audioContextPolyfill.js ├── chapter01 ├── modules │ ├── fifthModule.js │ ├── firstModule.js │ ├── secondModule.js │ ├── sixthModule.js │ ├── fourthModule.js │ ├── thirdModule.js │ ├── Animal.js │ └── index.html ├── images │ ├── cat.png │ ├── makeBig.png │ ├── makeSmall.png │ ├── ratio_16x9.png │ ├── ratio_4x3.png │ ├── screenShot.png │ ├── sourcePage.png │ └── spritesheet.png ├── iframes │ └── .sourcePage.html.swp ├── rooms.json ├── 03_forEach.html ├── 08_objectKeys.html ├── 05_forEachWithAnIndexCounter.html ├── 06_forEachWithArrowFunction.html └── 24_gettersAndSetters.html ├── chapter10 ├── .swp ├── images │ └── animals.png └── .followingPaths.html.swp ├── chapter08 ├── images │ ├── 0.png │ ├── 1.png │ ├── 2.png │ ├── 3.png │ ├── sky.png │ ├── finish.png │ ├── forest.png │ ├── green.png │ ├── pink.png │ ├── star.png │ ├── states.png │ ├── tile.png │ ├── violet.png │ ├── yellow.png │ ├── animals.png │ ├── flappyFairy.png │ ├── greenBlock.png │ └── walkcycle.png ├── .01_states.html.swo ├── .01_states.html.swp └── .07_flappyFairy.html.swp ├── chapter02 ├── images │ ├── cat.png │ └── tileset.png ├── fonts │ └── puzzler.otf └── .jshintrc ├── chapter03 ├── images │ ├── cat.png │ ├── tiger.png │ ├── animals.png │ └── hedgehog.png ├── fonts │ ├── PetMe64.ttf │ └── puzzler.otf └── json │ └── rooms.json ├── chapter04 ├── images │ ├── cat.png │ ├── up.png │ ├── button.png │ ├── down.png │ ├── fairy.png │ ├── over.png │ ├── tiger.png │ ├── animals.png │ └── hedgehog.png └── fonts │ ├── PetMe64.ttf │ └── puzzler.otf ├── chapter06 ├── images │ ├── cat.png │ ├── up.png │ ├── button.png │ ├── down.png │ ├── over.png │ ├── tiger.png │ ├── animals.png │ └── hedgehog.png └── fonts │ ├── PetMe64.ttf │ └── puzzler.otf ├── chapter07 ├── images │ ├── cat.png │ ├── sky.png │ ├── blob.png │ ├── cloud.png │ ├── door.png │ ├── grass.png │ ├── rock.png │ ├── star.png │ ├── dungeon.png │ ├── explorer.png │ ├── marbles.png │ ├── treasure.png │ ├── platforms.png │ └── treasureHunter.png ├── fonts │ ├── PetMe64.ttf │ └── puzzler.otf └── .05_rectangleCollision.html.swp ├── chapter09 └── sounds │ ├── bounce.mp3 │ ├── music.wav │ ├── shoot.wav │ ├── explosion.wav │ └── audioTileset.wav ├── chapter12 └── images │ ├── phobos.png │ └── spaceship.png ├── chapter11 ├── images │ └── animals.png ├── bloxyee │ ├── images │ │ ├── red.png │ │ ├── up.png │ │ ├── ball.png │ │ ├── blue.png │ │ ├── down.png │ │ ├── green.png │ │ ├── over.png │ │ ├── star.png │ │ ├── title.png │ │ ├── bloxyee.png │ │ ├── orange.png │ │ ├── paddle.png │ │ └── violet.png │ ├── sounds │ │ ├── music.wav │ │ └── bounce.wav │ ├── .bloxyee.html.swn │ ├── .bloxyee.html.swo │ ├── .bloxyee.html.swp │ └── fonts │ │ └── puzzler.otf └── .01_basicEngine.html.swp └── README.md /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/wiki/.gitignore: -------------------------------------------------------------------------------- 1 | !out -------------------------------------------------------------------------------- /chapter01/modules/fifthModule.js: -------------------------------------------------------------------------------- 1 | export let mood = "Happy"; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Empty.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/null.js: -------------------------------------------------------------------------------- 1 | null -------------------------------------------------------------------------------- /chapter10/.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter10/.swp -------------------------------------------------------------------------------- /chapter01/modules/firstModule.js: -------------------------------------------------------------------------------- 1 | export let hello = "Hello from the firstModule!"; 2 | -------------------------------------------------------------------------------- /chapter01/modules/secondModule.js: -------------------------------------------------------------------------------- 1 | export let hello = "Hello from the secondModule!"; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/deps/side-effect.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/deps/side-effect2.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/x.js: -------------------------------------------------------------------------------- 1 | export var x = 'x'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_a.js: -------------------------------------------------------------------------------- 1 | export var name = 'A'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_c.js: -------------------------------------------------------------------------------- 1 | export var name = 'C'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/NamedExports.js: -------------------------------------------------------------------------------- 1 | export var someExport = 'val'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/deps/side-effect.js: -------------------------------------------------------------------------------- 1 | this.sideEffect++; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/deps/side-effect2.js: -------------------------------------------------------------------------------- 1 | this.sideEffect++; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/a.js: -------------------------------------------------------------------------------- 1 | export var a = 'A'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/c.js: -------------------------------------------------------------------------------- 1 | export var c = 'C'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/x.js: -------------------------------------------------------------------------------- 1 | export var x = 'X'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/only-export.js: -------------------------------------------------------------------------------- 1 | export var x = 6; -------------------------------------------------------------------------------- /chapter08/images/0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/0.png -------------------------------------------------------------------------------- /chapter08/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/1.png -------------------------------------------------------------------------------- /chapter08/images/2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/2.png -------------------------------------------------------------------------------- /chapter08/images/3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/3.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SemiColon.js: -------------------------------------------------------------------------------- 1 | class SemiColon { 2 | ; 3 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/a2.js: -------------------------------------------------------------------------------- 1 | export var a = 'A2'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/b.js: -------------------------------------------------------------------------------- 1 | module c from './c'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/d.js: -------------------------------------------------------------------------------- 1 | export * from './a'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/default.js: -------------------------------------------------------------------------------- 1 | export default 42; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/reexport-x.js: -------------------------------------------------------------------------------- 1 | export {x} from "./x"; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/subdir/test_e.js: -------------------------------------------------------------------------------- 1 | export var name = 'E'; 2 | -------------------------------------------------------------------------------- /chapter01/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/cat.png -------------------------------------------------------------------------------- /chapter02/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter02/images/cat.png -------------------------------------------------------------------------------- /chapter03/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/images/cat.png -------------------------------------------------------------------------------- /chapter04/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/cat.png -------------------------------------------------------------------------------- /chapter04/images/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/up.png -------------------------------------------------------------------------------- /chapter06/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/cat.png -------------------------------------------------------------------------------- /chapter06/images/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/up.png -------------------------------------------------------------------------------- /chapter07/images/cat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/cat.png -------------------------------------------------------------------------------- /chapter07/images/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/sky.png -------------------------------------------------------------------------------- /chapter08/images/sky.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/sky.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/f.js: -------------------------------------------------------------------------------- 1 | export var f = () => this; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/side-effect.js: -------------------------------------------------------------------------------- 1 | this.sideEffect++; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/compile-dir/dep.js: -------------------------------------------------------------------------------- 1 | export var q = 'q'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/throwsError.js: -------------------------------------------------------------------------------- 1 | throw new Error('test-intepreter'); -------------------------------------------------------------------------------- /chapter01/modules/sixthModule.js: -------------------------------------------------------------------------------- 1 | (() => { 2 | console.log("Hello from the sixthModule"); 3 | })(); 4 | -------------------------------------------------------------------------------- /chapter02/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter02/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter03/fonts/PetMe64.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/fonts/PetMe64.ttf -------------------------------------------------------------------------------- /chapter03/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter03/images/tiger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/images/tiger.png -------------------------------------------------------------------------------- /chapter04/fonts/PetMe64.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/fonts/PetMe64.ttf -------------------------------------------------------------------------------- /chapter04/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter04/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/button.png -------------------------------------------------------------------------------- /chapter04/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/down.png -------------------------------------------------------------------------------- /chapter04/images/fairy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/fairy.png -------------------------------------------------------------------------------- /chapter04/images/over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/over.png -------------------------------------------------------------------------------- /chapter04/images/tiger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/tiger.png -------------------------------------------------------------------------------- /chapter06/fonts/PetMe64.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/fonts/PetMe64.ttf -------------------------------------------------------------------------------- /chapter06/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter06/images/button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/button.png -------------------------------------------------------------------------------- /chapter06/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/down.png -------------------------------------------------------------------------------- /chapter06/images/over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/over.png -------------------------------------------------------------------------------- /chapter06/images/tiger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/tiger.png -------------------------------------------------------------------------------- /chapter07/fonts/PetMe64.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/fonts/PetMe64.ttf -------------------------------------------------------------------------------- /chapter07/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter07/images/blob.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/blob.png -------------------------------------------------------------------------------- /chapter07/images/cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/cloud.png -------------------------------------------------------------------------------- /chapter07/images/door.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/door.png -------------------------------------------------------------------------------- /chapter07/images/grass.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/grass.png -------------------------------------------------------------------------------- /chapter07/images/rock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/rock.png -------------------------------------------------------------------------------- /chapter07/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/star.png -------------------------------------------------------------------------------- /chapter08/images/finish.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/finish.png -------------------------------------------------------------------------------- /chapter08/images/forest.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/forest.png -------------------------------------------------------------------------------- /chapter08/images/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/green.png -------------------------------------------------------------------------------- /chapter08/images/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/pink.png -------------------------------------------------------------------------------- /chapter08/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/star.png -------------------------------------------------------------------------------- /chapter08/images/states.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/states.png -------------------------------------------------------------------------------- /chapter08/images/tile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/tile.png -------------------------------------------------------------------------------- /chapter08/images/violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/violet.png -------------------------------------------------------------------------------- /chapter08/images/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/yellow.png -------------------------------------------------------------------------------- /chapter09/sounds/bounce.mp3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter09/sounds/bounce.mp3 -------------------------------------------------------------------------------- /chapter09/sounds/music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter09/sounds/music.wav -------------------------------------------------------------------------------- /chapter09/sounds/shoot.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter09/sounds/shoot.wav -------------------------------------------------------------------------------- /chapter12/images/phobos.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter12/images/phobos.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/traceur: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('./src/node/command.js'); 4 | -------------------------------------------------------------------------------- /chapter01/images/makeBig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/makeBig.png -------------------------------------------------------------------------------- /chapter02/images/tileset.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter02/images/tileset.png -------------------------------------------------------------------------------- /chapter03/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/images/animals.png -------------------------------------------------------------------------------- /chapter03/images/hedgehog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter03/images/hedgehog.png -------------------------------------------------------------------------------- /chapter04/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/animals.png -------------------------------------------------------------------------------- /chapter04/images/hedgehog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter04/images/hedgehog.png -------------------------------------------------------------------------------- /chapter06/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/animals.png -------------------------------------------------------------------------------- /chapter06/images/hedgehog.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter06/images/hedgehog.png -------------------------------------------------------------------------------- /chapter07/images/dungeon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/dungeon.png -------------------------------------------------------------------------------- /chapter07/images/explorer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/explorer.png -------------------------------------------------------------------------------- /chapter07/images/marbles.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/marbles.png -------------------------------------------------------------------------------- /chapter07/images/treasure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/treasure.png -------------------------------------------------------------------------------- /chapter08/.01_states.html.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/.01_states.html.swo -------------------------------------------------------------------------------- /chapter08/.01_states.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/.01_states.html.swp -------------------------------------------------------------------------------- /chapter08/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/animals.png -------------------------------------------------------------------------------- /chapter10/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter10/images/animals.png -------------------------------------------------------------------------------- /chapter11/images/animals.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/images/animals.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/EmptyNamedImport.js: -------------------------------------------------------------------------------- 1 | import {} from './resources/m'; 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/m2.js: -------------------------------------------------------------------------------- 1 | var z = 'z'; 2 | export {z as var}; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/side-effect2.js: -------------------------------------------------------------------------------- 1 | this.sideEffect++; 2 | 3 | 4 | -------------------------------------------------------------------------------- /chapter01/images/makeSmall.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/makeSmall.png -------------------------------------------------------------------------------- /chapter01/images/ratio_16x9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/ratio_16x9.png -------------------------------------------------------------------------------- /chapter01/images/ratio_4x3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/ratio_4x3.png -------------------------------------------------------------------------------- /chapter01/images/screenShot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/screenShot.png -------------------------------------------------------------------------------- /chapter01/images/sourcePage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/sourcePage.png -------------------------------------------------------------------------------- /chapter01/images/spritesheet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/images/spritesheet.png -------------------------------------------------------------------------------- /chapter01/modules/fourthModule.js: -------------------------------------------------------------------------------- 1 | export {x, y}; 2 | 3 | let x = 10, 4 | y = 20, 5 | z = 30; 6 | 7 | 8 | -------------------------------------------------------------------------------- /chapter07/images/platforms.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/platforms.png -------------------------------------------------------------------------------- /chapter08/images/flappyFairy.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/flappyFairy.png -------------------------------------------------------------------------------- /chapter08/images/greenBlock.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/greenBlock.png -------------------------------------------------------------------------------- /chapter08/images/walkcycle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/images/walkcycle.png -------------------------------------------------------------------------------- /chapter09/sounds/explosion.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter09/sounds/explosion.wav -------------------------------------------------------------------------------- /chapter11/bloxyee/images/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/red.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/up.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/up.png -------------------------------------------------------------------------------- /chapter12/images/spaceship.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter12/images/spaceship.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/m.js: -------------------------------------------------------------------------------- 1 | export var a = 1; 2 | export var b = 2; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/n.js: -------------------------------------------------------------------------------- 1 | export var c = 3; 2 | export var d = 4; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/traceur-build: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | require('./build/node/command.js'); 4 | -------------------------------------------------------------------------------- /chapter08/.07_flappyFairy.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter08/.07_flappyFairy.html.swp -------------------------------------------------------------------------------- /chapter09/sounds/audioTileset.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter09/sounds/audioTileset.wav -------------------------------------------------------------------------------- /chapter10/.followingPaths.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter10/.followingPaths.html.swp -------------------------------------------------------------------------------- /chapter11/.01_basicEngine.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/.01_basicEngine.html.swp -------------------------------------------------------------------------------- /chapter11/bloxyee/images/ball.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/ball.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/blue.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/down.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/down.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/green.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/over.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/over.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/star.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/title.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/title.png -------------------------------------------------------------------------------- /chapter11/bloxyee/sounds/music.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/sounds/music.wav -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/default-name.js: -------------------------------------------------------------------------------- 1 | var p = 4; 2 | export {p as default}; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/m3.js: -------------------------------------------------------------------------------- 1 | import {var as x} from './m2'; 2 | export {x}; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/o.js: -------------------------------------------------------------------------------- 1 | export * from './m'; 2 | export * from './n'; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_b.js: -------------------------------------------------------------------------------- 1 | module c from './test_c'; 2 | 3 | export var name = 'B'; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | -------------------------------------------------------------------------------- /chapter01/modules/thirdModule.js: -------------------------------------------------------------------------------- 1 | export {color, shape}; 2 | 3 | let color = "red", 4 | shape = "circle"; 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /chapter07/images/treasureHunter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/images/treasureHunter.png -------------------------------------------------------------------------------- /chapter11/bloxyee/.bloxyee.html.swn: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/.bloxyee.html.swn -------------------------------------------------------------------------------- /chapter11/bloxyee/.bloxyee.html.swo: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/.bloxyee.html.swo -------------------------------------------------------------------------------- /chapter11/bloxyee/.bloxyee.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/.bloxyee.html.swp -------------------------------------------------------------------------------- /chapter11/bloxyee/fonts/puzzler.otf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/fonts/puzzler.otf -------------------------------------------------------------------------------- /chapter11/bloxyee/images/bloxyee.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/bloxyee.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/orange.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/paddle.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/paddle.png -------------------------------------------------------------------------------- /chapter11/bloxyee/images/violet.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/images/violet.png -------------------------------------------------------------------------------- /chapter11/bloxyee/sounds/bounce.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter11/bloxyee/sounds/bounce.wav -------------------------------------------------------------------------------- /chapter01/iframes/.sourcePage.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter01/iframes/.sourcePage.html.swp -------------------------------------------------------------------------------- /chapter07/.05_rectangleCollision.html.swp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/chapter07/.05_rectangleCollision.html.swp -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportAsExportAs.js: -------------------------------------------------------------------------------- 1 | module m from './resources/m3'; 2 | assert.equal(m.x, 'z'); 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/i.js: -------------------------------------------------------------------------------- 1 | export var i = 0; 2 | export function inc() { 3 | i++; 4 | } 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/RegularExpression.js: -------------------------------------------------------------------------------- 1 | var re1 = /a*b/; 2 | var re2 = /=a+/; 3 | var re3 = /\//; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/resources/f.js: -------------------------------------------------------------------------------- 1 | export function f(...args) { 2 | return args; 3 | } 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/compile-dir/file.js: -------------------------------------------------------------------------------- 1 | import {q} from './dep'; 2 | export var p = 'module'; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/import-export.js: -------------------------------------------------------------------------------- 1 | import Q from './export-default-class'; 2 | export {Q}; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/logo/tc.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/library/plugins/traceur-compiler/logo/tc.ai -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/logo/tc.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/library/plugins/traceur-compiler/logo/tc.eps -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/logo/tc.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/library/plugins/traceur-compiler/logo/tc.jpg -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/logo/tc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/library/plugins/traceur-compiler/logo/tc.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/BasicImport.js: -------------------------------------------------------------------------------- 1 | import {Foo} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', Foo); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/NestedImport.js: -------------------------------------------------------------------------------- 1 | import {Bar} from './deps/bar'; 2 | 3 | assert.equal('Bar from bar.js', Bar); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ModuleName.module.js: -------------------------------------------------------------------------------- 1 | assert.equal(__moduleName, 'feature/Modules/ModuleName.module'); 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/iAmScript.js: -------------------------------------------------------------------------------- 1 | iAmScript = true; // The last statement becomes the value of the Script. -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/side-effect.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 6; 2 | export var currentSideEffect = () => this.sideEffect; -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/subdir/test_d.js: -------------------------------------------------------------------------------- 1 | module e from './test_e'; 2 | export {e}; 3 | export var name = 'D'; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/throwsError.output: -------------------------------------------------------------------------------- 1 | ./traceur test/unit/runtime/throwsError.js 2>&1 | wc -l 2 | 11 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/BasicImport.js: -------------------------------------------------------------------------------- 1 | import {Foo} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', Foo); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/NestedImport.js: -------------------------------------------------------------------------------- 1 | import {Bar} from './deps/bar'; 2 | 3 | assert.equal('Bar from bar.js', Bar); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectInitialiserShorthand/Error_Keyword.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | var object = {var}; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/InModule.js: -------------------------------------------------------------------------------- 1 | module m from './resources/m'; 2 | module n from './resources/n'; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/iAmScriptAlso.es: -------------------------------------------------------------------------------- 1 | iAmScript = true; // The last statement becomes the value of the Script. -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --classes=false 3 | 4 | class C {} 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ModuleDefault.js: -------------------------------------------------------------------------------- 1 | module m from './resources/default'; 2 | 3 | assert.equal(m.default, 42); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/export-conflict.js: -------------------------------------------------------------------------------- 1 | export var a = 'a'; 2 | export * from './a'; // also exports a 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/resources/m.js: -------------------------------------------------------------------------------- 1 | import {f} from './f'; 2 | 3 | assert.equal('a', (f `a`)[0][0]); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/resources/n.js: -------------------------------------------------------------------------------- 1 | import {f} from './f'; 2 | 3 | assert.equal('b', (f `b`)[0][0]); 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /npm-debug.log 3 | test.html 4 | .tern-* 5 | *~ 6 | *.swp 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/index.html: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/default-class.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | m() { 3 | return 'm'; 4 | } 5 | }; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Rest/Strict.js: -------------------------------------------------------------------------------- 1 | function f(...xs) { 2 | 'use strict'; 3 | return this; 4 | } 5 | 6 | assert.isUndefined(f()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --spread=false 3 | 4 | [0, 1, ...[2, 3]]; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/ImplicitSemiColon.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | return 3 | 42; 4 | } 5 | 6 | assert.isUndefined(f()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/Error_NotClosed.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | function f() {} 4 | 5 | f`not closed \` 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Error_MissingStar.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | function simpleGenerator() { 4 | yield 1; 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/TestClass.js: -------------------------------------------------------------------------------- 1 | export class TestClass { 2 | static method() { 3 | return 42; 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/Error_InvalidSubstitution.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | function f() {} 4 | 5 | f`a${ ` 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/Error_InvalidSubstitution2.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | function f() {} 4 | 5 | f`a${ }` 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/StaticMethod.js: -------------------------------------------------------------------------------- 1 | import {TestClass} from './resources/TestClass'; 2 | assert.equal(TestClass.method(), 42); 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ThisInModules.js: -------------------------------------------------------------------------------- 1 | var global = this; 2 | 3 | module m from './resources/f'; 4 | assert.equal(global, m.f()); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/deps/foo.js: -------------------------------------------------------------------------------- 1 | export var Foo = 'Foo from foo.js'; 2 | export var Bar = 'Bar from foo.js'; 3 | export var Baz = 'Baz from foo.js'; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_FreeVariableChecker.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | var identity = (identityParam) -> missingIdentifier; 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/DefaultParams.js: -------------------------------------------------------------------------------- 1 | function f([x] = [1], {y} = {y: 2}) { 2 | return x + y; 3 | } 4 | 5 | assert.equal(3, f()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --destructuring=false 3 | 4 | var [x, y] = [0, 1]; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Strict.js: -------------------------------------------------------------------------------- 1 | function f({x}) { 2 | 'use strict'; 3 | return this; 4 | } 5 | 6 | assert.isUndefined(f({x: 42})); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding=false 3 | 4 | { 5 | let x = 42; 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_RegExpNotClosed.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:2: Expected '/' in regular expression literal 3 | 4 | / -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/import-x.js: -------------------------------------------------------------------------------- 1 | import {x} from './reexport-x'; 2 | this.result = x; // To verify execution, test this global value. -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/deps/bar.js: -------------------------------------------------------------------------------- 1 | import {Foo} from './foo'; 2 | 3 | export var Bar = 'Bar from bar.js'; 4 | 5 | assert.equal('Foo from foo.js', Foo); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/deps/foo.js: -------------------------------------------------------------------------------- 1 | export var Foo = 'Foo from foo.js'; 2 | export var Bar = 'Bar from foo.js'; 3 | export var Baz = 'Baz from foo.js'; 4 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_CoverInitialiser2.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:5: Unexpected token '=' 3 | 4 | ({a = 0}); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/FreeVariableChecker.js: -------------------------------------------------------------------------------- 1 | var identity = (identityParam) => identityParam; 2 | assert.equal(1234, identity(1234)); 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/DefaultParameters/Strict.js: -------------------------------------------------------------------------------- 1 | function f(a = 1) { 2 | 'use strict'; 3 | return this; 4 | } 5 | 6 | assert.isUndefined(f()); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ExportKeyword.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:9: 'identifier' expected 3 | 4 | export {if}; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ModuleNoNewline.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:3: Semi-colon expected 3 | 4 | module 5 | m from 'm'; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/DefaultArguments.js: -------------------------------------------------------------------------------- 1 | function* f(x = 1) { 2 | yield x; 3 | } 4 | 5 | for (var x of f(42)) { 6 | assert.equal(42, x); 7 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/deps/bar.js: -------------------------------------------------------------------------------- 1 | import {Foo} from './foo'; 2 | 3 | export var Bar = 'Bar from bar.js'; 4 | 5 | assert.equal('Foo from foo.js', Foo); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --arrow-functions=false 3 | 4 | var identity = (x) -> x; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/ExtendObject.js: -------------------------------------------------------------------------------- 1 | // Can no longer extend objects. 2 | assert.throw(function() { 3 | class C extends {} {} 4 | }, TypeError); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ExportKeyword2.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:9: 'identifier' expected 3 | 4 | export {if as x}; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForInWithInitializerLet.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | for (let i = 0 in {}) { 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/UnicodeEscapeSequenceInName.js: -------------------------------------------------------------------------------- 1 | var a\u0062c = 1; 2 | assert.equal(1, abc); 3 | 4 | var λ = 2; 5 | assert.equal(2, \u03bb); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/EmptyGenerator.js: -------------------------------------------------------------------------------- 1 | function* f() { 2 | } 3 | 4 | var g = f(); 5 | assert.deepEqual(g.next(), {done: true, value: undefined}); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrayComprehension/Error_NotDefined.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | var array = [for (notDefined of [0]) notDefined]; 4 | notDefined; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Arguments.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | var args = (() => arguments)(); 3 | assert.equal(args, arguments); 4 | } 5 | 6 | f(); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_SpreadOutsideFormals.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:13: Unexpected token ... 3 | 4 | var f = (x, ...xs); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_InvalidCoverInitialisedName.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:5: Unexpected token '=' 3 | 4 | ({x = 42}); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_Arguments.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :7:6: Unexpected token ) 3 | 4 | function f(x) { 5 | } 6 | 7 | f(x, ); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_FunctionParam.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 'identifier' expected 3 | 4 | function f(x,) { 5 | return x; 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/Strict.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | function f(...args) { 4 | return this; 5 | } 6 | 7 | assert.equal(undefined, f `a`); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/This.js: -------------------------------------------------------------------------------- 1 | function* f() { 2 | yield this; 3 | } 4 | 5 | var o = {}; 6 | for (var x of f.call(o)) { 7 | assert.equal(o, x); 8 | } 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/import-another-x.js: -------------------------------------------------------------------------------- 1 | export var iAmNotScript = true; 2 | this.result = 17; // To verify execution, test this global value. 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/ImportNoImportClause.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | import './deps/side-effect'; 3 | assert.equal(2, this.sideEffect); 4 | this.sideEffect = 1; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/resources/exported-default-function.js: -------------------------------------------------------------------------------- 1 | import {Anno} from './setup'; 2 | 3 | @Anno 4 | export default function (@Anno x) { 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_Precedence.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:26: Semi-colon expected 3 | 4 | var identity = (x) => {x}.bind({}); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_InvalidArrowRest.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:11: Unexpected token ... 3 | 4 | var f = ([...xs, ys]) => xs; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/GeneratorComprehension/Error_NotDefined.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | var iter = (for (notDefined of [0]) notDefined); 4 | notDefined; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ConstMissingInitializer.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | const x = 1, y; // Missing initialiser! 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_InvalidFormalParameters.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:15: Unexpected token + 3 | 4 | var f = (a, b + 5) => a + b; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/FreeVariableChecker/Typeof.js: -------------------------------------------------------------------------------- 1 | function f() { 2 | if (typeof x1) 3 | x1; 4 | } 5 | 6 | function g() { 7 | typeof x2; 8 | x2; 9 | } 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_InvalidExport.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:9: 'c' is not exported by ' 3 | 4 | export {c} from './resources/a'; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_InvalidModuleDeclaration2.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 4:33: Unexpected token . 3 | 4 | module b from './resources/a.js'.c; -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportNoImportClause.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | import './resources/side-effect'; 3 | assert.equal(2, this.sideEffect); 4 | this.sideEffect = 1; -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetNoInitializerGlobal.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let x2; 4 | assert.equal(undefined, x2); 5 | x2 = 2; 6 | assert.equal(2, x2); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/export-default.js: -------------------------------------------------------------------------------- 1 | export class q { 2 | foo() { 3 | console.log('class method'); 4 | } 5 | } 6 | export default q; 7 | var p = 5; 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/ImportEmptyImportClause.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | import {} from './deps/side-effect2'; 3 | assert.equal(2, this.sideEffect); 4 | this.sideEffect = 1; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/CoverInitialiser.js: -------------------------------------------------------------------------------- 1 | // https://github.com/google/traceur-compiler/issues/478 2 | 3 | function f() { 4 | (1 ? ({a=0}) => {} : 1); 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_InvalidExport2.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:9: 'c' is not exported by ' 3 | 4 | export {c as d} from './resources/a'; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/NumericLiteral/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --numeric-literals=false 3 | // Error: :5:2: Semi-colon expected 4 | 5 | 0b11; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_WithInModule.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 4:1: Strict mode code may not include a with statement 3 | 4 | with ({}) {} 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/InBlock.js: -------------------------------------------------------------------------------- 1 | // This just tests that we do not get any compile errors. 2 | 3 | { 4 | `abc` 5 | } 6 | 7 | (function() { 8 | `def` 9 | }); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Error_Disabled2.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --forOf=false 3 | 4 | var s = []; 5 | for (var i of yieldFor()) { 6 | s.push(i); 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/doc/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kittykatattack/agd/HEAD/library/plugins/traceur-compiler/third_party/codemirror-3.22/doc/logo.png -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/FunctionObjectPattern.js: -------------------------------------------------------------------------------- 1 | function f({a, b: {c}}, d) { 2 | return [a, c, d]; 3 | } 4 | 5 | assertArrayEquals([1, 2, 3], f({a: 1, b: {c: 2}}, 3)); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectInitialiserShorthand/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --property-name-shorthand=false 3 | 4 | var x = 42; 5 | var object = {x}; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --template-literals=false 3 | // Error: :5:1: Unexpected token ` 4 | 5 | `abc`; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_script.js: -------------------------------------------------------------------------------- 1 | import {name as a} from './test_a'; 2 | import {name as b} from './test_b'; 3 | import {name as c} from './test_c'; 4 | 5 | [a, b, c]; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/wiki/CompilingOffline/greeter.js: -------------------------------------------------------------------------------- 1 | // greeter.js 2 | class Greeter { 3 | sayHi() { console.log('Hi!'); } 4 | } 5 | 6 | var greeter = new Greeter(); 7 | greeter.sayHi(); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_Precedence3.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:9: Semi-colon expected 3 | // Error: :5:9: Unexpected token => 4 | 5 | (x) + y => y; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ExportStar.js: -------------------------------------------------------------------------------- 1 | module o from './resources/o'; 2 | 3 | assert.equal(1, o.a); 4 | assert.equal(2, o.b); 5 | assert.equal(3, o.c); 6 | assert.equal(4, o.d); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportEmptyImportClause.js: -------------------------------------------------------------------------------- 1 | this.sideEffect = 1; 2 | import {} from './resources/side-effect2'; 3 | assert.equal(2, this.sideEffect); 4 | this.sideEffect = 1; -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/PropertyMethodAssignment/Error_NotNamed.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | 3 | var object = { 4 | "notNamedField"() { 5 | return notNamedField; 6 | } 7 | }; 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForWithoutInitializerConst.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | var i = 0; 5 | for (const x; i < 3; i++) { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt text 2 | *.js text 3 | *.html text 4 | *.md text 5 | *.json text 6 | *.yml text 7 | *.css text 8 | *.svg text 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | box-shadow: none; 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/resources/exported-default-class.js: -------------------------------------------------------------------------------- 1 | import {Anno} from './setup'; 2 | 3 | @Anno 4 | export default class { 5 | @Anno 6 | annotatedMethod() {} 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_CoverInitialiser.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:16: Unexpected token '=' 3 | 4 | function f() { 5 | ({a = (0, {a = 0})} = {}) 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_Precedence2.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:11: Semi-colon expected 3 | // Error: :5:11: Unexpected token => 4 | 5 | (x) + (y) => y; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ImportStar.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:8: 'string literal' expected 3 | 4 | import * from './resources/m'; 5 | assert.equal(3, a + b); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/resources/clockwise.js: -------------------------------------------------------------------------------- 1 | import {counterclockwise} from '../ImportCircular.module'; 2 | export function clockwise() { 3 | return 'The circle is complete'; 4 | } 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_NoLineTerminatorPostfix.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 7:7: Unexpected token ; 3 | 4 | function f(x) { 5 | var x = 0; 6 | x 7 | ++; 8 | } 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_YieldStarNewLine.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :6:7: Unexpected token * 3 | 4 | function* yieldStarNewLine() { 5 | yield 6 | *42; 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/StaticSymbol.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols 2 | var sym = Symbol(); 3 | class C { 4 | static [sym]() { 5 | return 42; 6 | } 7 | } 8 | assert.equal(C[sym](), 42); 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ComputedPropertyNames/Symbol.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols 2 | 3 | var s = Symbol(); 4 | 5 | var object = { 6 | [s]: 42 7 | }; 8 | 9 | assert.equal(object[s], 42); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_module.js: -------------------------------------------------------------------------------- 1 | export {name as a} from './test_a'; 2 | export {name as b} from './test_b'; 3 | export {name as c} from './test_c'; 4 | 5 | export var name = 'test'; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/ImportNoImportClause.js: -------------------------------------------------------------------------------- 1 | // AMD executes the dependencies before executing the module. 2 | import './deps/side-effect'; 3 | assert.equal(1, this.sideEffect); 4 | this.sideEffect = 0; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_ForInWithInitializer.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: initialiser is not allowed in for-in loop with pattern 3 | 4 | for (var {k} = {} in {}) { 5 | } 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Promise.js: -------------------------------------------------------------------------------- 1 | // Async. 2 | 3 | var p = new Promise((resolve, reject) => { 4 | resolve(42); 5 | }); 6 | p.then((v) => { 7 | assert.equal(v, 42); 8 | done(); 9 | }); 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Advanced Game Design with HTML5 and JavaScript 2 | ============================================== 3 | Source code repository for [Advanced Game Design with HTML5 and 4 | JavaScript] (http://www.apress.com/9781430258001) 5 | -------------------------------------------------------------------------------- /chapter01/modules/Animal.js: -------------------------------------------------------------------------------- 1 | export default class { 2 | constructor() { 3 | this.legs = 4; 4 | this.eyes = 2; 5 | this.say = "Huh?"; 6 | } 7 | speak() { 8 | console.log(this.say); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Error_SpreadNotLast.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :6:17: ')' expected 3 | // Error: :6:12: Unexpected token ... 4 | 5 | { 6 | let f = (...xs, x) => xs; 7 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_Catch.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: innerX is not defined 3 | 4 | try { 5 | throw [0]; 6 | } catch ([innerX]) { 7 | 8 | } 9 | 10 | innerX; 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/NumericLiteral/Error_NoOctalDigits.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --numeric-literals 3 | // Error: :5:3: Octal Integer Literal must contain at least one digit 4 | 5 | 0o; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/PropertyMethodAssignment/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --property-methods=false 3 | 4 | var object = { 5 | method() { 6 | return 42; 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_UnicodeEscapeSequenceInName.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:5: Character code '48' is not a valid identifier start char 3 | 4 | var \u0030ab = 42; // 0ab 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_WithInStrictProgram.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 6:1: Strict mode code may not include a with statement 3 | 4 | 'use foo'; 5 | 'use strict'; 6 | with ({}) {} 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TypeAssertions/resources/exported-function.js: -------------------------------------------------------------------------------- 1 | import {assert} from './assert' 2 | export function exportedParamAndReturn(a:Number):Number { 3 | return a === 0 ? 'invalid' : a; 4 | } 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Arguments.js: -------------------------------------------------------------------------------- 1 | function* f() { 2 | yield [arguments[0], arguments[1]]; 3 | } 4 | 5 | for (var arr of f(1, 2)) { 6 | assert.equal(1, arr[0]); 7 | assert.equal(2, arr[1]); 8 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/runtime/test_source_map_module.js: -------------------------------------------------------------------------------- 1 | export {name as a} from './test_a'; 2 | export {name as b} from './test_b'; 3 | export {name as c} from './test_c'; 4 | 5 | export var name = 'test'; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/README: -------------------------------------------------------------------------------- 1 | http://closure-library.googlecode.com/svn/trunk/ closure-library 2 | https://github.com/johnjbarton/source-map source-map fork from https://github.com/mozilla/source-map BSD 3 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/addon/display/fullscreen.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-fullscreen { 2 | position: fixed; 3 | top: 0; left: 0; right: 0; bottom: 0; 4 | height: auto; 5 | z-index: 9; 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/ImportEmptyImportClause.js: -------------------------------------------------------------------------------- 1 | // AMD executes the dependencies before executing the module. 2 | import {} from './deps/side-effect2'; 3 | assert.equal(1, this.sideEffect); 4 | this.sideEffect = 0; -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/MultipleImports.js: -------------------------------------------------------------------------------- 1 | import {Foo, Bar, Baz} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', Foo); 4 | assert.equal('Bar from foo.js', Bar); 5 | assert.equal('Baz from foo.js', Baz); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ComputedPropertyNames/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --computed-property-names=false 3 | // Error: :6:3: '}' expected 4 | 5 | var object = { 6 | [1]: 2 7 | }; 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/NumericLiteral/Error_NoBinaryDigits.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --numeric-literals 3 | // Error: :5:3: Binary Integer Literal must contain at least one digit 4 | 5 | 0b; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/ForInWithInitializerVar.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var x = 0; 4 | 5 | // ES5 allows this. 6 | for (var i = (x = 1) in {}) { 7 | } 8 | 9 | assert.equal(1, x); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_WithInClass.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 6:5: Strict mode code may not include a with statement 3 | 4 | class C { 5 | method() { 6 | with ({}) {} 7 | } 8 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/amd/NamedImports.js: -------------------------------------------------------------------------------- 1 | import {Foo as f, Bar as b, Baz} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', f); 4 | assert.equal('Bar from foo.js', b); 5 | assert.equal('Baz from foo.js', Baz); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/MultipleImports.js: -------------------------------------------------------------------------------- 1 | import {Foo, Bar, Baz} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', Foo); 4 | assert.equal('Bar from foo.js', Bar); 5 | assert.equal('Baz from foo.js', Baz); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/UnannotatedUntypedFunction.js: -------------------------------------------------------------------------------- 1 | function UnannotatedUntypedParams(x, y) {} 2 | 3 | assert(!UnannotatedUntypedParams.annotations); 4 | assert(!UnannotatedUntypedParams.parameters); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrayComprehension/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --array-comprehension=false 3 | // Error: :5:14: ']' expected 4 | 5 | var array = [for (x of [0, 1, 2, 3, 4]) x]; 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForOfWithInitializerLet.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | function* gen() { 5 | yield 1; 6 | } 7 | 8 | for (let i = 0 of gen()) { 9 | } 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForOfWithInitializerVar.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | function* gen() { 5 | yield 1; 6 | } 7 | 8 | for (var i = 0 of gen()) { 9 | } 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/NameBindingInFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | { 4 | function f() { 5 | return f; 6 | } 7 | var g = f; 8 | f = 42; 9 | assert.equal(42, g()); 10 | } 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/TopLevelLet.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let x = 'let'; 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | assert.equal(x, 'let'); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --generators=false 3 | 4 | function* range(start, end) { 5 | for (var i = start; i < end; i++) { 6 | yield i; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/commonjs/NamedImports.js: -------------------------------------------------------------------------------- 1 | import {Foo as f, Bar as b, Baz} from './deps/foo'; 2 | 3 | assert.equal('Foo from foo.js', f); 4 | assert.equal('Bar from foo.js', b); 5 | assert.equal('Baz from foo.js', Baz); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/FreeVariableChecker/Error_With.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: missingVarWith is not defined 3 | var o = {}; 4 | with (o) { 5 | missingVarWith = 42; 6 | } 7 | var x = missingVarWith * 2; 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectInitialiserShorthand/Error_MissingVar.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: missingVarObjectInitialiserShorthand is not defined 3 | 4 | var object = {missingVarObjectInitialiserShorthand}; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForOfWithInitializerConst.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | 4 | function* gen() { 5 | yield 1; 6 | } 7 | 8 | for (const i = 0 of gen()) { 9 | } 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/NumberLiteralMemberExpression.js: -------------------------------------------------------------------------------- 1 | assert.equal(1 .toString(), '1'); 2 | assert.equal(1.1.toString(), '1.1'); 3 | assert.equal(1e1.toString(), '10'); 4 | assert.equal(1E1.toString(), '10'); 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/UseStrictEscapeSequence.js: -------------------------------------------------------------------------------- 1 | function testUseStrictEscapeSequence() { 2 | 'use str\x69ct'; 3 | return this; 4 | } 5 | 6 | assert.notEqual(testUseStrictEscapeSequence(), undefined); 7 | 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/export-default-class.js: -------------------------------------------------------------------------------- 1 | export default class Q { 2 | foo() { 3 | console.log('class method'); 4 | } 5 | get name() { 6 | return 'Q'; 7 | } 8 | }; 9 | var p = 5; 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/SimpleFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | @Anno 5 | function Simple() {} 6 | 7 | assertArrayEquals([new Anno], Simple.annotations); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/DefaultParameters/Error_SetAccessor.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :6:15: ')' expected 3 | 4 | var object = { 5 | // Default parameters are not allowed on setters. 6 | set x(value = 42) {} 7 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Rest/Error_SetAccessor.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:9: 'identifier' expected 3 | 4 | var object = { 5 | set x(...rest) { 6 | // rest is not allowed for set accessor 7 | } 8 | }; 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInitializerFor1.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (let x = 1; x < 10; x++) { 4 | x; 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/UseStrictLineContinuation.js: -------------------------------------------------------------------------------- 1 | function testUseStrictLineContinuation() { 2 | 'use \ 3 | strict'; 4 | return this; 5 | } 6 | 7 | assert.notEqual(testUseStrictLineContinuation(), undefined); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/GeneratorFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | @Anno 5 | function* generate() {} 6 | 7 | assertArrayEquals([new Anno], generate.annotations); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/resources/exported-functions.js: -------------------------------------------------------------------------------- 1 | import {Anno} from './setup'; 2 | 3 | @Anno 4 | export function exportedAnnotated(@Anno x) { 5 | } 6 | 7 | export function exportedUnannotated(@Anno x) { 8 | } 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/GeneratorComprehension/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --generator-comprehension=false 3 | // Error: :5:13: Unexpected token for 4 | 5 | var iter = (for (x of [0, 1, 2, 3, 4]) x); 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_ForInWithInitializerConst.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | // Error: let/const in for-in statement may not have initialiser 4 | 5 | for (const i = 0 in {}) { 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInFor.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x ++) { 4 | let y = 'let y'; 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetNoInitializer.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var x = 1; 4 | { 5 | let x; 6 | assert.equal(undefined, x); 7 | x = 2; 8 | assert.equal(2, x); 9 | } 10 | assert.equal(1, x); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/CallWithUndefined.js: -------------------------------------------------------------------------------- 1 | function f(...args) { 2 | return args; 3 | } 4 | 5 | assert.throw(function() { 6 | // Should throw due to ToObject(undefined) 7 | f(0, ...undefined, 1); 8 | }, TypeError) 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_StrictKeywordsInStrict.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :5:26: implements is a reserved identifier 3 | 4 | 'use strict'; 5 | function testImplements({implements}) { 6 | return 42; 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/DeriveFromObject.js: -------------------------------------------------------------------------------- 1 | class DerivedFromObject extends Object { 2 | } 3 | 4 | // ---------------------------------------------------------------------------- 5 | 6 | // TODO(rnystrom): No tests for this? 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_StrictKeywordsInArguments.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:25: implements is a reserved identifier 3 | 4 | function testImplements(implements) { 5 | 'use strict'; 6 | return 42; 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Error_Super.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :8:17: Unexpected token ; 3 | 4 | class A {} 5 | 6 | class ImproperSuper extends A { 7 | method() { 8 | return super; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ImportDefault.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: feature/Modules/Error_ImportDefault.js:4:8: 'default' is not exported by 'feature/Modules/resources/a' 3 | 4 | import error from './resources/a'; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/Error_annotated_var.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --annotations 3 | // Error: :9:1: Unsupported annotated expression 4 | import {Anno} from './resources/setup'; 5 | 6 | @Anno 7 | var test = 1; 8 | 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_StrictKeywordsInArgumentsPattern.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:26: implements is a reserved identifier 3 | 4 | function testImplements({implements}) { 5 | 'use strict'; 6 | return 42; 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/wiki/CompilingOffline/UsingCompiledFiles.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | You should see "Hi!" in your console. 7 | 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/FunctionParameter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | function AnnotatedParam(@Anno('x') x) {} 5 | 6 | assertArrayEquals([[new Anno('x')]], AnnotatedParam.parameters); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_InvalidExport3.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: feature/Modules/Error_InvalidExport3.module.js:4:9: 'c' is not exported by 'feature/Modules/resources/b' 3 | 4 | export {c as d} from './resources/b'; 5 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInitializerFor2.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (let x = 1, y = 2, z = 3; x < 10; x ++) { 4 | y++; 5 | z++; 6 | } 7 | 8 | // ---------------------------------------------------------------------------- 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_WithInStrictFunction.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: 7:3: Strict mode code may not include a with statement 3 | 4 | function testWithInStrict() { 5 | 'use foo'; 6 | 'use strict'; 7 | with ({}) {} 8 | } -------------------------------------------------------------------------------- /chapter02/.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "undef": true, 3 | "unused": true, 4 | "globals": {"KA": false}, 5 | "indent": 2, 6 | "eqeqeq": true, 7 | "strict": true, 8 | "trailing": true, 9 | "maxlen": 70, 10 | "browser": true, 11 | "devel": true 12 | } 13 | 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Error_ForOfWithInitializer.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: initialiser is not allowed in for-of loop with pattern 3 | // Error: for-of statement may not have initialiser 4 | 5 | for (var {k} = {} of []) { 6 | } 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Rest/Error_NotLast.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :4:46: ')' expected 3 | 4 | function invalidParam(noDefault, ...restParam, noRestAgain) { 5 | // Should fail to parse since non rest param is not allowed after 6 | // param. 7 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/Call.js: -------------------------------------------------------------------------------- 1 | function f(...args) { 2 | return args; 3 | } 4 | var result = f(0, ...[1, 2], 3); 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | assertArrayEquals([0, 1, 2, 3], result); 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Types/TypeAnnotations.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true --annotations=true 2 | 3 | class Test {} 4 | 5 | function abc(x: Test) : Test { 6 | var a : Test = new Test(); 7 | } 8 | 9 | function xyz(x: number, y: boolean): string {} 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/GeneratorWithoutYieldOrReturn.js: -------------------------------------------------------------------------------- 1 | var x = 0; 2 | 3 | function* f() { 4 | x++; 5 | } 6 | 7 | var g = f(); 8 | assert.equal(x, 0); 9 | assert.deepEqual(g.next(), {done: true, value: undefined}); 10 | assert.equal(x, 1); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ConstructorParam.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class CtorParam { 5 | constructor(@Anno x) {} 6 | } 7 | 8 | assertArrayEquals([[new Anno]], CtorParam.parameters); 9 | 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectInitialiserShorthand/Ok.js: -------------------------------------------------------------------------------- 1 | var x = 42; 2 | var y = 43; 3 | var object = {x, y}; 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | assert.equal(42, object.x); 8 | assert.equal(43, object.y); 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/NestedLet.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var x = 'var'; 4 | { 5 | let y = 'let 1'; 6 | } 7 | { 8 | let y = 'let 2'; 9 | } 10 | 11 | // ---------------------------------------------------------------------------- 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/Constructor.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class AnnotatedCtor { 5 | @Anno2 6 | constructor() {} 7 | } 8 | 9 | assertArrayEquals([new Anno2], AnnotatedCtor.annotations); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/NestedFunction3.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function nestedFunction3() { 4 | let let_x = 'let x'; 5 | function function_foo() { } 6 | } 7 | 8 | // ---------------------------------------------------------------------------- 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Symbol/TransformationOff.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols=false 2 | 3 | var s = Symbol(); 4 | var s2 = Symbol(); 5 | var object = {}; 6 | object[s] = 1; 7 | object[s2] = 2; 8 | 9 | assert.equal(object[s], 1); 10 | assert.equal(object[s2], 2); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInitializerForIn.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let sum = 0; 4 | let a = [1,2,3]; 5 | for (let x in a) { 6 | sum = sum + a[x]; 7 | } 8 | 9 | // ---------------------------------------------------------------------------- 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/ArrayWithHoles.js: -------------------------------------------------------------------------------- 1 | var arr = [,1, ,3,]; 2 | assert.equal(4, arr.length); 3 | 4 | var arr2 = [,1, ,...[3],]; 5 | assert.equal(4, arr.length); 6 | 7 | var x, y; 8 | [x, , y] = [0, 1, 2]; 9 | assert.equal(0, x); 10 | assert.equal(2, y); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/MethodParam.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class MethodParam { 5 | method(@Anno x) {} 6 | } 7 | 8 | assertArrayEquals([[new Anno]], MethodParam.prototype.method.parameters); 9 | 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Error_SuperAsTemplateTag.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :8:18: Unexpected token no substitution template 3 | 4 | class A {} 5 | 6 | class ImproperSuper extends A { 7 | method() { 8 | return super ``; 9 | } 10 | } 11 | 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/NestedFunction1.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function nestedFunction1() { 4 | return function() { 5 | let let_x = 'let x'; 6 | } 7 | } 8 | 9 | // ---------------------------------------------------------------------------- 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/TopLevelLetVar.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let x = 'let'; 4 | var y = 'var'; 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | assert.equal('let', x); 9 | assert.equal('var', y); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/codereview.settings: -------------------------------------------------------------------------------- 1 | # This file is used by gcl to get repository specific information. 2 | CODE_REVIEW_SERVER: https://codereview.appspot.com 3 | VIEW_VC: http://code.google.com/p/traceur-compiler/source/detail?r= 4 | CC_LIST: traceur-compiler-reviews@googlegroups.com 5 | 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/PromiseCast.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | async function f() { 5 | var x = await 1; 6 | assert.equal(x, 1); 7 | x = await undefined; 8 | assert.equal(x, undefined); 9 | done(); 10 | } 11 | 12 | f(); 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportDefault.js: -------------------------------------------------------------------------------- 1 | import x from './resources/default'; 2 | assert.equal(x, 42); 3 | 4 | import C from './resources/default-class'; 5 | assert.equal(new C().m(), 'm'); 6 | 7 | import {default as D} from './resources/default-name'; 8 | assert.equal(D, 4); 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ModuleNoNewline.js: -------------------------------------------------------------------------------- 1 | module 2 | 'm' 3 | { 4 | var x = 42; 5 | } 6 | 7 | var module = {test: 42}; 8 | 9 | module; 10 | module.test; 11 | // No semicolon on next line 12 | module 13 | 14 | // No semicolon nor newline at end of next line 15 | module -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/TopLevelLetConst.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let x = 'let'; 4 | const y = 'const'; 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | assert.equal('let', x); 9 | assert.equal('const', y); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/NewBuiltin.js: -------------------------------------------------------------------------------- 1 | var d = new Date(...[2011, 4, 3]); 2 | 3 | // ---------------------------------------------------------------------------- 4 | 5 | assert.equal(2011, d.getFullYear()); 6 | assert.equal(4, d.getMonth()); 7 | assert.equal(3, d.getDate()); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/test/mode_test.css: -------------------------------------------------------------------------------- 1 | .mt-output .mt-token { 2 | border: 1px solid #ddd; 3 | white-space: pre; 4 | font-family: "Consolas", monospace; 5 | text-align: center; 6 | } 7 | 8 | .mt-output .mt-style { 9 | font-size: x-small; 10 | } 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding8.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function f() { 4 | return 'outer'; 5 | } 6 | 7 | { 8 | function f() { 9 | return 'inner'; 10 | } 11 | 12 | assert.equal('inner', f()); 13 | } 14 | 15 | assert.equal('outer', f()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding9.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function f() { 4 | return 'outer'; 5 | } 6 | 7 | { 8 | (function f() { 9 | return 'inner'; 10 | }); 11 | 12 | assert.equal('outer', f()); 13 | } 14 | 15 | assert.equal('outer', f()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForBreak.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x ++) { 4 | let y = 'let y'; 5 | if (x % 2 == 0) { 6 | break; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /library/plugins/audioContextPolyfill.js: -------------------------------------------------------------------------------- 1 | //WebAudio API AudioContext polyfill 2 | 3 | (function() { 4 | 5 | var vendors = ["ms", "webkit", "o"]; 6 | 7 | for(var x = 0; x < vendors.length && !window.AudioContext; ++x) 8 | { 9 | window.AudioContext = window[vendors[x]+"AudioContext"]; 10 | } 11 | 12 | }()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/AnnotatedTypedParam.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | X 5 | } from './resources/setup'; 6 | 7 | function AnnotatedTypedParam(@Anno x:X) {} 8 | 9 | assertArrayEquals([[X, new Anno]], AnnotatedTypedParam.parameters); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/PrototypeDescriptor.js: -------------------------------------------------------------------------------- 1 | class C {} 2 | 3 | var descr = Object.getOwnPropertyDescriptor(C, 'prototype'); 4 | assert.isFalse(descr.enumerable); 5 | assert.isFalse(descr.configurable); 6 | assert.isFalse(descr.writable); 7 | assert.equal(descr.value, C.prototype); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Method.js: -------------------------------------------------------------------------------- 1 | var object = { 2 | method({message: [head, ...tail], name}) { 3 | assert.equal('a', head); 4 | assertArrayEquals(['b', 'c'], tail); 5 | assert.equal('Error', name); 6 | } 7 | }; 8 | 9 | object.method(new Error('abc')); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/SetAccessor.js: -------------------------------------------------------------------------------- 1 | var object = { 2 | set x({message: [head, ...tail], name}) { 3 | assert.equal('a', head); 4 | assertArrayEquals(['b', 'c'], tail); 5 | assert.equal('Error', name); 6 | } 7 | }; 8 | 9 | object.x = new Error('abc'); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForContinue.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x ++) { 4 | let y = 'let y'; 5 | if (x % 2 == 0) { 6 | continue; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/Error_StrictKeywordsInPropertyDefinitionIdentifierReference.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :6:11: yield is a reserved identifier 3 | 4 | function testStrictKeywordsInPropertyDefinitionIdentifierReference() { 5 | 'use strict'; 6 | return {yield}; 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/FunctionMultipleParameters.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | function MultipleParams(@Anno('x') x, @Anno('y') y) {} 5 | 6 | assertArrayEquals([[new Anno('x')], [new Anno('y')]], 7 | MultipleParams.parameters); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding10.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function f() { 4 | return 'outer'; 5 | } 6 | 7 | { 8 | var f = function f() { 9 | return 'inner'; 10 | }; 11 | 12 | assert.equal('inner', f()); 13 | } 14 | 15 | assert.equal('inner', f()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInitializerFor3.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (let x = 1, y = x + 1; x < 10 && y != 0; x ++, y *= 2) { 4 | if (y > 300) { 5 | continue; 6 | } 7 | } 8 | 9 | // ---------------------------------------------------------------------------- 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetWithForIn.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x in [1,2,3]) { 4 | let let_y = x; 5 | for (var for_in_z in [4,5,6]) { 6 | continue; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Symbol/GetOwnPropertySymbols.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols 2 | 3 | var s1 = Symbol(); 4 | var s2 = Symbol(); 5 | var object = {a: 'a'}; 6 | object[s1] = 's1'; 7 | object.b = 'b'; 8 | object[s2] = 's2'; 9 | assertArrayEquals([s1, s2], Object.getOwnPropertySymbols(object)); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/resources/exported-classes.js: -------------------------------------------------------------------------------- 1 | import {Anno} from './setup'; 2 | 3 | @Anno 4 | export class ExportedAnnotatedClass { 5 | @Anno 6 | annotatedMethod() {} 7 | } 8 | 9 | export class ExportedUnannotatedClass { 10 | @Anno 11 | annotatedMethod() {} 12 | } 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Arguments.js: -------------------------------------------------------------------------------- 1 | function destructureArguments(x, y) { 2 | [arguments[0], [arguments[1]]] = [1, [2]] 3 | return x + y; 4 | } 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | assert.equal(3, destructureArguments(1, 2)); 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ExportStarConflict.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: feature/Modules/resources/export-conflict.js:2:8: Duplicate export. 'a' was previously exported at feature/Modules/resources/export-conflict.js:1:12 3 | 4 | import {a} from './resources/export-conflict'; 5 | 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/DeepNestedLet.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var a = 'var a'; 4 | { 5 | var b = 'var b'; 6 | { 7 | var c = 'var c'; 8 | let d = 'let d'; 9 | } 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/class.js: -------------------------------------------------------------------------------- 1 | class B { 2 | constructor(x) { 3 | this.x = x; 4 | } 5 | method() { 6 | return 1; 7 | } 8 | } 9 | 10 | class C extends B { 11 | method() { 12 | return super() + this.x; 13 | } 14 | } 15 | 16 | var result = new C(1).method(); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/unit/node/resources/generator.js: -------------------------------------------------------------------------------- 1 | function* f(x, y) { 2 | yield x; 3 | yield y; 4 | } 5 | 6 | var result = []; 7 | 8 | for (var value of f(1, 2)) { 9 | result.push(value); 10 | } 11 | 12 | for (var value of (for (x of f(3, 4)) x * x)) { 13 | result.push(value); 14 | } 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/AnnotatedFunctionTypedParam.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | X 5 | } from './resources/setup'; 6 | 7 | @Anno 8 | function AnnotatedFnMultiParam(x:X, y) {} 9 | 10 | assertArrayEquals([[X], []], AnnotatedFnMultiParam.parameters); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/MultipleAnnotatedFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import { 3 | Anno, 4 | Anno2 5 | } from './resources/setup'; 6 | 7 | @Anno 8 | @Anno2('val') 9 | function Multi() {} 10 | 11 | assertArrayEquals([new Anno, new Anno2('val')], Multi.annotations); 12 | 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Tools/FreeVariableChecker.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --freeVariableChecker 3 | try { 4 | var y = xxx; 5 | } catch (e) {} 6 | // test/unit/semantics/freeVariableChecker.traceur.js checks operation 7 | // of the checker, here we check that the option works in the compiler. 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetWithFor.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x++) { 4 | let let_y = 'let y'; 5 | for (var for_z = 0; for_z < 2; for_z ++) { 6 | break; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/NestedFunction2.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function nestedFunction2() { 4 | let let_func = function() { 5 | let let_x = 'let x'; 6 | } 7 | return let_func; 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/DeepNestedLetVarNoInit.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var var_a; 4 | { 5 | var var_b; 6 | { 7 | let let_c = 'let c'; 8 | { 9 | var var_d; 10 | } 11 | } 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/CommaOperator.js: -------------------------------------------------------------------------------- 1 | function* f(x, y) { 2 | yield x, yield y; 3 | return x + y; 4 | } 5 | 6 | var g = f(1, 2); 7 | assert.deepEqual(g.next(), {value: 1, done: false}); 8 | assert.deepEqual(g.next(1), {value: 2, done: false}); 9 | assert.deepEqual(g.next(2), {value: 3, done: true}); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/DeepNestedLetVar.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var a = 'var a'; 4 | { 5 | var b = 'var b'; 6 | { 7 | let c = 'let c'; 8 | { 9 | var d = 'var d'; 10 | } 11 | } 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/BinaryOperator.js: -------------------------------------------------------------------------------- 1 | function* f(x) { 2 | var a = (yield x) + (yield x + 1); 3 | return a; 4 | } 5 | 6 | var g = f(1); 7 | assert.deepEqual(g.next(), {value: 1, done: false}); 8 | assert.deepEqual(g.next(1), {value: 2, done: false}); 9 | assert.deepEqual(g.next(2), {value: 3, done: true}); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ClassConstructor.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import { 3 | Anno, 4 | Anno2 5 | } from './resources/setup'; 6 | 7 | @Anno 8 | class AnnotatedClassCtor { 9 | @Anno2 10 | constructor() {} 11 | } 12 | 13 | assertArrayEquals([new Anno, new Anno2], AnnotatedClassCtor.annotations); 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/SetterParam.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class SetterParam { 5 | set prop(@Anno x) {} 6 | } 7 | 8 | assertArrayEquals([[new Anno]], 9 | Object.getOwnPropertyDescriptor(SetterParam.prototype, 'prop'). 10 | set.parameters); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/DeepNestedLetConst.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var a = 'var a'; 4 | { 5 | var b = 'var b'; 6 | { 7 | let c = 'let c'; 8 | { 9 | const d = 'const d'; 10 | } 11 | } 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/ExtendNonConstructableFunction.js: -------------------------------------------------------------------------------- 1 | 2 | assert.throw(function() { 3 | class C extends Math.pow {} 4 | }, TypeError); 5 | 6 | assert.throw(function() { 7 | function f() {} 8 | // prototype needs to be an Object or null. 9 | f.prototype = 42; 10 | class C extends f {} 11 | }, TypeError); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SuperWithoutExtends.js: -------------------------------------------------------------------------------- 1 | class C { 2 | constructor() { 3 | this.x = true; 4 | } 5 | static m() { 6 | return super.hasOwnProperty('m'); 7 | } 8 | 9 | m() { 10 | return super.hasOwnProperty('x'); 11 | } 12 | } 13 | 14 | assert.isTrue(new C().m()); 15 | assert.isTrue(C.m()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/EvaluatesToRvalue.js: -------------------------------------------------------------------------------- 1 | function destructEvaluatesToRvalue() { 2 | var a; 3 | return [a] = [1, 2, 3]; 4 | } 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | var result = destructEvaluatesToRvalue(); 9 | assertArrayEquals([1, 2, 3], result); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/EvaluationOrder.js: -------------------------------------------------------------------------------- 1 | function destructEvaluationOrder() { 2 | var a; 3 | [a, a, a] = [1, 2, 3, 4]; 4 | return a; 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | 9 | var result = destructEvaluationOrder(); 10 | assert.equal(3, result); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportCircular.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: Unsupported circular dependency between feature/Modules/ImportCircular.module and feature/Modules/resources/clockwise 3 | 4 | import {clockwise} from './resources/clockwise'; 5 | export function counterclockwise() { 6 | return clockwise(); 7 | } 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TypeAssertions/DefaultParam.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true --type-assertions --type-assertion-module=./resources/assert 2 | function initialized(a:Number = 1) { return a; } 3 | 4 | assert.equal(1, initialized()); 5 | assert.equal(2, initialized(2)); 6 | assert.throw(() => { initialized(''); }, chai.AssertionError); 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/StaticGetter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class StaticGetter { 5 | @Anno 6 | static get prop() { return 'getter'; } 7 | } 8 | 9 | assertArrayEquals([new Anno], 10 | Object.getOwnPropertyDescriptor(StaticGetter, 'prop').get.annotations); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/resources/setup.js: -------------------------------------------------------------------------------- 1 | export function X() {} 2 | X.toJSON = function () { return 'function X'; } 3 | 4 | export function Anno(value) { 5 | this.annotation = true; 6 | this.value = value; 7 | } 8 | 9 | export function Anno2(value) { 10 | this.annotation2 = true; 11 | this.value = value; 12 | } 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/AsyncSyntax.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | 3 | var async; 4 | async 5 | function f() { 6 | return async + async; 7 | } 8 | 9 | async = 1; 10 | assert.equal(async, 1); 11 | assert.equal(f(), 2); 12 | 13 | async = async 14 | function g() { 15 | 16 | } 17 | 18 | assert.equal(async, 1); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/mode/rpm/spec/spec.css: -------------------------------------------------------------------------------- 1 | .cm-s-default span.cm-preamble {color: #b26818; font-weight: bold;} 2 | .cm-s-default span.cm-macro {color: #b218b2;} 3 | .cm-s-default span.cm-section {color: green; font-weight: bold;} 4 | .cm-s-default span.cm-script {color: red;} 5 | .cm-s-default span.cm-issue {color: yellow;} 6 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/FunctionMultipleAnnotatedParameter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import { 3 | Anno, 4 | Anno2 5 | } from './resources/setup'; 6 | 7 | function MultipleAnnotations(@Anno('x') @Anno2('x') x) {} 8 | 9 | assertArrayEquals([[new Anno('x'), new Anno2('x')]], 10 | MultipleAnnotations.parameters); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/TopLevel.js: -------------------------------------------------------------------------------- 1 | var a, b, c, d; 2 | [a, [b, c], d] = ['hello', [',', 'junk'], ['world']]; 3 | 4 | // ---------------------------------------------------------------------------- 5 | 6 | assert.equal('hello', a); 7 | assert.equal(',', b); 8 | assert.equal('junk', c); 9 | assertArrayEquals(['world'], d); 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForBreakInner.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x ++) { 4 | for (var y = 0; y < 10; y ++) { 5 | let z = 'let z'; 6 | if (x == 7) { 7 | break; 8 | } 9 | } 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/StringEscapes.js: -------------------------------------------------------------------------------- 1 | var o1 = { 2 | '\\\'': 42, 3 | '\0\b\f\n\r\t\v\x42\u1234': 1234 4 | }; 5 | var o2 = { 6 | '\\\'\ 7 | ': 42, 8 | '\0\b\f\n\r\t\v\x42\u1234': 1234 9 | }; 10 | 11 | assertArrayEquals(Object.keys(o1), Object.keys(o2)); 12 | assert.equal(42, o1['\\\'']); 13 | assert.equal(42, o2['\\\'']); 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/StaticMethod.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class StaticMethod { 5 | @Anno 6 | static method(@Anno x) {} 7 | } 8 | 9 | assertArrayEquals([new Anno], StaticMethod.method.annotations); 10 | assertArrayEquals([[new Anno]], StaticMethod.method.parameters); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/FreeVariableChecker/WithBasic.js: -------------------------------------------------------------------------------- 1 | var o = { 2 | unicorns: 42, 3 | fairyGodmothers: 3 4 | }; 5 | 6 | with (o) { 7 | x = 42; 8 | y = x * x; 9 | 10 | bubbles = 1000; 11 | fairyGodmotherBubbles = bubbles * fairyGodmothers; 12 | unicorns = bubbles * fairyGodmothers - (fairyGodmotherBubbles - unicorns); 13 | } 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_FunctionExpressionInBlock.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | // Error: functionExpression is not defined 4 | 5 | { 6 | (function functionExpression() { 7 | return 'inner'; 8 | }); 9 | 10 | functionExpression; // function expression doesn't add name to the scope. 11 | } 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForContinueInner.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var x = 0; x < 10; x ++) { 4 | for (var y = 0; y < 10; y ++) { 5 | let z = 'let z'; 6 | if (x == 7) { 7 | continue; 8 | } 9 | } 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "CodeMirror", 3 | "main": ["lib/codemirror.js", "lib/codemirror.css"], 4 | "ignore": [ 5 | "**/.*", 6 | "node_modules", 7 | "components", 8 | "bin", 9 | "demo", 10 | "doc", 11 | "test", 12 | "index.html", 13 | "package.json" 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/mode/tiddlywiki/tiddlywiki.css: -------------------------------------------------------------------------------- 1 | span.cm-underlined { 2 | text-decoration: underline; 3 | } 4 | span.cm-strikethrough { 5 | text-decoration: line-through; 6 | } 7 | span.cm-brace { 8 | color: #170; 9 | font-weight: bold; 10 | } 11 | span.cm-table { 12 | color: blue; 13 | font-weight: bold; 14 | } 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/NewClassExpression.js: -------------------------------------------------------------------------------- 1 | 2 | assert.equal((new class { 3 | get x() { 4 | return 'x'; 5 | } 6 | getX() { 7 | return this.x; 8 | } 9 | }).getX(), 'x'); 10 | 11 | assert.equal(new class { 12 | get y() { 13 | return 'y'; 14 | } 15 | getY() { 16 | return this.y; 17 | } 18 | }().getY(), 'y'); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/CommaExpression.js: -------------------------------------------------------------------------------- 1 | assert.equal('24', `${ 1, 2 }${ 3, 4 }`); 2 | assert.equal('6', `${ 5, 6 }`); 3 | 4 | function templateLiteralCommaTest(callsite, x, y) { 5 | assert.equal(2, x); 6 | assert.equal(4, y); 7 | return x + y; 8 | } 9 | 10 | assert.equal(6, templateLiteralCommaTest`${ 1, 2 }${ 3, 4 }`); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/StringRaw.js: -------------------------------------------------------------------------------- 1 | assert.equal('', String.raw ``); 2 | assert.equal('\n', String.raw ` 3 | `); 4 | assert.equal('\\n', String.raw `\n`); 5 | assert.equal('\\n42\\t', String.raw `\n${ 40 + 2 }\t`); 6 | assert.equal('\n42\t', String.raw ` 7 | ${42} `); 8 | assert.equal('\\\n42\\\n', String.raw `\ 9 | ${42}\ 10 | `); 11 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/Error_BlockBinding1.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Options: --block-binding 3 | // Error: inner is not defined 4 | 5 | function testBlock() { 6 | { 7 | let inner = 'inner value'; 8 | } 9 | 10 | var x = inner; 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForBreakNamed.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | outer: 4 | for (var x = 0; x < 10; x ++) { 5 | for (var y = 0; y < 10; y ++) { 6 | let z = 'let z'; 7 | if (x == 7) { 8 | break outer; 9 | } 10 | } 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/bin/authors.sh: -------------------------------------------------------------------------------- 1 | # Combine existing list of authors with everyone known in git, sort, add header. 2 | tail --lines=+3 AUTHORS > AUTHORS.tmp 3 | git log --format='%aN' >> AUTHORS.tmp 4 | echo -e "List of CodeMirror contributors. Updated before every release.\n" > AUTHORS 5 | sort -u AUTHORS.tmp >> AUTHORS 6 | rm -f AUTHORS.tmp 7 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInForContinueNamed.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | outer: 4 | for (var x = 0; x < 10; x ++) { 5 | for (var y = 0; y < 10; y ++) { 6 | let z = 'let z'; 7 | if (x == 7) { 8 | continue outer; 9 | } 10 | } 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Symbol/ObjectModel.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols 2 | 3 | var s = Symbol('s'); 4 | assert.equal(typeof s, 'symbol'); 5 | assert.equal(s.constructor, Symbol); 6 | assert.isFalse(s instanceof Symbol); 7 | 8 | assert.throws(() => { 9 | new Symbol; 10 | }); 11 | 12 | assert.equal(s.toString(), 'Symbol(s)'); 13 | assert.equal(s.valueOf(), s); 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/FunctionArrayPattern.js: -------------------------------------------------------------------------------- 1 | function f([a, b, ...c], d) { 2 | return [a, b, c, d]; 3 | } 4 | assertArrayEquals([1, 2, [3, 4], 5], f([1, 2, 3, 4], 5)); 5 | 6 | function g([, a]) { 7 | return a; 8 | } 9 | assert.equal(g([0, 1]), 1); 10 | 11 | function h([, [, a]]) { 12 | return a; 13 | } 14 | assert.equal(h([0, [1, 2]]), 2); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Yield.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncYield() { 5 | return asyncTimeout(0); 6 | } 7 | 8 | function asyncTimeout(ms) { 9 | return new Promise((resolve) => { 10 | setTimeout(resolve, ms); 11 | }); 12 | } 13 | 14 | (async function() { 15 | await asyncYield(); 16 | done(); 17 | })(); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetWithSwitch.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var i = 0; i < 5; i ++) { 4 | let let_x = 'let x'; 5 | 6 | switch (i) { 7 | case 0: 8 | break; 9 | case 2: 10 | break; 11 | default: 12 | break; 13 | } 14 | } 15 | 16 | // ---------------------------------------------------------------------------- 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/InheritanceNameBinding.js: -------------------------------------------------------------------------------- 1 | class NameBindingBase {} 2 | 3 | class NameBindingDerived extends NameBindingBase { 4 | getX() { return this.x; } 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | 9 | var derived = new NameBindingDerived(); 10 | derived.x = 12; 11 | assert.equal(12, derived.getX()); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_ExportStarDuplicateExport.module.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: feature/Modules/Error_ExportStarDuplicateExport.module.js:5:8: Duplicate export. 'a' was previously exported at feature/Modules/Error_ExportStarDuplicateExport.module.js:4:8 3 | 4 | export * from './resources/a'; 5 | export * from './resources/a2'; 6 | 7 | assert.equal(1, 2); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_MissingExport.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: :6:12: 'y' is not exported by 'feature/Modules/resources/x' 3 | // Error: :6:15: 'z' is not exported by 'feature/Modules/resources/x' 4 | // Error: :7:9: 'w' is not exported by 'feature/Modules/resources/x' 5 | 6 | import {x, y, z} from './resources/x'; 7 | import {w} from './resources/x'; 8 | 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Exports.js: -------------------------------------------------------------------------------- 1 | module a from './resources/i'; 2 | 3 | (function() { 4 | 'use strict'; 5 | assert.equal(0, a.i); 6 | a.inc(); 7 | assert.equal(1, a.i); 8 | 9 | assert.throws(function() { 10 | a.i = 2; 11 | }, TypeError); 12 | })(); 13 | 14 | assert.equal(1, a.i); 15 | 16 | module d from './resources/d'; 17 | assert.equal('A', d.a); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding7.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function blockTest() { 4 | { 5 | let x = 'let x value'; 6 | function g() { 7 | return x; 8 | } 9 | return g; 10 | } 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | assert.equal('let x value', blockTest()()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetWithSwitch2.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | for (var i = 0; i < 5; i ++) { 4 | let let_x = 'let x'; 5 | 6 | switch (i) { 7 | case 0: 8 | continue; 9 | case 2: 10 | break; 11 | default: 12 | break; 13 | } 14 | } 15 | 16 | // ---------------------------------------------------------------------------- 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TypeAssertions/ExportedFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true --type-assertions 2 | import {exportedParamAndReturn} from './resources/exported-function'; 3 | 4 | assert.equal(1, exportedParamAndReturn(1)); 5 | 6 | assert.throw(() => { exportedParamAndReturn(''); }, chai.AssertionError); 7 | assert.throw(() => { exportedParamAndReturn(0); }, chai.AssertionError); 8 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/LabelledBlockGenerator.js: -------------------------------------------------------------------------------- 1 | var i = 0; 2 | var s = ''; 3 | 4 | function* f() { 5 | s += 'a'; 6 | while(i++ < 3) { 7 | s += 'b'; 8 | label1: { 9 | s += 'c'; 10 | break label1; 11 | s += 'd'; 12 | } 13 | s += 'e'; 14 | } 15 | s += 'f'; 16 | } 17 | 18 | var g = f(); 19 | g.next(); 20 | assert.equal(s, 'abcebcebcef'); 21 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ReturnYieldFor.js: -------------------------------------------------------------------------------- 1 | function* f() { 2 | return yield* h(); 3 | } 4 | 5 | function* h() { 6 | yield 111; 7 | yield 222; 8 | return 333; 9 | } 10 | 11 | var g = f(); 12 | 13 | assert.deepEqual({value: 111, done: false}, g.next()); 14 | assert.deepEqual({value: 222, done: false}, g.next()); 15 | assert.deepEqual({value: 333, done: true}, g.next()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/DeconstructingBlockBinding.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | if (true) { 4 | let [a,b] = [1,2]; 5 | const [c,d] = [4,5]; 6 | } 7 | if (true) { 8 | let {x: [{e}, f], g} = {x: [{e:4}, 5], g: 6}; 9 | const a = 0, [b, {c, x: [d]}] = [1, {c: 2, x: [3]}]; 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Inheritance.js: -------------------------------------------------------------------------------- 1 | class SimpleBase {} 2 | class SimpleDerived extends SimpleBase {} 3 | 4 | // ---------------------------------------------------------------------------- 5 | 6 | var derived = new SimpleDerived(); 7 | assert.isTrue(derived instanceof SimpleDerived); 8 | assert.isTrue(derived instanceof SimpleBase); 9 | assert.isTrue(derived instanceof Object); 10 | -------------------------------------------------------------------------------- /chapter01/modules/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Using modules 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Rest/Simple.js: -------------------------------------------------------------------------------- 1 | function f(...p) { 2 | return p; 3 | } 4 | 5 | function g(a, ...p) { 6 | return p; 7 | } 8 | 9 | assertArrayEquals([], f()); 10 | assertArrayEquals([0], f(0)); 11 | assertArrayEquals([0, 1], f(0, 1)); 12 | 13 | assertArrayEquals([], g()); 14 | assertArrayEquals([], g(0)); 15 | assertArrayEquals([1], g(0, 1)); 16 | assertArrayEquals([1, 2], g(0, 1, 2)); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TempVarTransformer/UseStrictDirective.js: -------------------------------------------------------------------------------- 1 | // This test depends on it running in non strict mode. 2 | assert.isTrue(function() { return this; }() !== undefined); 3 | 4 | function f() { 5 | 'use strict'; 6 | var xs = 'abc'; 7 | var o = { 8 | f() { 9 | return this; 10 | } 11 | }; 12 | o.f(...xs); 13 | return (1, o.f)(); 14 | } 15 | 16 | assert.isUndefined(f()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Types/TypeSyntax.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true 2 | 3 | var a : any; 4 | var b : bool; 5 | var s : string; 6 | var v : void; 7 | var n : number; 8 | 9 | var named : namespace.type; 10 | 11 | class Test {} 12 | 13 | function abc(x : Test) : Test { 14 | var a : Test = new Test(); 15 | } 16 | 17 | function xyz({x, y} : Test) {} 18 | 19 | var x = function (a : Test) : Test {} 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ClassInsideObjectGetter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | var object = { 5 | get foo() { 6 | class Foo { 7 | @Anno 8 | get b() {} 9 | } 10 | return Foo; 11 | } 12 | }; 13 | 14 | assertArrayEquals([new Anno], 15 | Object.getOwnPropertyDescriptor(object.foo.prototype, 'b').get.annotations); 16 | 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/NestedFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | X 5 | } from './resources/setup'; 6 | 7 | function f(a = function() { 8 | // body of default param expression 9 | function g(@Anno x : X) {} 10 | return g; 11 | }) { 12 | return a(); 13 | } 14 | 15 | var nested = f(); 16 | assertArrayEquals([[X, new Anno]], nested.parameters); 17 | 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/PropertyMethodStringName.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class C { 5 | @Anno('x y z') 6 | "x y z"() { return 1; } 7 | @Anno('xyz') 8 | xyz() { return 1; } 9 | } 10 | 11 | assertArrayEquals([new Anno('x y z')], C.prototype['x y z'].annotations); 12 | assertArrayEquals([new Anno('xyz')], C.prototype.xyz.annotations); 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInClass.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | class LetInClass { 4 | get z() { 5 | let let_z = 10; 6 | return let_z; 7 | } 8 | 9 | set z(v) { 10 | let let_zv = v; 11 | } 12 | 13 | distance() { 14 | let dist = this.y - this.x; 15 | return dist; 16 | } 17 | } 18 | 19 | // ---------------------------------------------------------------------------- 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/FunctionInsideClassGetter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | @Anno('Test') 5 | class Test { 6 | get annotatedFn() { 7 | @Anno('x') 8 | function x() {} 9 | return x; 10 | } 11 | } 12 | 13 | assertArrayEquals([new Anno('Test')], Test.annotations); 14 | assertArrayEquals([new Anno('x')], new Test().annotatedFn.annotations); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding6.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function testBlock() { 4 | // Test function expressions. 5 | { 6 | var x = function g() { return 'g'; } || function h() { return 'h'; }; 7 | return x; 8 | } 9 | } 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | var result = testBlock(); 14 | assert.equal('g', result()); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/IfStatementWithYield.js: -------------------------------------------------------------------------------- 1 | function* f(x) { 2 | if (yield x) { 3 | return 2; 4 | } 5 | return 3; 6 | } 7 | 8 | var g = f(1); 9 | assert.deepEqual(g.next(), {value: 1, done: false}); 10 | assert.deepEqual(g.next(true), {value: 2, done: true}); 11 | 12 | g = f(4); 13 | assert.deepEqual(g.next(), {value: 4, done: false}); 14 | assert.deepEqual(g.next(false), {value: 3, done: true}); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding3.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var f1, f2; 4 | 5 | { 6 | let z = 'z1 value'; 7 | f1 = function() { return z; }; 8 | } 9 | { 10 | let z = 'z2 value'; 11 | f2 = function() { return z; }; 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | 16 | assert.equal('z1 value', f1()); 17 | assert.equal('z2 value', f2()); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding4.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let result = []; 4 | for (let a = 1; a < 3; a++) { 5 | result.push( 6 | function() { return 'for ' + a; } 7 | ); 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | assert.equal('for 1', result[0]()); 13 | assert.equal('for 2', result[1]()); 14 | assert.equal(2, result.length); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/AlphaRename.js: -------------------------------------------------------------------------------- 1 | var global = this; 2 | var self = {}; 3 | 4 | function outer() { 5 | var f = () => { 6 | assert.equal(this, self); 7 | 8 | var g = () => { 9 | assert.equal(this, self); 10 | }; 11 | g(); 12 | 13 | var h = function() { 14 | assert.equal(this, global); 15 | }; 16 | h(); 17 | }; 18 | 19 | f(); 20 | } 21 | 22 | outer.call(self); 23 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/SimpleGenerator.js: -------------------------------------------------------------------------------- 1 | function* simpleGenerator() { 2 | yield 1; 3 | } 4 | 5 | function accumulate(iterator) { 6 | var result = ''; 7 | for (var value of iterator) { 8 | result = result + String(value); 9 | } 10 | return result; 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | assert.equal('1', accumulate(simpleGenerator())); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInProperties.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var object = { 4 | get x() { 5 | while (true) { 6 | let let_x = 'let x'; 7 | return let_x; 8 | } 9 | }, 10 | 11 | set x(v) { 12 | do { 13 | let let_v = v; 14 | this.v = let_v; 15 | } while (false); 16 | } 17 | } 18 | 19 | // ---------------------------------------------------------------------------- 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForEmptyGenerator.js: -------------------------------------------------------------------------------- 1 | function* forEmptyGenerator() { 2 | yield* []; 3 | } 4 | 5 | function accumulate(iterator) { 6 | var result = ''; 7 | for (var value of iterator) { 8 | result = result + String(value); 9 | } 10 | return result; 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | assert.equal('', accumulate(forEmptyGenerator())); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/MultipleParameterTypes.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | X 5 | } from './resources/setup'; 6 | 7 | function MultiParamWithAnnotation(@Anno x:X, y) {} 8 | function MultiTypedParamsNoAnnotations(x:X, y:X) {} 9 | 10 | assertArrayEquals([[X, new Anno], []], MultiParamWithAnnotation.parameters); 11 | assertArrayEquals([[X], [X]], MultiTypedParamsNoAnnotations.parameters); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/StaticSetter.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class StaticSetter { 5 | @Anno 6 | static set prop(@Anno x) {} 7 | } 8 | 9 | assertArrayEquals([new Anno], 10 | Object.getOwnPropertyDescriptor(StaticSetter, 'prop').set.annotations); 11 | assertArrayEquals([[new Anno]], 12 | Object.getOwnPropertyDescriptor(StaticSetter, 'prop').set.parameters); 13 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/mode/ruby/test.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var mode = CodeMirror.getMode({indentUnit: 2}, "ruby"); 3 | function MT(name) { test.mode(name, mode, Array.prototype.slice.call(arguments, 1)); } 4 | 5 | MT("divide_equal_operator", 6 | "[variable bar] [operator /=] [variable foo]"); 7 | 8 | MT("divide_equal_operator_no_spacing", 9 | "[variable foo][operator /=][number 42]"); 10 | 11 | })(); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Complete.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncComplete() { 5 | return new Promise((resolve) => { 6 | resolve('complete'); 7 | }); 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | (async function() { 13 | var value = await asyncComplete(); 14 | assert.equal('complete', value); 15 | done(); 16 | })(); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/RestParams.js: -------------------------------------------------------------------------------- 1 | class RestParams { 2 | constructor(...rest) { 3 | this.rest = rest; 4 | } 5 | instanceMethod(...rest) { 6 | return rest; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | var obj = new RestParams(0, 1, 2); 13 | assertArrayEquals([0, 1, 2], obj.rest); 14 | assertArrayEquals([3, 4, 5], obj.instanceMethod(3, 4, 5)); 15 | 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Skip_SoftBind.js: -------------------------------------------------------------------------------- 1 | // Skip. Not implemented. 2 | 3 | // TODO: needs soft bind and ??= implemented 4 | 5 | // A special form based on the default operator proposal 6 | const self_default_bound = (this ??= self, a, b) -> { 7 | this.c = a * b; 8 | } 9 | self_default_bound(6, 7); 10 | assert(self.c === 42); 11 | 12 | self_default_bound.call(other, 8, 9); 13 | assert(other.c === 72); 14 | assert(self.c === 42); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/ScopeThis.js: -------------------------------------------------------------------------------- 1 | function destructScopeThis() { 2 | var x; 3 | var o = { 4 | f: function() { 5 | [this.x] = [1]; 6 | } 7 | }; 8 | o.f(); 9 | return { 10 | x: x, 11 | o_x: o.x 12 | }; 13 | } 14 | 15 | // ---------------------------------------------------------------------------- 16 | 17 | var result = destructScopeThis(); 18 | assert.isUndefined(result.x); 19 | assert.equal(1, result.o_x); 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/CallExpression.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | { 4 | let i = 0, called = 0; 5 | function f() { 6 | called++; 7 | return function() { 8 | return ++i; 9 | }; 10 | } 11 | 12 | assert.equal(1, f() `whatevs`); 13 | assert.equal(1, called); 14 | assert.equal(2, f `abc` `def`); 15 | assert.equal(2, called); 16 | assert.equal(3, f `ghi` ()); 17 | assert.equal(3, called); 18 | } 19 | -------------------------------------------------------------------------------- /chapter01/rooms.json: -------------------------------------------------------------------------------- 1 | { 2 | "closet": { 3 | "id": 0, 4 | "description": "A dark coat closet.", 5 | "light": { 6 | "on": false 7 | }, 8 | "contents": [], 9 | "exits": ["east"] 10 | }, 11 | "livingRoom": { 12 | "id": 1, 13 | "description": "A living room in an old, rambling house.", 14 | "light": { 15 | "on": true 16 | }, 17 | "contents": ["fireplace", "sofa", "dagger"], 18 | "exits": ["west", "north", "south"] 19 | } 20 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SuperChangeProto.js: -------------------------------------------------------------------------------- 1 | var log = ''; 2 | 3 | class Base { 4 | p() { log += '[Base]'; } 5 | } 6 | 7 | class OtherBase { 8 | p() { log += '[OtherBase]'; } 9 | } 10 | class Derived extends Base { 11 | p() { 12 | log += '[Derived]'; 13 | super(); 14 | Derived.prototype.__proto__ = OtherBase.prototype; 15 | super(); 16 | } 17 | } 18 | 19 | new Derived().p(); 20 | assert.equal(log, '[Derived][Base][OtherBase]'); 21 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Types.js: -------------------------------------------------------------------------------- 1 | // Options: --types 2 | 3 | class Typed { 4 | constructor(x : number) { 5 | this.x_ = x; 6 | } 7 | 8 | addTo(y : number) : number { 9 | this.x += y; 10 | return this.x; 11 | } 12 | 13 | get x() : number { 14 | return this.x_; 15 | } 16 | 17 | set x(x : number) { 18 | this.x_ = x; 19 | } 20 | } 21 | 22 | assert.equal(1, new Typed(1).x); 23 | assert.equal(2, new Typed(1).addTo(1)); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/ImportFromModule.js: -------------------------------------------------------------------------------- 1 | import {a as renamedX, b} from './resources/m'; 2 | import {a} from './resources/m'; 3 | module m2 from './resources/m'; 4 | 5 | assert.equal(1, a); 6 | assert.equal(1, renamedX); 7 | assert.equal(2, b); 8 | 9 | module m from './resources/m'; 10 | 11 | assert.equal(a, renamedX); 12 | assert.equal(a, m.a); 13 | 14 | module m2 from './resources/m'; 15 | 16 | assert.isTrue(m === m2); 17 | assert.equal(b, m.b); 18 | -------------------------------------------------------------------------------- /chapter03/json/rooms.json: -------------------------------------------------------------------------------- 1 | { 2 | "closet": { 3 | "id": 0, 4 | "description": "A dark coat closet.", 5 | "light": { 6 | "on": false 7 | }, 8 | "contents": [], 9 | "exits": ["east"] 10 | }, 11 | "livingRoom": { 12 | "id": 1, 13 | "description": "A living room in an old, rambling house.", 14 | "light": { 15 | "on": true 16 | }, 17 | "contents": ["fireplace", "sofa", "dagger"], 18 | "exits": ["west", "north", "south"] 19 | } 20 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ClassGeneratorMethod.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import { 3 | Anno, 4 | Anno2 5 | } from './resources/setup'; 6 | 7 | class AnnotatedClass { 8 | @Anno 9 | *generate() {} 10 | 11 | @Anno2 12 | static *staticGenerate() {} 13 | } 14 | 15 | assertArrayEquals([new Anno], 16 | AnnotatedClass.prototype.generate.annotations); 17 | assertArrayEquals([new Anno2], 18 | AnnotatedClass.staticGenerate.annotations); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SuperPostfix.js: -------------------------------------------------------------------------------- 1 | class B { 2 | constructor() { 3 | this._x = 0; 4 | } 5 | get x() { 6 | return this._x; 7 | } 8 | set x(x) { 9 | this._x = x; 10 | } 11 | } 12 | 13 | class C extends B { 14 | m() { 15 | assert.equal(this.x, 0); 16 | assert.equal(super.x++, 0); 17 | assert.equal(this.x, 1); 18 | assert.equal(super.x--, 1); 19 | assert.equal(this.x, 0); 20 | } 21 | } 22 | 23 | new C().m(); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Modules/Error_InvalidModuleDeclaration.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Error: Failed to load 'feature/Modules/resources/no_such_file.js' 3 | // Error: Specified as ./resources/no_such_file. 4 | // Error: Imported by feature/Modules/Error_InvalidModuleDeclaration. 5 | // Error: Normalizes to feature/Modules/resources/no_such_file 6 | // Error: LoaderHooks.locate resolved against base './' 7 | 8 | 9 | module b from './resources/no_such_file'; 10 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/bin/lint: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var lint = require("../test/lint/lint"), 4 | path = require("path"); 5 | 6 | if (process.argv.length > 2) { 7 | lint.checkDir(process.argv[2]); 8 | } else { 9 | process.chdir(path.resolve(__dirname, "..")); 10 | lint.checkDir("lib"); 11 | lint.checkDir("mode"); 12 | lint.checkDir("addon"); 13 | lint.checkDir("keymap"); 14 | } 15 | 16 | process.exit(lint.success() ? 0 : 1); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrayComprehension/Closure.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | // Block binding is needed to get the right scoping semantics inside the arrow 3 | // function in the comprehension. 4 | 5 | var res = [for (x of [0, 1]) for (y of [2, 3]) () => [x, y]]; 6 | 7 | assert.equal(4, res.length); 8 | assertArrayEquals([0, 2], res[0]()); 9 | assertArrayEquals([0, 3], res[1]()); 10 | assertArrayEquals([1, 2], res[2]()); 11 | assertArrayEquals([1, 3], res[3]()); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetForInitializers1.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | var result; 4 | { 5 | let let_x = 'let x'; 6 | let let_l = []; 7 | for (var var_x = 1, var_y = 2, var_z = 3; var_x < 10; var_x ++) { 8 | let l_x = var_x, l_y = var_y, l_z = var_z; 9 | let_l.push( function() { return [ l_x, l_y, l_z ]; } ); 10 | } 11 | result = let_l; 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/Array.js: -------------------------------------------------------------------------------- 1 | var a = []; 2 | var b = [0, ...a]; 3 | var c = [...b, ...b]; 4 | var d; 5 | var e = [0, ...d = [1, 2], 3]; 6 | var f = [0, ...[[1, 2], [3, 4]], 5]; 7 | 8 | // ---------------------------------------------------------------------------- 9 | 10 | assertArrayEquals([0], b); 11 | assertArrayEquals([0, 0], c); 12 | assertArrayEquals([1, 2], d); 13 | assertArrayEquals([0, 1, 2, 3], e); 14 | assertArrayEquals([0, [1, 2], [3, 4], 5], f); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/MethodCall.js: -------------------------------------------------------------------------------- 1 | var obj = { 2 | method: function(...args) { 3 | return { 4 | self: this, 5 | args: args 6 | }; 7 | } 8 | }; 9 | 10 | var result = { 11 | obj: obj, 12 | result: obj.method(0, ...[1, 2], 3) 13 | }; 14 | 15 | // ---------------------------------------------------------------------------- 16 | 17 | assert.equal(result.obj, result.result.self); 18 | assertArrayEquals([0, 1, 2, 3], result.result.args); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Error_Disabled.js: -------------------------------------------------------------------------------- 1 | // Should not compile. 2 | // Disabled by default. 3 | // Error: :14:21: Semi-colon expected 4 | 5 | function asyncComplete() { 6 | return new Promise((resolve) => { 7 | resolve('complete'); 8 | }); 9 | } 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | (async function() { 14 | var value = async asyncComplete(); 15 | assert.equal('complete', value); 16 | })(); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Fields.js: -------------------------------------------------------------------------------- 1 | class Point { 2 | constructor() { 3 | this.x = 0; 4 | this.y = 0; 5 | } 6 | } 7 | 8 | // ---------------------------------------------------------------------------- 9 | 10 | var p = new Point(); 11 | 12 | var keys = []; 13 | for (var key in p) { 14 | keys.push(key); 15 | } 16 | 17 | assert.isTrue(keys.indexOf('x') !== -1); 18 | assert.isTrue(keys.indexOf('y') !== -1); 19 | assert.isTrue(keys.indexOf('constructor') === -1); 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Empty.js: -------------------------------------------------------------------------------- 1 | var calls = 0; 2 | 3 | var {} = calls++; 4 | assert.equal(calls, 1); 5 | 6 | var [] = calls++; 7 | assert.equal(calls, 2); 8 | 9 | var {} = calls++, [] = calls++; 10 | assert.equal(calls, 4); 11 | 12 | 13 | /////////////////////// 14 | 15 | calls = 0; 16 | 17 | ({} = calls++); 18 | assert.equal(calls, 1); 19 | 20 | [] = calls++; 21 | assert.equal(calls, 2); 22 | 23 | ({} = calls++, [] = calls++); 24 | assert.equal(calls, 4); 25 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectMixin.js: -------------------------------------------------------------------------------- 1 | var target = {a: 0, b: 2}; 2 | var source = {a: 1, c: 3, get d() { return this.b || this.a + 64; }}; 3 | var mixed = Object.mixin(target, source); 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | assert.isTrue(Object.hasOwnProperty("mixin")); 8 | assert.equal(mixed.a, source.a); 9 | assert.equal(mixed.b, target.b); 10 | assert.equal(mixed.c, source.c); 11 | assert.notEqual(mixed.d, source.d); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding2.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let result = []; 4 | let obj = {a : 'hello a', b : 'hello b', c : 'hello c' }; 5 | for (let x in obj) { 6 | result.push( 7 | function() { return obj[x]; } 8 | ); 9 | } 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | assert.equal('hello a', result[0]()); 14 | assert.equal('hello b', result[1]()); 15 | assert.equal('hello c', result[2]()); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/New.js: -------------------------------------------------------------------------------- 1 | function F(x, y, z) { 2 | this.x = x; 3 | this.y = y; 4 | this.z = z; 5 | this.self = this; 6 | this.F = F; 7 | } 8 | 9 | var object = new F(0, ...[1, 2]); 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | assert.equal(0, object.x); 14 | assert.equal(1, object.y); 15 | assert.equal(2, object.z); 16 | assert.equal(object, object.self); 17 | assert.isTrue(object instanceof object.F); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TemplateLiterals/MemberExpression.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | { 4 | let a = [function() { 5 | return 1; 6 | }]; 7 | 8 | assert.equal(1, a[0] `whatevs`); 9 | 10 | function f() { 11 | return [function() { 12 | return 2; 13 | }]; 14 | } 15 | 16 | assert.equal(2, f `abc` [0] `def`); 17 | 18 | let o = { 19 | g: function() { 20 | return 3; 21 | } 22 | }; 23 | 24 | assert.equal(3, o.g `ghi`); 25 | } 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Continue.js: -------------------------------------------------------------------------------- 1 | var x = ':'; 2 | 3 | function* f() { 4 | yield 1; 5 | var j = 0; 6 | label1: for (var i = 0; i < 3; i++) { 7 | x += 'i:' + i; 8 | x += 'j:' + j; 9 | if (j++ > 4) return; 10 | continue label1; 11 | x += 'x'; 12 | } 13 | } 14 | 15 | var g = f(); 16 | assert.deepEqual(g.next(), {value: 1, done: false}); 17 | assert.deepEqual(g.next(), {value: undefined, done: true}); 18 | assert.equal(x, ':i:0j:0i:1j:1i:2j:2'); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/AsyncMethodObjectLiteral.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncTimeout(ms) { 5 | return new Promise((resolve) => { 6 | setTimeout(resolve, ms); 7 | }); 8 | } 9 | 10 | var object = { 11 | async test() { 12 | var x = 0; 13 | await asyncTimeout(1); 14 | assert.equal(1, ++x); 15 | await asyncTimeout(1); 16 | assert.equal(2, ++x); 17 | done(); 18 | } 19 | } 20 | 21 | object.test(); 22 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/NestedScopeArguments.js: -------------------------------------------------------------------------------- 1 | // Destructuring bind alpha-renames 'arguments'; this ensures that 2 | // renaming doesn't rename in nested scopes. 3 | function destructNestedScopeArguments(x) { 4 | [(function () { return arguments[1]; })(null, x)[0]] = [42]; 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | 9 | var result = []; 10 | destructNestedScopeArguments(result); 11 | assert.equal(42, result[0]); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/build/parse-tree-visitor.header: -------------------------------------------------------------------------------- 1 | 2 | export class ParseTreeVisitor { 3 | visitAny(tree) { 4 | tree && tree.visit(this); 5 | } 6 | visit(tree) { 7 | this.visitAny(tree); 8 | } 9 | visitList(list) { 10 | if (list) { 11 | for (var i = 0; i < list.length; i++) { 12 | this.visitAny(list[i]); 13 | } 14 | } 15 | } 16 | visitStateMachine(tree) { 17 | throw Error('State machines should not live outside of the GeneratorTransformer.'); 18 | } -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/InheritanceFromNonclass.js: -------------------------------------------------------------------------------- 1 | function noClassA() {} 2 | noClassA.prototype = { 3 | ma: function() { return 'ma'; } 4 | } 5 | 6 | class NoClassB extends noClassA { 7 | mb() { 8 | return 'mb ' + super.ma(); 9 | } 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | var b = new NoClassB; 15 | assert.isTrue(b instanceof noClassA); 16 | assert.equal('ma', b.ma()); 17 | assert.equal('mb ma', b.mb()); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/MethodCallQuotedName.js: -------------------------------------------------------------------------------- 1 | var obj = { 2 | method: function(...args) { 3 | return { 4 | self: this, 5 | args: args 6 | }; 7 | } 8 | }; 9 | 10 | var result = { 11 | obj: obj, 12 | result: obj['meth' + 'od'](0, ...[1, 2], 3) 13 | }; 14 | 15 | // ---------------------------------------------------------------------------- 16 | 17 | assert.equal(result.obj, result.result.self); 18 | assertArrayEquals([0, 1, 2, 3], result.result.args); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/ThisBindings.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | // These tests are from: 4 | // http://wiki.ecmascript.org/doku.php?id=strawman:arrow_function_syntax 5 | 6 | const obj = { 7 | method: function () { 8 | return () => this; 9 | } 10 | }; 11 | assert.equal(obj.method()(), obj); 12 | 13 | let fake = {steal: obj.method()}; 14 | assert.equal(fake.steal(), obj); 15 | 16 | let real = {borrow: obj.method}; 17 | assert.equal(real.borrow()(), real); 18 | 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ObjectAssign.js: -------------------------------------------------------------------------------- 1 | var target = {a: 0, b: 2}; 2 | var source = {a: 1, c: 3, get d() { return this.b || this.a + 64; }}; 3 | var assigned = Object.assign(target, source); 4 | 5 | // ---------------------------------------------------------------------------- 6 | 7 | assert.isTrue(Object.hasOwnProperty("assign")); 8 | assert.equal(assigned.a, source.a); 9 | assert.equal(assigned.b, target.b); 10 | assert.equal(assigned.c, source.c); 11 | assert.equal(assigned.d, source.d); 12 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/GetAccessorStringName.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | 4 | class C { 5 | @Anno('x y z') 6 | get "x y z"() { return 1; } 7 | @Anno('xyz') 8 | get xyz() { return 1; } 9 | } 10 | 11 | assertArrayEquals([new Anno('x y z')], 12 | Object.getOwnPropertyDescriptor(C.prototype, 'x y z').get.annotations); 13 | assertArrayEquals([new Anno('xyz')], 14 | Object.getOwnPropertyDescriptor(C.prototype, 'xyz').get.annotations); 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/AlphaRenaming.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncComplete(self, arg) { 5 | return new Promise((resolve) => { 6 | resolve([self, arg]); 7 | }); 8 | } 9 | 10 | var self = {}; 11 | var obj = {}; 12 | var value; 13 | 14 | async function A() { 15 | assert.equal(this, self); 16 | var value = await asyncComplete(this, arguments[0]); 17 | assert.deepEqual([self, obj], value); 18 | done(); 19 | } 20 | 21 | A.call(self, obj); 22 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/DoGenerator.js: -------------------------------------------------------------------------------- 1 | function* doGenerator() { 2 | var i = 0; 3 | do { 4 | if (++i % 2 == 0) continue; 5 | yield i; 6 | } while (i < 6); 7 | } 8 | 9 | function accumulate(iterator) { 10 | var result = ''; 11 | for (var value of iterator) { 12 | result = result + String(value); 13 | } 14 | return result; 15 | } 16 | 17 | // ---------------------------------------------------------------------------- 18 | 19 | assert.equal('135', accumulate(doGenerator())); 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/node-commonjs-test.js: -------------------------------------------------------------------------------- 1 | var fs = require('fs'); 2 | 3 | var COMPILED_DIR = __dirname + '/commonjs-compiled'; 4 | 5 | function onlyJsFiles(path) { 6 | return /\.js$/.test(path); 7 | } 8 | 9 | var testFiles = fs.readdirSync(COMPILED_DIR).filter(onlyJsFiles); 10 | 11 | suite('commonjs', function() { 12 | testFiles.forEach(function(testFile) { 13 | test(testFile, function() { 14 | require('./commonjs-compiled/' + testFile.replace(/\.js$/, '')); 15 | }); 16 | }); 17 | }); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Finally.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | var finallyVisited = false; 5 | 6 | var resolve; 7 | var p = new Promise((r) => { 8 | resolve = r; 9 | }); 10 | var v; 11 | 12 | async function test() { 13 | try { 14 | v = await p; 15 | } finally { 16 | finallyVisited = true; 17 | } 18 | assert.equal(42, v); 19 | assert.isTrue(finallyVisited); 20 | done(); 21 | } 22 | 23 | test(); 24 | assert.isFalse(finallyVisited); 25 | resolve(42); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/PromiseThrowInResolve.js: -------------------------------------------------------------------------------- 1 | // Async. 2 | 3 | var message = 'testing'; 4 | var throwInResolve = new Promise((resolve, reject) => { 5 | resolve(42); 6 | }); 7 | throwInResolve.then((v) => { 8 | throw new Error(message); 9 | }).catch(function(ex) { 10 | // When catch() is used in testing, these asserts would 11 | // not be called, just the done() to avoid timeout. 12 | assert(ex instanceof Error); 13 | assert(ex.toString().indexOf(message) !== -1); 14 | done(ex); 15 | }).catch(done); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/YieldAssignThrow.js: -------------------------------------------------------------------------------- 1 | function* f() { 2 | var x; 3 | try { 4 | x = yield 1; 5 | } catch (ex) { 6 | yield ex; 7 | } 8 | return 2; 9 | } 10 | 11 | var g = f(); 12 | assert.deepEqual(g.next(), {value: 1, done: false}); 13 | assert.deepEqual(g.next(), {value: 2, done: true}); 14 | 15 | g = f(); 16 | assert.deepEqual(g.next(), {value: 1, done: false}); 17 | assert.deepEqual(g.throw(3), {value: 3, done: false}); 18 | assert.deepEqual(g.next(), {value: 2, done: true}); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForLexicallyNestedGenerator.js: -------------------------------------------------------------------------------- 1 | function* forLexicallyNestedGenerator() { 2 | yield* (function*() { yield [1,2,3]; yield* [4,5,6]; })(); 3 | } 4 | 5 | function accumulate(iterator) { 6 | var result = ''; 7 | for (var value of iterator) { 8 | result = result + String(value); 9 | } 10 | return result; 11 | } 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | assert.equal('1,2,3456', accumulate(forLexicallyNestedGenerator())); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/OptionalParams.js: -------------------------------------------------------------------------------- 1 | class OptionalParams { 2 | constructor(opt = 1) { 3 | this.opt = opt; 4 | } 5 | instanceMethod(opt = 2) { 6 | return opt; 7 | } 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | var obj = new OptionalParams(); 13 | assert.equal(1, obj.opt); 14 | assert.equal(2, obj.instanceMethod()); 15 | assert.equal(3, obj.instanceMethod(3)); 16 | 17 | var obj2 = new OptionalParams(2); 18 | assert.equal(2, obj2.opt); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Timeout.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncTimeout(ms) { 5 | return new Promise((resolve) => { 6 | setTimeout(resolve, ms); 7 | }); 8 | } 9 | 10 | (async function() { 11 | var x = 0; 12 | await asyncTimeout(1); 13 | assert.equal(1, ++x); 14 | await asyncTimeout(1); 15 | assert.equal(2, ++x); 16 | await asyncTimeout(1); 17 | assert.equal(3, ++x); 18 | await asyncTimeout(1); 19 | assert.equal(4, ++x); 20 | done(); 21 | })(); 22 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/demo/async-read-file.js: -------------------------------------------------------------------------------- 1 | // Run this with 2 | // 3 | // traceur --experimental async-read-file.js file-to-read 4 | 5 | function lineCount(file) { 6 | var data; 7 | try { 8 | // TODO: make await an expression. 9 | await data = require('fs').readFile(file, 'utf8'); 10 | console.log(`${file} has ${data.split('\n').length} lines`); 11 | } catch (ex) { 12 | console.error(ex); 13 | } 14 | } 15 | 16 | var fileName = process.argv[2]; 17 | lineCount(fileName); 18 | console.log(`Loading ${fileName}...`); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Getters.js: -------------------------------------------------------------------------------- 1 | class GetterA { 2 | get x() { return 'getter x'; } 3 | get y() { return 'getter y'; } 4 | } 5 | 6 | class GetterB extends GetterA { 7 | get x() { return super.x; } 8 | } 9 | 10 | class GetterC extends GetterB { 11 | get y() { return super.y; } 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | 16 | var b = new GetterB(); 17 | var c = new GetterC(); 18 | 19 | assert.equal('getter x', b.x); 20 | assert.equal('getter y', c.y); 21 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/Class.js: -------------------------------------------------------------------------------- 1 | class SpreadTestClass { 2 | constructor(x, y) { 3 | this.SpreadTestClass = SpreadTestClass; 4 | this.self = this; 5 | this.x = x; 6 | this.y = y; 7 | } 8 | } 9 | 10 | var object = new SpreadTestClass(...[0, 1]); 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | assert.equal(object.x, 0); 15 | assert.equal(object.y, 1); 16 | assert.equal(object.self, object); 17 | assert.isTrue(object instanceof object.SpreadTestClass); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Value.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | async function asyncValue(value) { 5 | if (true) 6 | return value; 7 | await asyncYield(); 8 | } 9 | 10 | function asyncYield() { 11 | return asyncTimeout(0); 12 | } 13 | 14 | function asyncTimeout(ms) { 15 | return new Promise((resolve) => { 16 | setTimeout(resolve, ms); 17 | }); 18 | } 19 | 20 | (async function() { 21 | var value = await asyncValue(42); 22 | assert.equal(42, value); 23 | done(); 24 | })(); 25 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TypeAssertions/Variables.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true --type-assertions --type-assertion-module=./resources/assert 2 | var globalVar:Number = 1; 3 | var globalUninitializedVar:Number; 4 | 5 | function variableTypes() { 6 | var x:Number = 1; 7 | var y:Number; 8 | var a:Number, b:Number; 9 | var c:Number = 1, d:Number = 2, e:String = 'test'; 10 | } 11 | 12 | function throwsAssertion(value) { 13 | var x:Number = value; 14 | } 15 | 16 | assert.throw(() => { throwsAssertion('test'); }, chai.AssertionError); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/ArrowFunction.js: -------------------------------------------------------------------------------- 1 | var f = ({x}) => x; 2 | assert.equal(42, f({x: 42})); 3 | 4 | var g = ({x: y, z: [a, b, ...c]}) => [y, a, b, c]; 5 | assertArrayEquals([1, 2, 3, [4, 5]], g({x: 1, z: [2, 3, 4, 5]})); 6 | 7 | var h = ([a, {b: c, d}]) => [a, c, d]; 8 | assertArrayEquals([1, 2, 3], h([1, {b: 2, d: 3}])); 9 | 10 | var i = ([, a]) => a; 11 | assert.equal(i([0, 1]), 1); 12 | 13 | var j = ([, [, a]]) => a; 14 | assert.equal(j([0, [1, 2]]), 2); 15 | 16 | var k = ([a] = 'b') => a; 17 | assert.equal(k(), 'b'); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/BlockBinding5.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | let result = []; 4 | for (let i = 1; i < 3; i ++) { 5 | for (let j = 9; j > 7; j --) { 6 | result.push( 7 | function() { return i + ':' + j; } 8 | ); 9 | } 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | assert.equal('1:9', result[0]()); 15 | assert.equal('1:8', result[1]()); 16 | assert.equal('2:9', result[2]()); 17 | assert.equal('2:8', result[3]()); 18 | assert.equal(4, result.length); 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Symbol/Inherited.js: -------------------------------------------------------------------------------- 1 | // Options: --symbols 2 | 3 | var s = Symbol(); 4 | var p = {}; 5 | Object.defineProperty(p, s, { 6 | get: function() { 7 | return 42; 8 | }, 9 | configurable: true 10 | }); 11 | 12 | var o = Object.create(p); 13 | assert.equal(42, o[s]); 14 | assert.throws(function() { 15 | o[s] = 1; 16 | }, TypeError); 17 | 18 | var val; 19 | Object.defineProperty(p, s, { 20 | set: function(v) { 21 | val = v; 22 | }, 23 | configurable: true 24 | }); 25 | 26 | o[s] = 33; 27 | assert.equal(33, val); 28 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/Finally.js: -------------------------------------------------------------------------------- 1 | var finallyVisited = false; 2 | 3 | function* test() { 4 | try { 5 | yield 42; 6 | } finally { 7 | finallyVisited = true; 8 | } 9 | } 10 | 11 | var it = test(); 12 | assert.deepEqual({value: 42, done: false}, it.next()); 13 | assert.isFalse(finallyVisited); 14 | 15 | assert.deepEqual({value: undefined, done: true}, it.next()); 16 | assert.isTrue(finallyVisited); 17 | 18 | finallyVisited = false; 19 | for (var i of test()) { 20 | assert.equal(42, i); 21 | } 22 | assert.isTrue(finallyVisited); 23 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Catch.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | // Block binding is needed to get the right scoping semantics inside the catch 3 | // block. 4 | 5 | var head = 'head'; 6 | var tail = 'tail'; 7 | var name = 'name'; 8 | 9 | try { 10 | throw new Error('abc'); 11 | } catch ({message: [head, ...tail], name}) { 12 | assert.equal('a', head); 13 | assertArrayEquals(['b', 'c'], tail); 14 | assert.equal('Error', name); 15 | } 16 | 17 | assert.equal('head', head); 18 | assert.equal('tail', tail); 19 | assert.equal('name', name); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/SequenceGenerator.js: -------------------------------------------------------------------------------- 1 | function* sequenceGenerator() { 2 | var i = 1; 3 | yield i; 4 | i = 3; 5 | yield i + 1; 6 | { 7 | var x = 3; 8 | yield i + x; 9 | yield x; 10 | } 11 | } 12 | 13 | function accumulate(iterator) { 14 | var result = ''; 15 | for (var value of iterator) { 16 | result = result + String(value); 17 | } 18 | return result; 19 | } 20 | 21 | // ---------------------------------------------------------------------------- 22 | 23 | assert.equal('1463', accumulate(sequenceGenerator())); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/addon/lint/yaml-lint.js: -------------------------------------------------------------------------------- 1 | // Depends on js-yaml.js from https://github.com/nodeca/js-yaml 2 | 3 | // declare global: jsyaml 4 | 5 | CodeMirror.registerHelper("lint", "yaml", function(text) { 6 | var found = []; 7 | try { jsyaml.load(text); } 8 | catch(e) { 9 | var loc = e.mark; 10 | found.push({ from: CodeMirror.Pos(loc.line, loc.column), to: CodeMirror.Pos(loc.line, loc.column), message: e.message }); 11 | } 12 | return found; 13 | }); 14 | CodeMirror.yamlValidator = CodeMirror.lint.yaml; // deprecated 15 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/TryCatchYieldGenerator.js: -------------------------------------------------------------------------------- 1 | // yield form within a catch block 2 | function* tryCatchYieldGenerator() { 3 | var x = 3; 4 | try { 5 | throw 5; 6 | } catch (e) { 7 | yield e * x; 8 | } 9 | } 10 | 11 | function accumulate(iterator) { 12 | var result = ''; 13 | for (var value of iterator) { 14 | result = result + String(value); 15 | } 16 | return result; 17 | } 18 | 19 | // ---------------------------------------------------------------------------- 20 | 21 | assert.equal('15', accumulate(tryCatchYieldGenerator())); 22 | -------------------------------------------------------------------------------- /chapter01/03_forEach.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Using forEach 4 | 5 | 6 | 7 | 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/ConstructorChaining.js: -------------------------------------------------------------------------------- 1 | class ConstructorA { 2 | constructor(x) { 3 | this.x = x; 4 | } 5 | } 6 | 7 | class ConstructorB extends ConstructorA { 8 | constructor(x, y) { 9 | super(x); 10 | this.y = y; 11 | } 12 | } 13 | 14 | // ---------------------------------------------------------------------------- 15 | 16 | var a = new ConstructorA('ax'); 17 | assert.equal('ax', a.x); 18 | assert.isFalse(a.hasOwnProperty('y')); 19 | 20 | var b = new ConstructorB('bx', 'by'); 21 | assert.equal('bx', b.x); 22 | assert.equal('by', b.y); 23 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/FieldInitializers.js: -------------------------------------------------------------------------------- 1 | class Point { 2 | constructor() { 3 | this.x = 0; 4 | this.y = 0; 5 | } 6 | } 7 | 8 | // ---------------------------------------------------------------------------- 9 | 10 | var p = new Point(); 11 | assert.equal(0, p.x); 12 | assert.equal(0, p.y); 13 | p.x = 1; 14 | assert.equal(1, p.x); 15 | 16 | var p2 = new Point(); 17 | assert.equal(0, p2.x); 18 | assert.equal(0, p2.y); 19 | assert.equal(1, p.x); 20 | 21 | for (var element in Point) { 22 | fail('Point contains static member : ' + element); 23 | } 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Method.js: -------------------------------------------------------------------------------- 1 | class Universe { 2 | answer() { 3 | return 42; 4 | } 5 | } 6 | 7 | // ---------------------------------------------------------------------------- 8 | 9 | var universe = new Universe(); 10 | assert.equal(42, universe.answer()); 11 | 12 | var keys = []; 13 | for (var key in universe) { 14 | keys.push(key); 15 | } 16 | assert.isTrue(keys.indexOf('answer') !== -1); 17 | assert.isTrue(keys.indexOf('constructor') === -1); 18 | 19 | for (var key in Universe) { 20 | fail('Universe contains static member : ' + key); 21 | } 22 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Rest.js: -------------------------------------------------------------------------------- 1 | function destructRest() { 2 | var a, b, c, d, e; 3 | [...a] = [1, 2, 3]; 4 | [b, ...c] = [1, 2, 3]; 5 | [,,, ...d] = [1, 2, 3]; 6 | [...e] = {x: 'boom'}; 7 | return {a: a, b: b, c: c, d: d, e: e}; 8 | } 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | var result = destructRest(); 13 | assertArrayEquals([1, 2, 3], result.a); 14 | assert.equal(1, result.b); 15 | assertArrayEquals([2, 3], result.c); 16 | assertArrayEquals([], result.d); 17 | assertArrayEquals([], result.e); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ExportedFunction.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | import defaultExportedFunction from './resources/exported-default-function'; 4 | 5 | import { 6 | exportedAnnotated, 7 | exportedUnannotated 8 | } from './resources/exported-functions'; 9 | 10 | assertArrayEquals([new Anno], exportedAnnotated.annotations); 11 | assertArrayEquals([[new Anno]], exportedAnnotated.parameters); 12 | assert.isUndefined(exportedUnannotated.annotations); 13 | assertArrayEquals([[new Anno]], exportedUnannotated.parameters); 14 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SuperUnary.js: -------------------------------------------------------------------------------- 1 | class B { 2 | constructor() { 3 | this._x = 0; 4 | } 5 | get x() { 6 | return this._x; 7 | } 8 | set x(x) { 9 | this._x = x; 10 | } 11 | } 12 | 13 | class C extends B { 14 | m() { 15 | assert.equal(this.x, 0); 16 | assert.equal(++super.x, 1); 17 | assert.equal(this.x, 1); 18 | assert.equal(--super.x, 0); 19 | assert.equal(this.x, 0); 20 | 21 | // Don't use assert.typeOf since we are testing typeof. 22 | assert.equal(typeof super.x, 'number'); 23 | } 24 | } 25 | 26 | new C().m(); 27 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/SuperChaining.js: -------------------------------------------------------------------------------- 1 | class ChainA { 2 | foo() { 3 | return 'A'; 4 | } 5 | } 6 | 7 | class ChainB extends ChainA { 8 | foo() { 9 | return super.foo() + ' B'; 10 | } 11 | } 12 | 13 | class ChainC extends ChainB { 14 | foo() { 15 | return super.foo() + ' C'; 16 | } 17 | } 18 | 19 | class ChainD extends ChainC { 20 | foo() { 21 | return super.foo() + ' D'; 22 | } 23 | } 24 | 25 | // ---------------------------------------------------------------------------- 26 | 27 | var d = new ChainD(); 28 | assert.equal('A B C D', d.foo()); 29 | -------------------------------------------------------------------------------- /chapter01/08_objectKeys.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Object.keys 4 | 5 | 6 | 7 | 19 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/TypeAssertions/PrimitiveValueTypes.js: -------------------------------------------------------------------------------- 1 | // Options: --types=true --type-assertions --type-assertion-module=./resources/assert 2 | 3 | function foo(a: string): boolean { 4 | var x: number = 1; 5 | return true; 6 | } 7 | 8 | function failReturn(): number { 9 | return 'str'; 10 | } 11 | 12 | function failVariable() { 13 | var x: string = true; 14 | } 15 | 16 | 17 | foo('bar'); 18 | assert.throw(() => { foo(123) }, chai.AssertionError); 19 | assert.throw(() => { failReturn() }, chai.AssertionError); 20 | assert.throw(() => { failVariable() }, chai.AssertionError); 21 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/addon/fold/foldgutter.css: -------------------------------------------------------------------------------- 1 | .CodeMirror-foldmarker { 2 | color: blue; 3 | text-shadow: #b9f 1px 1px 2px, #b9f -1px -1px 2px, #b9f 1px -1px 2px, #b9f -1px 1px 2px; 4 | font-family: arial; 5 | line-height: .3; 6 | cursor: pointer; 7 | } 8 | .CodeMirror-foldgutter { 9 | width: .7em; 10 | } 11 | .CodeMirror-foldgutter-open, 12 | .CodeMirror-foldgutter-folded { 13 | color: #555; 14 | cursor: pointer; 15 | } 16 | .CodeMirror-foldgutter-open:after { 17 | content: "\25BE"; 18 | } 19 | .CodeMirror-foldgutter-folded:after { 20 | content: "\25B8"; 21 | } 22 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/mode/tiki/tiki.css: -------------------------------------------------------------------------------- 1 | .cm-tw-syntaxerror { 2 | color: #FFF; 3 | background-color: #900; 4 | } 5 | 6 | .cm-tw-deleted { 7 | text-decoration: line-through; 8 | } 9 | 10 | .cm-tw-header5 { 11 | font-weight: bold; 12 | } 13 | .cm-tw-listitem:first-child { /*Added first child to fix duplicate padding when highlighting*/ 14 | padding-left: 10px; 15 | } 16 | 17 | .cm-tw-box { 18 | border-top-width: 0px ! important; 19 | border-style: solid; 20 | border-width: 1px; 21 | border-color: inherit; 22 | } 23 | 24 | .cm-tw-underline { 25 | text-decoration: underline; 26 | } -------------------------------------------------------------------------------- /chapter01/05_forEachWithAnIndexCounter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Using forEach 4 | 5 | 6 | 7 | 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/YieldIdentifier.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | 3 | // ensure non strict mode. 4 | function f() { return this; } 5 | assert(f.call(undefined) !== undefined); 6 | 7 | var yield = 1; 8 | assert.equal(yield, 1); 9 | 10 | function g(yield) { 11 | return yield; 12 | } 13 | assert.equal(g(2), 2); 14 | 15 | var o = { 16 | yield: yield 17 | }; 18 | assert.equal(o.yield, 1); 19 | 20 | var o2 = { 21 | yield 22 | }; 23 | assert.equal(o.yield, 1); 24 | 25 | function h(yield) { 26 | return yield * yield; 27 | } 28 | assert.equal(h(3), 9); 29 | })(); 30 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrayIterator.js: -------------------------------------------------------------------------------- 1 | var a = ['a', 'b', 'c']; 2 | 3 | var res = []; 4 | for (var x of a) { 5 | res.push(x); 6 | } 7 | assert.deepEqual(res, ['a', 'b', 'c']); 8 | 9 | assert.equal(a[Symbol.iterator], a.values); 10 | 11 | res = []; 12 | for (var x of a.values()) { 13 | res.push(x); 14 | } 15 | assert.deepEqual(res, ['a', 'b', 'c']); 16 | 17 | res = []; 18 | for (var x of a.keys()) { 19 | res.push(x); 20 | } 21 | assert.deepEqual(res, [0, 1, 2]); 22 | 23 | res = []; 24 | for (var x of a.entries()) { 25 | res.push(x); 26 | } 27 | assert.deepEqual(res, [[0, 'a'], [1, 'b'], [2, 'c']]); 28 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/ExportedClass.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations 2 | import {Anno} from './resources/setup'; 3 | import DefaultExportedAnnotatedClass from './resources/exported-default-class'; 4 | import { 5 | ExportedAnnotatedClass, 6 | ExportedUnannotatedClass 7 | } from './resources/exported-classes'; 8 | 9 | 10 | assertArrayEquals([new Anno], ExportedAnnotatedClass.annotations); 11 | assertArrayEquals([new Anno], 12 | ExportedAnnotatedClass.prototype.annotatedMethod.annotations); 13 | 14 | assertArrayEquals([new Anno], 15 | ExportedUnannotatedClass.prototype.annotatedMethod.annotations); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Spread/New2.js: -------------------------------------------------------------------------------- 1 | function G() {} 2 | 3 | function F(x, y, z) { 4 | var obj = new G; 5 | obj.x = x; 6 | obj.y = y; 7 | obj.z = z; 8 | obj.f = this; 9 | obj.G = G; 10 | obj.F = F; 11 | return obj; 12 | } 13 | 14 | var object = new F(0, ...[1, 2]); 15 | 16 | // ---------------------------------------------------------------------------- 17 | 18 | assert.equal(0, object.x); 19 | assert.equal(1, object.y); 20 | assert.equal(2, object.z); 21 | assert.isFalse(object instanceof object.F); 22 | assert.isTrue(object instanceof object.G); 23 | assert.isTrue(object.f instanceof object.F); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/AnnotatedTypedClass.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | Anno2, 5 | X 6 | } from './resources/setup'; 7 | 8 | @Anno('class') 9 | class AnnotatedTypedClass { 10 | @Anno2('ctor') 11 | constructor(@Anno a:X, @Anno('b') b) { 12 | this.foo = a; 13 | } 14 | 15 | bar(a:X) {} 16 | } 17 | 18 | assertArrayEquals([new Anno('class'), new Anno2('ctor')], AnnotatedTypedClass.annotations); 19 | assertArrayEquals([[X, new Anno], [new Anno('b')]], AnnotatedTypedClass.parameters); 20 | assertArrayEquals([[X]], AnnotatedTypedClass.prototype.bar.parameters); 21 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Annotations/UnannotatedTypedClass.js: -------------------------------------------------------------------------------- 1 | // Options: --annotations --types 2 | import { 3 | Anno, 4 | X 5 | } from './resources/setup'; 6 | 7 | class UnannotatedClass { 8 | constructor(a:X, b) { 9 | this.abc = a; 10 | } 11 | 12 | bar(a:X) {} 13 | 14 | set setter(a:X) { 15 | this.abc = a; 16 | } 17 | } 18 | 19 | assertArrayEquals([[X], []], UnannotatedClass.parameters); 20 | assertArrayEquals([[X]], UnannotatedClass.prototype.bar.parameters); 21 | assertArrayEquals([[X]], 22 | Object.getOwnPropertyDescriptor(UnannotatedClass.prototype, 'setter'). 23 | set.parameters); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/Throw.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | async function asyncThrow(e) { 5 | if (true) 6 | throw e; 7 | await asyncYield(); 8 | } 9 | 10 | function asyncYield() { 11 | return asyncTimeout(0); 12 | } 13 | 14 | function asyncTimeout(ms) { 15 | return new Promise((resolve) => { 16 | setTimeout(resolve, ms); 17 | }); 18 | } 19 | 20 | (async function() { 21 | var value; 22 | try { 23 | value = await asyncThrow(1); 24 | fail("shouldn't get here"); 25 | } catch (e) { 26 | assert.equal(1, e); 27 | } 28 | 29 | done(); 30 | })(); 31 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/YieldYield.js: -------------------------------------------------------------------------------- 1 | function* f(x) { 2 | yield (yield x); 3 | } 4 | 5 | var g = f(1); 6 | assert.deepEqual(g.next(), {value: 1, done: false}); 7 | assert.deepEqual(g.next(2), {value: 2, done: false}); 8 | assert.deepEqual(g.next(3), {value: undefined, done: true}); 9 | 10 | function* f2(x) { 11 | yield* (yield x); 12 | } 13 | 14 | g = f(1); 15 | var g2 = f2(1); 16 | assert.deepEqual(g2.next(), {value: 1, done: false}); 17 | assert.deepEqual(g2.next(g), {value: 1, done: false}); 18 | assert.deepEqual(g2.next(2), {value: 2, done: false}); 19 | assert.deepEqual(g2.next(3), {value: undefined, done: true}); 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/FreeVariableChecker/WithVarDecl.js: -------------------------------------------------------------------------------- 1 | var o = {xW: 0, yW: 0, propW: {xW: 0, yW: 0, funcW: null}}; 2 | 3 | with (o) { 4 | xW = 20; 5 | yW = xW * xW; 6 | function funcW(x, y) { return y / x + x; } 7 | var withVar; 8 | } 9 | 10 | withVar = 20; 11 | assert.equal(40, funcW(o.xW, o.yW)); 12 | 13 | with (o) { 14 | with (propW) { 15 | xW = 21; 16 | yW = xW * xW; 17 | funcW = function(f, x, y) { return f(x, y) * 100; } 18 | var withVar2; 19 | } 20 | } 21 | 22 | withVar2 = 20; 23 | var op = o.propW; 24 | assert.equal(42, funcW(op.xW, op.yW)); 25 | assert.equal(4200, op.funcW(funcW, op.xW, op.yW)); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Syntax/ExpressionValidation.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | // test MemberLookupExpression 4 | function f(a) { 5 | var b = [42]; 6 | return (a||b)[0]; 7 | } 8 | 9 | assert.equal(42, f(null)); 10 | assert.equal(43, f([43])); 11 | 12 | // test NewExpression 13 | var a, b = function() { this.ans = 42; }; 14 | assert.equal(new (a||b)().ans, 42); 15 | 16 | a = function() { this.ans = 43; }; 17 | assert.equal(new (a||b)().ans, 43); 18 | 19 | // test CallExpression 20 | a = undefined; 21 | b = function() { return 42; } 22 | assert.equal((a||b)(), 42); 23 | 24 | a = function() { return 43; } 25 | assert.equal((a||b)(), 43); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/demo/expressServer.js: -------------------------------------------------------------------------------- 1 | var express = require('express'); 2 | var http = require('http'); 3 | 4 | function servePathAtPort(path, port) { 5 | var app = express(); 6 | app.use(express.static(path)); // before directory to allow index.html to work 7 | app.use(express.directory(path)); 8 | var server = http.createServer(app); 9 | server.on('error', function(e) { 10 | console.log('Port ' + port + ' did not work out'); 11 | }); 12 | server.listen.apply(server, [port]); 13 | console.log('serving ' + path + ' at ' + port); 14 | } 15 | 16 | servePathAtPort(__dirname + '/..', 8099); 17 | servePathAtPort(__dirname + '/..', 80); 18 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/ArrowFunctions/Skip_InitialiserShorthand.js: -------------------------------------------------------------------------------- 1 | // Skip. Not implemented. 2 | 3 | // TODO: needs the intialiser shorthand implemented for arrow functions 4 | 5 | // Object intialiser shorthand: "method" = function-valued property with dynamic ''this'' 6 | const obj = { 7 | method() -> { 8 | return => this; 9 | } 10 | }; 11 | 12 | assert(obj.method() === obj); 13 | assert(obj.method.call(u) === u); 14 | 15 | // Name binding forms hoist to body (var) or block (let, const) top 16 | var warmer(a) -> { return a; }; 17 | let warm(b) -> { return b; }; 18 | const colder(c) -> { return c; }; 19 | const #coldest(d) -> {...}; 20 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForInGenerator3.js: -------------------------------------------------------------------------------- 1 | function* forInGenerator3() { 2 | var object = { 3 | a: 0, 4 | b: { 5 | c: 1, 6 | }, 7 | d: 2 8 | }; 9 | for (var key in object) { 10 | yield key; 11 | for (var key2 in object[key]) { 12 | yield key2; 13 | } 14 | } 15 | } 16 | 17 | function accumulate(iterator) { 18 | var result = ''; 19 | for (var value of iterator) { 20 | result = result + String(value); 21 | } 22 | return result; 23 | } 24 | 25 | // ---------------------------------------------------------------------------- 26 | 27 | assert.equal('abcd',accumulate(forInGenerator3())); 28 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/third_party/codemirror-3.22/addon/edit/trailingspace.js: -------------------------------------------------------------------------------- 1 | CodeMirror.defineOption("showTrailingSpace", false, function(cm, val, prev) { 2 | if (prev == CodeMirror.Init) prev = false; 3 | if (prev && !val) 4 | cm.removeOverlay("trailingspace"); 5 | else if (!prev && val) 6 | cm.addOverlay({ 7 | token: function(stream) { 8 | for (var l = stream.string.length, i = l; i && /\s/.test(stream.string.charAt(i - 1)); --i) {} 9 | if (i > stream.pos) { stream.pos = i; return null; } 10 | stream.pos = l; 11 | return "trailingspace"; 12 | }, 13 | name: "trailingspace" 14 | }); 15 | }); 16 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/IfGenerator.js: -------------------------------------------------------------------------------- 1 | function* ifGenerator(condition) { 2 | if (condition) { 3 | yield 1; 4 | } 5 | if (!condition) { 6 | yield 2; 7 | } 8 | if (condition) { 9 | yield 3; 10 | } else { 11 | yield 4; 12 | } 13 | } 14 | 15 | function accumulate(iterator) { 16 | var result = ''; 17 | for (var value of iterator) { 18 | result = result + String(value); 19 | } 20 | return result; 21 | } 22 | 23 | // ---------------------------------------------------------------------------- 24 | 25 | assert.equal('13', accumulate(ifGenerator(true))); 26 | assert.equal('24', accumulate(ifGenerator(false))); 27 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/WhileGenerator.js: -------------------------------------------------------------------------------- 1 | function* whileGenerator(max, continueValue, breakValue) { 2 | var i = 0; 3 | while (i < max) { 4 | i++; 5 | if (i == continueValue) { 6 | continue; 7 | } 8 | if (i == breakValue) { 9 | break; 10 | } 11 | yield i; 12 | } 13 | } 14 | 15 | function accumulate(iterator) { 16 | var result = ''; 17 | for (var value of iterator) { 18 | result = result + String(value); 19 | } 20 | return result; 21 | } 22 | 23 | // ---------------------------------------------------------------------------- 24 | 25 | assert.equal('13', accumulate(whileGenerator(10, 2, 4))); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Classes/Skip_HTMLBlockquoteElement.js: -------------------------------------------------------------------------------- 1 | // Skip. Not implemented. 2 | // Only in browser. 3 | 4 | class CustomBlockquote extends HTMLBlockquoteElement { 5 | constructor() { 6 | this.custom = 42; 7 | } 8 | } 9 | 10 | var customBlockquote = new CustomBlockquote; 11 | assert.equal(42, customBlockquote.custom); 12 | assert.equal('BLOCKQUOTE', customBlockquote.tagName); 13 | assert.isTrue(customBlockquote instanceof CustomBlockquote); 14 | assert.isTrue(customBlockquote instanceof HTMLBlockquoteElement); 15 | assert.isTrue(customBlockquote instanceof HTMLQuoteElement); 16 | assert.isTrue(customBlockquote instanceof HTMLElement); 17 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/Array.js: -------------------------------------------------------------------------------- 1 | function destructArray() { 2 | var a, b, c, d; 3 | [a, [b], c, d] = ['hello', [',', 'junk'], ['world']]; 4 | return { 5 | a: a, 6 | b: b, 7 | c: c, 8 | d: d 9 | }; 10 | } 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | var result = destructArray(); 15 | assert.equal('hello', result.a); 16 | assert.equal(',', result.b); 17 | assertArrayEquals(['world'], result.c); 18 | assert.isUndefined(result.d); 19 | 20 | function testNested() { 21 | var a; 22 | [[a] = ['b']] = []; 23 | return a; 24 | } 25 | assert.equal(testNested(), 'b'); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Destructuring/ForOfLoop.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function* gen() { 4 | yield 'abc'; 5 | yield 'def'; 6 | } 7 | 8 | var expectedHeads = ['a', 'd']; 9 | var expectedTails = [['b', 'c'], ['e','f']]; 10 | var i = 0; 11 | for (var [head, ...tail] of gen()) { 12 | assert.equal(expectedHeads[i], head); 13 | assertArrayEquals(expectedTails[i], tail); 14 | i++; 15 | } 16 | assert.equal(2, i); 17 | 18 | { 19 | let x = 42; 20 | for (let {length: x} of gen()) { 21 | assert.equal(3, x); 22 | } 23 | assert.equal(42, x); 24 | } 25 | 26 | var k; 27 | for ({length: k} of ['abc']) // No block 28 | assert.equal(3, k); -------------------------------------------------------------------------------- /chapter01/06_forEachWithArrowFunction.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Using forEach 4 | 5 | 6 | 7 | 22 | -------------------------------------------------------------------------------- /chapter01/24_gettersAndSetters.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | Getters and setters 4 | 5 | 6 | 7 | 23 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForInGenerator.js: -------------------------------------------------------------------------------- 1 | function* forInGenerator() { 2 | var object = { 3 | a: 0, 4 | b: 1, 5 | c: 2 6 | }; 7 | for (var key in object) { 8 | if (key == 'a') { 9 | delete object.b; 10 | object.d = 3; 11 | } 12 | yield key; 13 | yield object[key]; 14 | } 15 | } 16 | 17 | function accumulate(iterator) { 18 | var result = ''; 19 | for (var value of iterator) { 20 | result = result + String(value); 21 | } 22 | return result; 23 | } 24 | 25 | // ---------------------------------------------------------------------------- 26 | 27 | assert.equal('a0c2',accumulate(forInGenerator())); 28 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/SwitchStatementWithYield.js: -------------------------------------------------------------------------------- 1 | function* f(x) { 2 | switch (yield x) { 3 | case 1: 4 | return 1; 5 | case 2: 6 | return 2; 7 | default: 8 | return 3; 9 | } 10 | throw new Error('Unreachable'); 11 | } 12 | 13 | var g = f(1); 14 | assert.deepEqual(g.next(), {value: 1, done: false}); 15 | assert.deepEqual(g.next(2), {value: 2, done: true}); 16 | 17 | g = f(3); 18 | assert.deepEqual(g.next(), {value: 3, done: false}); 19 | assert.deepEqual(g.next(1), {value: 1, done: true}); 20 | 21 | var g = f(4); 22 | assert.deepEqual(g.next(), {value: 4, done: false}); 23 | assert.deepEqual(g.next(55), {value: 3, done: true}); 24 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/YieldUndefinedGenerator.js: -------------------------------------------------------------------------------- 1 | function* yieldUndefinedGenerator1() { 2 | yield 1; 3 | yield; 4 | yield 2; 5 | } 6 | 7 | function* yieldUndefinedGenerator2() { 8 | yield 1; 9 | yield undefined; 10 | yield 2; 11 | } 12 | 13 | function accumulate(iterator) { 14 | var result = ''; 15 | for (var value of iterator) { 16 | result = result + String(value); 17 | } 18 | return result; 19 | } 20 | 21 | // ---------------------------------------------------------------------------- 22 | 23 | assert.equal('1undefined2', accumulate(yieldUndefinedGenerator1())); 24 | assert.equal('1undefined2', accumulate(yieldUndefinedGenerator2())); 25 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/AsyncFunctions/AsyncMethod.js: -------------------------------------------------------------------------------- 1 | // Options: --async-functions 2 | // Async. 3 | 4 | function asyncTimeout(ms) { 5 | return new Promise((resolve) => { 6 | setTimeout(resolve, ms); 7 | }); 8 | } 9 | 10 | class C { 11 | async test() { 12 | var x = 0; 13 | await asyncTimeout(1); 14 | assert.equal(1, ++x); 15 | await asyncTimeout(1); 16 | assert.equal(2, ++x); 17 | C.test(); 18 | } 19 | 20 | static async test() { 21 | var x = 0; 22 | await asyncTimeout(1); 23 | assert.equal(1, ++x); 24 | await asyncTimeout(1); 25 | assert.equal(2, ++x); 26 | 27 | done(); 28 | } 29 | } 30 | 31 | new C().test(); 32 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/GeneratorComprehension/Skip_Closure.js: -------------------------------------------------------------------------------- 1 | // Skip. The sugaring uses var instead of let which leads to wrong closure. 2 | 3 | var iter = (for (x of [0, 1]) for (y of [2, 3]) () => [x, y] ); 4 | 5 | assert.isTrue(iter.moveNext()); 6 | var f1 = iter.current; 7 | 8 | assert.isTrue(iter.moveNext()); 9 | var f2 = iter.current; 10 | 11 | assert.isTrue(iter.moveNext()); 12 | var f3 = iter.current; 13 | 14 | assert.isTrue(iter.moveNext()); 15 | var f4 = iter.current; 16 | 17 | assert.isFalse(iter.moveNext()); 18 | 19 | assertArrayEquals([0, 2], f1()); 20 | assertArrayEquals([0, 3], f2()); 21 | assertArrayEquals([1, 2], f3()); 22 | assertArrayEquals([1, 3], f4()); -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Scope/LetInClosure.js: -------------------------------------------------------------------------------- 1 | // Options: --block-binding 2 | 3 | function letInClosure(n) { 4 | var l = []; 5 | for (var i = 0; i < n; i ++) { 6 | let let_i = i; 7 | if (i % 3 == 0) { 8 | continue; 9 | } 10 | l.push(function() { 11 | return let_i; 12 | }); 13 | } 14 | return l; 15 | } 16 | 17 | // ---------------------------------------------------------------------------- 18 | 19 | var result = letInClosure(10); 20 | assert.equal(1, result[0]()); 21 | assert.equal(2, result[1]()); 22 | assert.equal(4, result[2]()); 23 | assert.equal(5, result[3]()); 24 | assert.equal(7, result[4]()); 25 | assert.equal(8, result[5]()); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForGenerator.js: -------------------------------------------------------------------------------- 1 | function* forGenerator() { 2 | var a = 1, b = 1; 3 | for (var i = 0; i < 4; i++) { 4 | // TODO(jmesserly): this was changed until we get destructing 5 | //[a, b] = [b, a + b]; 6 | var t0 = b; 7 | var t1 = a + b; 8 | a = t0; 9 | b = t1; 10 | 11 | yield a; 12 | } 13 | } 14 | 15 | function accumulate(iterator) { 16 | var result = ''; 17 | for (var value of iterator) { 18 | result = result + String(value); 19 | } 20 | return result; 21 | } 22 | 23 | // ---------------------------------------------------------------------------- 24 | 25 | assert.equal('1235', accumulate(forGenerator())); 26 | -------------------------------------------------------------------------------- /library/plugins/traceur-compiler/test/feature/Yield/ForInGenerator2.js: -------------------------------------------------------------------------------- 1 | function* forInGenerator2() { 2 | var object = { 3 | a: 0, 4 | b: 1, 5 | c: 2 6 | }; 7 | var key; 8 | for (key in object) { 9 | if (key == 'a') { 10 | delete object.b; 11 | object.d = 3; 12 | } 13 | yield key; 14 | yield object[key]; 15 | } 16 | } 17 | 18 | function accumulate(iterator) { 19 | var result = ''; 20 | for (var value of iterator) { 21 | result = result + String(value); 22 | } 23 | return result; 24 | } 25 | 26 | // ---------------------------------------------------------------------------- 27 | 28 | assert.equal('a0c2',accumulate(forInGenerator2())); 29 | --------------------------------------------------------------------------------