草庐IT

closure-compiler

全部标签

c# - "Edits were made which cannot be compiled"。在 vs2010 中选中零错误和启用并编辑并继续

我能够在Debug模式下编辑我的代码,但随后弹出显示错误Editsweremadewhichcannotbecompiled.Executioncannotcontinueuntilthecompileerrorsarefixed但错误列表为空,我已选中启用编辑并继续。我使用的是vs2010。清理重启也没有解决问题。 最佳答案 当您的工作区损坏时,可能会出现此问题。只需关闭VisualStudio,删除(或者最好先重命名).vs文件夹,然后再次启动VisualStudio。它甚至可以在VS2017中发生。

c# - 接口(interface)继承多个接口(interface) : how is this handled by a C# compiler?

最近我发现C#允许Aninterfacecaninheritfromoneormorebaseinterfaces.例如,Caliburn.Micro中的IScreen在http://caliburnmicro.codeplex.com/SourceControl/latest#src/Caliburn.Micro/IScreen.cs中执行此操作namespaceCaliburn.Micro{publicinterfaceIScreen:IHaveDisplayName,IActivate,IDeactivate,IGuardClose,INotifyPropertyChangedE

c# - 如何修复 'compiler error - cannot convert from method group to System.Delegate' ?

publicMainWindow(){CommandManager.AddExecutedHandler(this,ExecuteHandler);}voidExecuteHandler(objectsender,ExecutedRoutedEventArgse){}错误1​​参数2:无法从“方法组”转换为“System.Delegate” 最佳答案 我猜有多个具有不同签名的ExecuteHandler。只需将您的处理程序转换为您想要的版本:CommandManager.AddExecuteHandler(this,(Action)

c# - 编译 lambda 表达式会产生带有 Closure 参数的委托(delegate)

当我使用Expression.Lambda(...).Compile()时为了从表达式树创建委托(delegate),结果是第一个参数为Closure的委托(delegate).publicstaticFuncCreateTest(){ParameterExpressiona=Expression.Parameter(typeof(T));ParameterExpressionb=Expression.Parameter(typeof(T));Expressionaddition=Expression.Add(a,b);return(Func)Expression.Lambda(add

c# - 协变/逆变 : how to make the following code compile

更新:以下代码仅在C#4.0(VisualStudio2010)中有意义看来我对协变/逆变有一些误解。谁能告诉我为什么以下代码无法编译?publicclassTestOne{publicIEnumerableMethod(IEnumerablevalues)whereTDerived:TBase{returnvalues;}}编译时:(!!!)publicinterfaceIBase{}publicinterfaceIDerived:IBase{}publicclassTestTwo{publicIEnumerableMethod(IEnumerablevalues){returnva

c# - UInt64 和 "The operation overflows at compile time in checked mode"- CS0220

这感觉像是一个愚蠢的问题,但我似乎看不到答案。我有一个UInt64,它的最大值应该是UInt64.MaxValue18446744073709551615但是,当我尝试分配一个中等大小的数字时,出现“在检查模式下编译时操作溢出”的溢出错误。如果我将它包装在一个“未经检查”的block中,那么它会编译并运行,就像这个变量为零一样:UInt64value1=1073741824*8;//CompileerrorCS0220UInt64value2=8589934592;//Actualvalue-noerror为什么会这样? 最佳答案

c# - 我应该关注 linq 查询中的 "access to modified closure"吗?

我有一个显示错误的linq查询:如果集合的源是一个linq查询,每当我尝试访问我正在迭代的变量时,我都会看到这个错误。我想这个错误只是告诉我变量可能会改变,或者类似的东西? 最佳答案 此错误告诉您查询中对pubConfig的引用将使用pubConfig的值在评估查询时,而不是在您定义它并将其存储在pubConfigSettings中时。实际上,如果“当场”评估查询就没问题。如果您保留它供以后评估,而pubConfig的值在此期间发生变化,您将遇到意想不到的结果。 关于c#-我应该关注li

javascript - 如何让 Closure 编译器在调用函数时停止提示联合类型?

我在使用jQuery-1.4.3外部文件时尤其看到了这一点。该javadocs读取/***@param{(string|number|function(number,number))=}arg1*@return{(number|jQueryObject)}*@nosideeffects*/jQueryObject.prototype.width=function(arg1){};我有一个看起来像这样的电话:varw=$(window).width();$('#whatever').width(w)关闭提示:警告-jQueryObject.prototype.height的实际参数1与形

javascript - mustache.js 中 compile()、parse() 和 render() 之间的区别

有什么区别:Mustache.compile(),Mustache.parse(),和Mustache.render()在新mustache.js0.5.0版,也许为了加分,您可以告诉我们解析和编译之间的一般区别是什么。 最佳答案 编辑用APIchangeintroducedinversion0.8.0,compile()方法已集成到parse()中。不再需要手动编译模板。Mustache.parse()从语法上解析模板并从中创建一个JavaScript函数体(一个字符串)。在此过程中,它会通知模板中遇到的任何语法错误。Mustac

javascript - 如何将 language_in 或 jscomp_off 与 Google Closure Compiler Service API 一起使用

是否可以通过某种方式将命令行标志(如--language_in=ECMASCRIPT5或--jscomp_off=internetExplorerChecks传递给GoogleClosureCompilerServiceAPI?我在ServiceAPIReference中找不到它.作为引用,jscomp_off记录在Warnings中和language_in记录在JavaScript中. 最佳答案 https://github.com/google/closure-compiler/wiki/Additional-Webservic